]> Dogcows Code - chaz/openbox/commitdiff
make popup dialogs appear on the active monitor with xinerama
authorDana Jansens <danakj@orodu.net>
Thu, 7 Jun 2007 15:07:50 +0000 (15:07 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 7 Jun 2007 15:07:50 +0000 (15:07 +0000)
openbox/focus_cycle_popup.c
openbox/keyboard.c
openbox/screen.c
openbox/screen.h

index b827e524ff7ff8b850b98f31e36d8e02fd0bacff..071ffc164bd19582c0abef156b89a53bfe2a2590 100644 (file)
@@ -240,7 +240,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
     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 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
     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);
index 51f2cff9dcb6377205c15d388bb1c9e066a5268a..06cd7525bf9fd5c4d6de32eb8be94b462a0e7e51 100644 (file)
@@ -87,6 +87,7 @@ static void set_curpos(KeyBindingTree *newpos)
     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 @@ static void set_curpos(KeyBindingTree *newpos)
             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);
index 9cfc1850250455c33f928d52224196d888f06792..a9b045ff99de68c2d890da82c96e4d2db10fe08c 100644 (file)
@@ -731,7 +731,7 @@ void screen_desktop_popup(guint d, gboolean show)
     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,
@@ -1365,6 +1365,24 @@ Rect *screen_physical_area_monitor(guint head)
     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()
 {
     if (sn_app_starting())
index b40776df9afa541538c10c802bb150386328fe3e..03d6ff697982d684862e2cde5c9f28fabfbee12b 100644 (file)
@@ -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);
This page took 0.032517 seconds and 4 git commands to generate.