summary refs log tree commit diff stats
path: root/src/fe-gtk/setup.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-09-26 23:24:27 -0400
committerTingPing <tingping@tingping.se>2013-09-27 17:40:05 -0400
commit449553ffb0e42656221c3a322d10c14cf86abb6c (patch)
treec6da95e57035cee71d94f4ee5dffca30328580b7 /src/fe-gtk/setup.c
parentf23bda9e469fad7b6d83d9f30dd22a073cab5102 (diff)
Replace xtext's transparency with full window transparency
Xtext's transparency barely worked on windows, didn't work on any modern
linux wm and used fake transparency.
This uses gtk's built in window opacity that works on more systems and
is real transparency.
Text area only transparency may return with a transition to cairo, if it
works on Windows.
Diffstat (limited to 'src/fe-gtk/setup.c')
-rw-r--r--src/fe-gtk/setup.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 4c2d4d11..41b50ac7 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -159,19 +159,11 @@ static const setting appearance_settings[] =
 	{ST_HEADER,	N_("Text Box"),0,0,0},
 	{ST_TOGGLE, N_("Colored nick names"), P_OFFINTNL(hex_text_color_nicks), N_("Give each person on IRC a different color"),0,0},
 	{ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(hex_text_indent), N_("Make nick names right-justified"),0,0},
-#if defined(USE_XLIB) || defined(WIN32)
-	{ST_TOGGLE, N_("Transparent background"), P_OFFINTNL(hex_text_transparent),0,0,0},
-	{ST_TOGGLR, N_("Show marker line"), P_OFFINTNL(hex_text_show_marker), N_("Insert a red line after the last read text."),0,0},
-	{ST_EFILE,  N_("Background image:"), P_OFFSETNL(hex_text_background), 0, 0, sizeof prefs.hex_text_background},
+	{ST_TOGGLE, N_ ("Show marker line"), P_OFFINTNL (hex_text_show_marker), N_ ("Insert a red line after the last read text."), 0, 0},
+	{ST_EFILE, N_ ("Background image:"), P_OFFSETNL (hex_text_background), 0, 0, sizeof prefs.hex_text_background},
 
 	{ST_HEADER, N_("Transparency Settings"), 0,0,0},
-	{ST_HSCALE, N_("Red:"), P_OFFINTNL(hex_text_tint_red),0,0,0},
-	{ST_HSCALE, N_("Green:"), P_OFFINTNL(hex_text_tint_green),0,0,0},
-	{ST_HSCALE, N_("Blue:"), P_OFFINTNL(hex_text_tint_blue),0,0,0},
-#else
-	{ST_TOGGLE, N_("Show marker line"), P_OFFINTNL(hex_text_show_marker), N_("Insert a red line after the last read text."),0,0},
-	{ST_EFILE,  N_("Background image:"), P_OFFSETNL(hex_text_background), 0, 0, sizeof prefs.hex_text_background},
-#endif
+	{ST_HSCALE, N_("Window Opacity:"), P_OFFINTNL(hex_gui_transparency),0,0,0},
 
 	{ST_HEADER,	N_("Time Stamps"),0,0,0},
 	{ST_TOGGLE, N_("Enable time stamps"), P_OFFINTNL(hex_stamp_text),0,0,1},
@@ -839,12 +831,13 @@ setup_create_spin (GtkWidget *table, int row, const setting *set)
 }
 
 static gint
-setup_apply_tint (int *tag)
+setup_apply_trans (int *tag)
 {
-	prefs.hex_text_tint_red = setup_prefs.hex_text_tint_red;
-	prefs.hex_text_tint_green = setup_prefs.hex_text_tint_green;
-	prefs.hex_text_tint_blue = setup_prefs.hex_text_tint_blue;
-	mg_update_xtext (current_sess->gui->xtext);
+	prefs.hex_gui_transparency = setup_prefs.hex_gui_transparency;
+	gtk_window_set_opacity (GTK_WINDOW (current_sess->gui->window),
+							(prefs.hex_gui_transparency / 255.));
+
+	/* mg_update_xtext (current_sess->gui->xtext); */
 	*tag = 0;
 	return 0;
 }
@@ -858,7 +851,7 @@ setup_hscale_cb (GtkHScale *wid, const setting *set)
 
 	if (tag == 0)
 	{
-		tag = g_idle_add ((GSourceFunc) setup_apply_tint, &tag);
+		tag = g_idle_add ((GSourceFunc) setup_apply_trans, &tag);
 	}
 }
 
@@ -879,6 +872,12 @@ setup_create_hscale (GtkWidget *table, int row, const setting *set)
 							G_CALLBACK (setup_hscale_cb), (gpointer)set);
 	gtk_table_attach (GTK_TABLE (table), wid, 3, 6, row, row + 1,
 							GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+#ifndef WIN32 /* Windows always supports this */
+	/* Only used for transparency currently */
+	if (!gtk_widget_is_composited (current_sess->gui->window))
+		gtk_widget_set_sensitive (wid, FALSE);
+#endif
 }