summaryrefslogtreecommitdiff
path: root/openbox/menuframe.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2011-05-10 16:03:33 +0200
committerDana Jansens <danakj@orodu.net>2011-08-01 11:52:31 -0400
commit6ad5f085fa5a38ab8373769cac5cd52839d0a7a5 (patch)
tree549a29cb7c378e8f855d96c5298ce8e0d0e89e4d /openbox/menuframe.c
parentcc4e44e8376f5b76cb23f8cd642f32e0e41b9150 (diff)
Fix menu placement to avoid dead xinerama areas, possibly break other stuff
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.
Diffstat (limited to 'openbox/menuframe.c')
-rw-r--r--openbox/menuframe.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/openbox/menuframe.c b/openbox/menuframe.c
index 5708cdf8..e6fc53ab 100644
--- a/openbox/menuframe.c
+++ b/openbox/menuframe.c
@@ -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);