[Goodies-commits] r6986 - in xfce4-power-manager/trunk: . panel-plugins/brightness

Ali Abdallah aliov at xfce.org
Mon Mar 23 21:54:56 CET 2009


Author: aliov
Date: 2009-03-23 20:54:55 +0000 (Mon, 23 Mar 2009)
New Revision: 6986

Modified:
   xfce4-power-manager/trunk/ChangeLog
   xfce4-power-manager/trunk/panel-plugins/brightness/brightness-plugin.c
Log:
Support for panel floating position when showing up the brightness popup

Modified: xfce4-power-manager/trunk/ChangeLog
===================================================================
--- xfce4-power-manager/trunk/ChangeLog	2009-03-23 20:37:20 UTC (rev 6985)
+++ xfce4-power-manager/trunk/ChangeLog	2009-03-23 20:54:55 UTC (rev 6986)
@@ -1,4 +1,7 @@
 
+2009-03-23 21:54 Ali aliov at xfce.org 
+	 * : Support for panel floating position when showing up the brightness popup
+
 2009-03-23 20:55 Ali aliov at xfce.org 
 	 * : Fix a crash in the inhibit plugin when the running power manager disappears from the session bus
 

Modified: xfce4-power-manager/trunk/panel-plugins/brightness/brightness-plugin.c
===================================================================
--- xfce4-power-manager/trunk/panel-plugins/brightness/brightness-plugin.c	2009-03-23 20:37:20 UTC (rev 6985)
+++ xfce4-power-manager/trunk/panel-plugins/brightness/brightness-plugin.c	2009-03-23 20:54:55 UTC (rev 6986)
@@ -226,14 +226,31 @@
 	y -= plugin->win->allocation.height;
 	x -= plugin->win->allocation.width/2;
     }
-    /* floating */
-    else if ( pos == XFCE_SCREEN_POSITION_FLOATING_H ||
-	      pos == XFCE_SCREEN_POSITION_FLOATING_V )
+    else if ( pos == XFCE_SCREEN_POSITION_FLOATING_H )
     {
-	g_warning ("Floating position");
-	return;
+	x += plugin->button->allocation.x
+		+ plugin->button->allocation.width/2;
+	x -= plugin->win->allocation.width/2;
+	if ( y > plugin->win->allocation.height )
+	    y -= plugin->win->allocation.height;
+	else 
+	     y += plugin->button->allocation.height;
     }
-    else return;
+    else if ( pos == XFCE_SCREEN_POSITION_FLOATING_V )
+    {
+	y -= plugin->win->allocation.height/2;
+	y += plugin->button->allocation.y
+		+ plugin->button->allocation.height/2;
+	if ( x < plugin->win->allocation.width )
+	    x += plugin->button->allocation.width;
+	else
+	    x -= plugin->win->allocation.width;
+    }
+    else
+    {
+	gtk_widget_hide (plugin->win);
+	g_return_if_reached ();
+    }
    
     gtk_window_move (GTK_WINDOW(plugin->win), x, y);
     TRACE("Displaying window on x=%d y=%d", x, y);




More information about the Goodies-commits mailing list