From 9baf7c94e19e13ab88cc76f0b62f4a6f938a4d5a Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 19 Oct 2013 16:35:50 -0400 Subject: [PATCH] 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 --- config | 3 --- termite.1 | 3 --- termite.cc | 39 +++------------------------------------ 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/config b/config index e6fdcd8..d60bb6c 100644 --- a/config +++ b/config @@ -15,9 +15,6 @@ search_wrap = true #icon_name = terminal #geometry = 640x480 -# 0.0: opaque, 1.0: transparent -transparency = 0.0 - # "system", "on" or "off" cursor_blink = system diff --git a/termite.1 b/termite.1 index 5e8e39d..9de22fd 100644 --- a/termite.1 +++ b/termite.1 @@ -23,9 +23,6 @@ Set the termite window's title to \fITITLE\fP. This disables dynamic titles. .IP "\fB\-d\fR, \fB\-\-directory\fR\fB=\fR\fIDIRECTORY\fR" 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" Override the window geometry in pixels. .IP "\fB\-\-hold\fR" diff --git a/termite.cc b/termite.cc index d897759..0999f0a 100644 --- a/termite.cc +++ b/termite.cc @@ -87,7 +87,7 @@ struct hint_info { struct config_info { hint_info hints; 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; char *config_file; }; @@ -107,7 +107,6 @@ struct draw_cb_info { }; 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 gboolean key_press_cb(VteTerminal *vte, 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); } -static void set_opacity(GtkWidget *window, VteTerminal *vte, double opacity) { - 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 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); GdkGeometry hints; @@ -1254,12 +1234,6 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info, 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) { set_size_hints(GTK_WINDOW(window), (int)vte_terminal_get_char_width(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); char *role = nullptr, *geometry = nullptr, *execute = nullptr, *config_file = nullptr; char *title = nullptr; - double trans = 0.0; const GOptionEntry entries[] = { {"version", 'v', 0, G_OPTION_ARG_NONE, &version, "Version info", nullptr}, {"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"}, {"title", 't', 0, G_OPTION_ARG_STRING, &title, "Window title", "TITLE"}, {"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"}, {"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"}, @@ -1364,7 +1336,7 @@ int main(int argc, char **argv) { nullptr}, {vi_mode::insert, 0, 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); @@ -1426,11 +1398,6 @@ int main(int argc, char **argv) { 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_show_all(window); gtk_widget_hide(info.panel.panel);