Fix menu placement to avoid dead xinerama areas, possibly break other stuff
[dana/openbox.git] / openbox / screen.c
index 4d73eea..d368cab 100644 (file)
@@ -500,11 +500,12 @@ void screen_resize(void)
     if (ob_state() != OB_STATE_RUNNING)
         return;
 
-    screen_update_areas();
+    /* this calls screen_update_areas(), which we need ! */
     dock_configure();
 
-    for (it = client_list; it; it = g_list_next(it))
-        client_move_onscreen(it->data, FALSE);
+    if (oldw)
+        for (it = client_list; it; it = g_list_next(it))
+            client_move_onscreen(it->data, FALSE);
 }
 
 void screen_set_num_desktops(guint num)
@@ -1458,10 +1459,8 @@ void screen_update_areas(void)
                     dims, 4 * screen_num_desktops);
 
     /* the area has changed, adjust all the windows if they need it */
-    for (it = onscreen; it; it = g_list_next(it)) {
-        client_move_onscreen(it->data, FALSE);
+    for (it = onscreen; it; it = g_list_next(it))
         client_reconfigure(it->data, FALSE);
-    }
 
     g_free(dims);
 }
@@ -1653,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)
@@ -1754,3 +1753,12 @@ gboolean screen_pointer_pos(gint *x, gint *y)
     }
     return ret;
 }
+
+gboolean screen_compare_desktops(guint a, guint b)
+{
+    if (a == DESKTOP_ALL)
+        a = screen_desktop;
+    if (b == DESKTOP_ALL)
+        b = screen_desktop;
+    return a == b;
+}