summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openbox/menuframe.c11
-rw-r--r--openbox/screen.c2
2 files changed, 10 insertions, 3 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);
diff --git a/openbox/screen.c b/openbox/screen.c
index e0277ede..d368cab6 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -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)