From 259ea27dbc22d8a3dfbb82fb5dac334ad97cedbc Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Thu, 31 May 2012 03:36:36 -0400 Subject: [PATCH 1/2] Better transparency implementation. --- termite.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/termite.c b/termite.c index 0455cc6..87b1236 100644 --- a/termite.c +++ b/termite.c @@ -226,10 +226,11 @@ int main(int argc, char **argv) { #ifdef TRANSPARENCY GdkScreen *screen = gtk_widget_get_screen(window); - GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen); - if (colormap != NULL) { - gtk_widget_set_colormap(window, colormap); - } + GdkVisual *visual = gdk_screen_get_rgba_visual(screen); + if (visual == NULL) + visual = gdk_screen_get_system_visual(screen); + + gtk_widget_set_visual(GTK_WIDGET(window), visual); vte_terminal_set_background_saturation(VTE_TERMINAL(vte), TRANSPARENCY); vte_terminal_set_opacity(VTE_TERMINAL(vte), (guint16)(0xffff * (1 - TRANSPARENCY))); #endif From b43ad9154ffcd2f59b74ecb8383f026846feaf3b Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Thu, 31 May 2012 03:50:40 -0400 Subject: [PATCH 2/2] However it breaks transparency for gtk2. --- Makefile | 1 + termite.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 9049e18..a9dfe03 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ PREFIX = /usr/local ifeq (${GTK3}, 1) GTK = gtk+-3.0 VTE = vte-2.90 + CFLAGS += -DGTK3 else GTK = gtk+-2.0 VTE = vte diff --git a/termite.c b/termite.c index 87b1236..2cf884b 100644 --- a/termite.c +++ b/termite.c @@ -226,11 +226,20 @@ int main(int argc, char **argv) { #ifdef TRANSPARENCY GdkScreen *screen = gtk_widget_get_screen(window); + +#ifdef GTK3 GdkVisual *visual = gdk_screen_get_rgba_visual(screen); if (visual == NULL) visual = gdk_screen_get_system_visual(screen); gtk_widget_set_visual(GTK_WIDGET(window), visual); +#else + GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen); + if (colormap != NULL) { + gtk_widget_set_colormap(window, colormap); + } +#endif + vte_terminal_set_background_saturation(VTE_TERMINAL(vte), TRANSPARENCY); vte_terminal_set_opacity(VTE_TERMINAL(vte), (guint16)(0xffff * (1 - TRANSPARENCY))); #endif