gnome-launch-box r245 - in trunk: . src



Author: herzi
Date: Mon Mar  9 16:30:38 2009
New Revision: 245
URL: http://svn.gnome.org/viewvc/gnome-launch-box?rev=245&view=rev

Log:
2009-03-09  Sven Herzberg  <herzi lanedo com>

	Bug 566313 â Automatically use "-t" when compositing is on

	Patch from Bastien Nocera

	* src/lb-main.c (update_composited_window), (show_window),
	(composited_changed_cb), (main): Automatically use transparency if
	there's a compositor; Update the window type properly when the
	compositing changes


Modified:
   trunk/ChangeLog
   trunk/src/lb-main.c

Modified: trunk/src/lb-main.c
==============================================================================
--- trunk/src/lb-main.c	(original)
+++ trunk/src/lb-main.c	Mon Mar  9 16:30:38 2009
@@ -34,29 +34,39 @@
 #define COMMAND_SHOW_WINDOW "ShowWindow"
 
 static LbModuleManager *manager = NULL;
+static GtkWidget *window = NULL;
 
+/* Command-line options */
 static gboolean no_window = FALSE;
-static gboolean transparent = FALSE;
 
 static GOptionEntry cmd_args[] = {
 
 	{ "no-default-window", 'n', 0, G_OPTION_ARG_NONE,
 	  &no_window, "Do not show the initial window", NULL},
-	{ "transparent", 't', 0, G_OPTION_ARG_NONE,
-	  &transparent, "Be fancy", NULL}
 };
 
+
 static void
-show_window (void)
+update_composited_window (GdkScreen *screen)
 {
-	static GtkWidget *window = NULL;
+	gboolean composited;
 
-	if (!manager) {
-		manager = g_object_new (LB_TYPE_MODULE_MANAGER,	NULL);
-		
-		window = lb_window_new (manager, transparent);
-		gtk_window_set_default_size (GTK_WINDOW (window), 300, -1);
-	}
+	composited = gdk_screen_is_composited (screen);
+
+	if (window)
+		g_object_unref (window);
+	if (!manager)
+		manager = g_object_new (LB_TYPE_MODULE_MANAGER, NULL);
+
+	window = lb_window_new (manager, composited);
+	gtk_window_set_default_size (GTK_WINDOW (window), 300, -1);
+}
+
+static void
+show_window (void)
+{
+	if (!manager)
+		update_composited_window (gdk_screen_get_default ());
 
 	lb_window_present (LB_WINDOW (window));
 }
@@ -78,6 +88,12 @@
 }
 
 static void
+composited_changed_cb (GdkScreen *screen, gpointer user_data)
+{
+	update_composited_window (screen);
+}
+
+static void
 key_handler_bind (const char *keystring)
 {
 	static gchar *old = NULL;
@@ -148,6 +164,9 @@
 	key_handler_bind (key);
 	g_free (key);
 
+	g_signal_connect (G_OBJECT (gdk_screen_get_default ()), "composited-changed",
+			  G_CALLBACK (composited_changed_cb), NULL);
+
 	/* FIXME: Add a notify handler on that key and update the binding when
 	 * it changes.
 	 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]