rm support for transparency (deprecated upstream)

I considered replacing this with `gtk_widget_set_opacity`, but it's no
more usable than window manager transparency since the font is transparent.

Since this is already broken with URL hints and won't be around in the
future, it might as well go sooner rather than later.

Closes #128
Closes #39
This commit is contained in:
Daniel Micay 2013-10-19 16:35:50 -04:00
parent b47ad17efb
commit 9baf7c94e1
3 changed files with 3 additions and 42 deletions

3
config
View File

@ -15,9 +15,6 @@ search_wrap = true
#icon_name = terminal #icon_name = terminal
#geometry = 640x480 #geometry = 640x480
# 0.0: opaque, 1.0: transparent
transparency = 0.0
# "system", "on" or "off" # "system", "on" or "off"
cursor_blink = system cursor_blink = system

View File

@ -23,9 +23,6 @@ Set the termite window's title to \fITITLE\fP. This disables dynamic
titles. titles.
.IP "\fB\-d\fR, \fB\-\-directory\fR\fB=\fR\fIDIRECTORY\fR" .IP "\fB\-d\fR, \fB\-\-directory\fR\fB=\fR\fIDIRECTORY\fR"
Tell termite to change to \fIDIRECTORY\fP when launching. Tell termite to change to \fIDIRECTORY\fP when launching.
.IP "\fB\-x\fR, \fB\-\-transparency\fR\fB=\fR\fILEVEL\fR"
Sets the window's transparency to \fILEVEL\fP, ranging from \fI0.0\fP
(fully opaque) to \fI1.0\fP (fully transparent).
.IP "\fB\-\-geometry\fR\fB=\fR\fIGEOMETRY\fR" .IP "\fB\-\-geometry\fR\fB=\fR\fIGEOMETRY\fR"
Override the window geometry in pixels. Override the window geometry in pixels.
.IP "\fB\-\-hold\fR" .IP "\fB\-\-hold\fR"

View File

