make popup dialogs appear on the active monitor with xinerama
Dana Jansens danakj@orodu.net
4 files changed,
26 insertions(+),
5 deletions(-)
M
openbox/focus_cycle_popup.c
→
openbox/focus_cycle_popup.c
@@ -240,7 +240,7 @@ {
gint ml, mt, mr, mb; gint l, t, r, b; gint x, y, w, h; - Rect *screen_area; + Rect *screen_area = NULL; gint icons_per_row; gint icon_rows; gint textx, texty, textw, texth;@@ -252,8 +252,7 @@ GList *it;
const ObFocusCyclePopupTarget *newtarget; gint newtargetx, newtargety; - /* XXX find the middle monitor? */ - screen_area = screen_physical_area_monitor(0); + screen_area = screen_physical_area_monitor_active(); /* get the outside margins */ RrMargins(p->a_bg, &ml, &mt, &mr, &mb);
M
openbox/keyboard.c
→
openbox/keyboard.c
@@ -87,6 +87,7 @@
if (curpos != NULL) { gchar *text = NULL; GList *it; + Rect *a; for (it = curpos->keylist; it; it = g_list_next(it)) { gchar *oldtext = text;@@ -97,7 +98,8 @@ text = g_strconcat(text, " - ", it->data, NULL);
g_free(oldtext); } - popup_position(popup, NorthWestGravity, 10, 10); + a = screen_physical_area_monitor_active(); + popup_position(popup, NorthWestGravity, a->x + 10, a->y + 10); /* 1 second delay for the popup to show */ popup_delay_show(popup, G_USEC_PER_SEC, text); g_free(text);
M
openbox/screen.c
→
openbox/screen.c
@@ -731,7 +731,7 @@
if (!show) { pager_popup_hide(desktop_cycle_popup); } else { - a = screen_physical_area_monitor(0); + a = screen_physical_area_monitor_active(); pager_popup_position(desktop_cycle_popup, CenterGravity, a->x + a->width / 2, a->y + a->height / 2); pager_popup_icon_size_multiplier(desktop_cycle_popup,@@ -1363,6 +1363,24 @@ {
if (head > screen_num_monitors) return NULL; return &monitor_area[head]; +} + +Rect *screen_physical_area_monitor_active() +{ + Rect *a; + gint x, y; + + if (focus_client) + a = screen_physical_area_monitor(client_monitor(focus_client)); + else { + Rect mon; + if (screen_pointer_pos(&x, &y)) + RECT_SET(mon, x, y, 1, 1); + else + RECT_SET(mon, 0, 0, 1, 1); + a = screen_physical_area_monitor(screen_find_monitor(&mon)); + } + return a; } void screen_set_root_cursor()
M
openbox/screen.h
→
openbox/screen.h
@@ -98,6 +98,8 @@ Rect *screen_physical_area();
Rect *screen_physical_area_monitor(guint head); +Rect *screen_physical_area_monitor_active(); + Rect *screen_area(guint desktop); Rect *screen_area_monitor(guint desktop, guint head);