Let menus place themselves on monitors where the mouse is not present This fixes a bug which forced menus to show up on the same monitor as the mouse pointer.
Dana Jansens danakj@orodu.net
3 files changed,
15 insertions(+),
18 deletions(-)
M
openbox/screen.c
→
openbox/screen.c
@@ -1719,15 +1719,19 @@ XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),
ob_cursor(OB_CURSOR_POINTER)); } -guint screen_monitor_pointer() +guint screen_find_monitor_point(guint x, guint y) { Rect mon; - gint x, y; - if (screen_pointer_pos(&x, &y)) - RECT_SET(mon, x, y, 1, 1); - else - RECT_SET(mon, 0, 0, 1, 1); + RECT_SET(mon, x, y, 1, 1); return screen_find_monitor(&mon); +} + +guint screen_monitor_pointer() +{ + gint x, y; + if (!screen_pointer_pos(&x, &y)) + x = y = 0; + return screen_find_monitor_point(x, y); } gboolean screen_pointer_pos(gint *x, gint *y)
M
openbox/screen.h
→
openbox/screen.h
@@ -134,6 +134,9 @@ monitor containing the greatest area of the rectangle is returned.
*/ guint screen_find_monitor(Rect *search); +/*! Finds the monitor which contains the point @x, @y */ +guint screen_find_monitor_point(guint x, guint y); + /*! Sets the root cursor. This function decides which cursor to use, but you gotta call it to let it know it should change. */ void screen_set_root_cursor();