← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~cristiklein/notify-osd/multihead-bottompanel into lp:notify-osd

 

Cristian KLEIN has proposed merging lp:~cristiklein/notify-osd/multihead-bottompanel into lp:notify-osd.

    Requested reviews:
    Notify OSD Developers (notify-osd-developers)
Related bugs:
  #475373 notify-osd uses multihead invisible area
  https://bugs.launchpad.net/bugs/475373

-- 
https://code.launchpad.net/~cristiklein/notify-osd/multihead-bottompanel/+merge/14983
Your team ayatana-commits is subscribed to branch lp:notify-osd.
=== modified file 'src/defaults.c'
--- src/defaults.c	2009-09-29 09:52:49 +0000
+++ src/defaults.c	2009-11-18 08:20:25 +0000
@@ -2377,7 +2377,7 @@
 }
 
 static gboolean
-_window_look_for_top_panel_attributes (GdkWindow *win)
+_window_look_for_panel_attributes (GdkWindow *win, gboolean *ptop)
 {
 	XClassHint class_hints = {0, 0};
 	gboolean is_panel = FALSE;
@@ -2405,8 +2405,13 @@
 
 	/* select only the top panel */
 	gdk_window_get_frame_extents (win, &frame);
-	if (frame.x != 0 || frame.y != 0)
-		goto failed;
+	if (ptop)
+	{
+		if (frame.x != 0 || frame.y != 0)
+			*ptop = FALSE;
+		else
+			*ptop = TRUE;
+	}
 
 	if (frame.width < frame.height)
 		goto failed;
@@ -2425,22 +2430,25 @@
 }
 
 static GdkWindow*
-get_panel_window (void)
+get_panel_window (gboolean *top)
 {
 	GdkWindow *panel_window = NULL;
 	GList     *window;
 	GList     *iter;
 	
+	*top = FALSE;
 	window = gdk_screen_get_window_stack (gdk_screen_get_default ());
 
 	for (iter = g_list_first (window);
 	     iter != NULL;
 	     iter = g_list_next (iter))
 	{
-		if (_window_look_for_top_panel_attributes (iter->data))
+		if (_window_look_for_panel_attributes (iter->data, top))
 		{
 			panel_window = iter->data;
-			break;
+			if (*top)
+				break;
+			/* else keep looking */
 		}
 	}
 	
@@ -2463,6 +2471,7 @@
 	gint         panel_monitor    = 0;
 	gint         aw_monitor;
 	gboolean     has_panel_window = FALSE;
+	gboolean     top_panel        = FALSE;
 
 	g_return_if_fail (self != NULL && IS_DEFAULTS (self));
 
@@ -2472,7 +2481,7 @@
 	                         &my,
 	                         NULL);
 
-	panel_window = get_panel_window ();
+	panel_window = get_panel_window (&top_panel);
 
 	if (panel_window != NULL)
 	{
@@ -2480,7 +2489,8 @@
 		panel_monitor = gdk_screen_get_monitor_at_window (screen,
 		                                                  panel_window);
 		monitor = panel_monitor;
-		g_debug ("found panel (%d,%d) - %dx%d on monitor %d",
+		g_debug ("found %s panel (%d,%d) - %dx%d on monitor %d",
+		     top_panel ? "top" : "non-top",
 			 panel_rect.x,
 		         panel_rect.y,
 			 panel_rect.width,
@@ -2526,19 +2536,23 @@
 	if (has_panel_window &&
 	    panel_monitor == monitor)
 	{
-		/* position the corner on the selected monitor */
-		rect.y += panel_rect.y + panel_rect.height;
+		if (top_panel)
+		{
+			/* position the corner on the selected monitor */
+			rect.y += panel_rect.y + panel_rect.height;
+		}
 	} else if (! has_panel_window)
 	{
-		g_debug ("no panel detetected; using workarea fallback");
+		//g_debug ("no panel detetected; using workarea fallback");
+		g_debug ("no panel detected");
 
-		defaults_refresh_screen_dimension_properties (self);
+		//defaults_refresh_screen_dimension_properties (self);
 
 		/* workarea rectangle */
-		g_object_get (self, "desktop-left", &rect.x, NULL);
-		g_object_get (self, "desktop-top", &rect.y, NULL);
-		g_object_get (self, "desktop-width", &rect.width, NULL);
-		g_object_get (self, "desktop-height", &rect.height, NULL);
+		//g_object_get (self, "desktop-left", &rect.x, NULL);
+		//g_object_get (self, "desktop-top", &rect.y, NULL);
+		//g_object_get (self, "desktop-width", &rect.width, NULL);
+		//g_object_get (self, "desktop-height", &rect.height, NULL);
  	}
 
 	*y   = rect.y;


Follow ups