]> Dogcows Code - chaz/openbox/commitdiff
Fix menu placement to avoid dead xinerama areas, possibly break other stuff
authorMikael Magnusson <mikachu@gmail.com>
Tue, 10 May 2011 14:03:33 +0000 (16:03 +0200)
committerDana Jansens <danakj@orodu.net>
Mon, 1 Aug 2011 15:52:31 +0000 (11:52 -0400)
Use screen_find_monitor(area) instead of screen_find_monitor_point(
topleft corner) in order to find a better monitor when the menu isn't
opening with the mouse cursor in the top left corner.

I made screen_find_monitor return the primary screen when it failed to
find a monitor containing the rect, instead of the total area, no idea
what behaviour this will change but I doubt it will be worse.

openbox/menuframe.c
openbox/screen.c

index 5708cdf8d2e337c604a209cfbed53ac1525c127e..e6fc53ab2949cbb2b8fcc2b14d7e4823ac84a5bf 100644 (file)
@@ -324,11 +324,18 @@ void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
                                gint *dx, gint *dy)
 {
     const Rect *a = NULL;
-    gint pos, half;
+    Rect search = self->area;
+    gint pos, half, monitor;
 
     *dx = *dy = 0;
+    RECT_SET_POINT(search, x, y);
 
-    a = screen_physical_area_monitor(screen_find_monitor_point(x, y));
+    if (self->parent)
+        monitor = self->parent->monitor;
+    else
+        monitor = screen_find_monitor(&search);
+
+    a = screen_physical_area_monitor(monitor);
 
     half = g_list_length(self->entries) / 2;
     pos = g_list_index(self->entries, self->selected);
index e0277edef18aba7299dd60680264bd5479cd21c3..d368cab68ca8a5d76adeca13ce874486076d6b51 100644 (file)
@@ -1652,7 +1652,7 @@ guint screen_find_monitor(const Rect *search)
             }
         }
     }
-    return most;
+    return most < screen_num_monitors ? most : screen_monitor_primary(FALSE);
 }
 
 const Rect* screen_physical_area_all_monitors(void)
This page took 0.029461 seconds and 4 git commands to generate.