@ -87,7 +87,7 @@ struct hint_info {
struct config_info { struct config_info {
hint_info hints; hint_info hints;
char *browser; char *browser;
gboolean dynamic_title, urgent_on_bell, clickable_url, opacity_set, size_hints; gboolean dynamic_title, urgent_on_bell, clickable_url, size_hints;
int tag; int tag;
char *config_file; char *config_file;
}; };
@ -107,7 +107,6 @@ struct draw_cb_info {
}; };
static void launch_browser(char *browser, char *url); static void launch_browser(char *browser, char *url);
static void set_opacity(GtkWidget *window, VteTerminal *vte, double opacity);
static void window_title_cb(VteTerminal *vte, gboolean *dynamic_title); static void window_title_cb(VteTerminal *vte, gboolean *dynamic_title);
static gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info); static gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info);
static gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *info); static gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *info);
@ -132,26 +131,7 @@ void launch_browser(char *browser, char *url) {
g_spawn_async(nullptr, browser_cmd, nullptr, G_SPAWN_SEARCH_PATH, nullptr, nullptr, nullptr, nullptr); g_spawn_async(nullptr, browser_cmd, nullptr, G_SPAWN_SEARCH_PATH, nullptr, nullptr, nullptr, nullptr);
} }
static void set_opacity(GtkWidget *window, VteTerminal *vte, double opacity) { static void set_size_hints(GtkWindow *window, int char_width, int char_height) {
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(window));
GdkVisual *visual;
if (opacity > 0.0 && (visual = gdk_screen_get_rgba_visual(screen))) {
vte_terminal_set_opacity(vte, (guint16)(0xffff * (1 - opacity)));
} else {
visual = gdk_screen_get_system_visual(screen);
vte_terminal_set_opacity(vte, G_MAXUINT16);
}
if (visual != gtk_widget_get_visual(GTK_WIDGET(window))) {
gtk_widget_set_visual(GTK_WIDGET(window), visual);
// TODO; need to make dynamic changes to the visual work
// the obvious way is simply to hide the window and the restore shown widgets
}
}
static void set_size_hints(GtkWindow *window, int char_width, int char_height)
{
static const GdkWindowHints wh = (GdkWindowHints)(GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); static const GdkWindowHints wh = (GdkWindowHints)(GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
GdkGeometry hints; GdkGeometry hints;
@ -1254,12 +1234,6 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info,
g_free(*s); g_free(*s);
} }
if (auto opacity = get_config_double(config, "options", "transparency")) {
if (!info->opacity_set) {
set_opacity(GTK_WIDGET(window), vte, *opacity);
}
}
if (info->size_hints) { if (info->size_hints) {
set_size_hints(GTK_WINDOW(window), (int)vte_terminal_get_char_width(vte), set_size_hints(GTK_WINDOW(window), (int)vte_terminal_get_char_width(vte),
(int)vte_terminal_get_char_height(vte)); (int)vte_terminal_get_char_height(vte));
@ -1283,14 +1257,12 @@ int main(int argc, char **argv) {
GOptionContext *context = g_option_context_new(nullptr); GOptionContext *context = g_option_context_new(nullptr);
char *role = nullptr, *geometry = nullptr, *execute = nullptr, *config_file = nullptr; char *role = nullptr, *geometry = nullptr, *execute = nullptr, *config_file = nullptr;
char *title = nullptr; char *title = nullptr;
double trans = 0.0;
const GOptionEntry entries[] = { const GOptionEntry entries[] = {
{"version", 'v', 0, G_OPTION_ARG_NONE, &version, "Version info", nullptr}, {"version", 'v', 0, G_OPTION_ARG_NONE, &version, "Version info", nullptr},
{"exec", 'e', 0, G_OPTION_ARG_STRING, &execute, "Command to execute", "COMMAND"}, {"exec", 'e', 0, G_OPTION_ARG_STRING, &execute, "Command to execute", "COMMAND"},
{"role", 'r', 0, G_OPTION_ARG_STRING, &role, "The role to use", "ROLE"}, {"role", 'r', 0, G_OPTION_ARG_STRING, &role, "The role to use", "ROLE"},
{"title", 't', 0, G_OPTION_ARG_STRING, &title, "Window title", "TITLE"}, {"title", 't', 0, G_OPTION_ARG_STRING, &title, "Window title", "TITLE"},
{"directory", 'd', 0, G_OPTION_ARG_STRING, &directory, "Change to directory", "DIRECTORY"}, {"directory", 'd', 0, G_OPTION_ARG_STRING, &directory, "Change to directory", "DIRECTORY"},
{"transparency", 'x', 0, G_OPTION_ARG_DOUBLE, &trans, "Initial transparency", "OPACITY"},
{"geometry", 0, 0, G_OPTION_ARG_STRING, &geometry, "Window geometry", "GEOMETRY"}, {"geometry", 0, 0, G_OPTION_ARG_STRING, &geometry, "Window geometry", "GEOMETRY"},
{"hold", 0, 0, G_OPTION_ARG_NONE, &hold, "Remain open after child process exits", nullptr}, {"hold", 0, 0, G_OPTION_ARG_NONE, &hold, "Remain open after child process exits", nullptr},
{"config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Path of config file", "CONFIG"}, {"config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Path of config file", "CONFIG"},
@ -1364,7 +1336,7 @@ int main(int argc, char **argv) {
nullptr}, nullptr},
{vi_mode::insert, 0, 0, 0, 0}, {vi_mode::insert, 0, 0, 0, 0},
{{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0}, {{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0},
nullptr, FALSE, FALSE, FALSE, FALSE, FALSE, -1, config_file} nullptr, FALSE, FALSE, FALSE, FALSE, -1, config_file}
}; };
load_config(GTK_WINDOW(window), vte, &info.config, geometry ? nullptr : &geometry); load_config(GTK_WINDOW(window), vte, &info.config, geometry ? nullptr : &geometry);
@ -1426,11 +1398,6 @@ int main(int argc, char **argv) {
g_free(geometry); g_free(geometry);
} }
if (trans > 0.0) {
info.config.opacity_set = true;
set_opacity(GTK_WIDGET(window), vte, trans);
}
gtk_widget_grab_focus(vte_widget); gtk_widget_grab_focus(vte_widget);
gtk_widget_show_all(window); gtk_widget_show_all(window);
gtk_widget_hide(info.panel.panel); gtk_widget_hide(info.panel.panel);