]> Dogcows Code - chaz/openbox/blobdiff - openbox/place.c
try place under the mouse when theres no free space? maybe thats dumb
[chaz/openbox] / openbox / place.c
index 5d848cb9126130f31f738fe97b6135c7a46377b1..6c81df6189c336f3e01225178249c2ed6ee3740b 100644 (file)
@@ -220,7 +220,8 @@ enum {
     IGNORE_SHADED     = 1 << 3,
     IGNORE_NONGROUP   = 1 << 4,
     IGNORE_BELOW      = 1 << 5,
-    IGNORE_END        = 1 << 6
+    IGNORE_NONFOCUS   = 1 << 6,
+    IGNORE_END        = 1 << 7
 };
 
 static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
@@ -242,12 +243,14 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
 
         /* try all monitors in order of preference */
         for (i = 0; i < screen_num_monitors && !ret; ++i) {
+            GList *it;
+
             /* add the whole monitor */
             spaces = area_add(spaces, areas[i]);
 
             /* go thru all the windows */
-            for (sit = client_list; sit; sit = g_slist_next(sit)) {
-                ObClient *test = sit->data;
+            for (it = client_list; it; it = g_list_next(it)) {
+                ObClient *test = it->data;
 
                 /* should we ignore this client? */
                 if (screen_showing_desktop) continue;
@@ -279,6 +282,8 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
                     test->group != c->group) continue;
                 if ((ignore & IGNORE_BELOW) &&
                     test->layer < c->layer) continue;
+                if ((ignore & IGNORE_NONFOCUS) &&
+                    focus_client != test) continue;
 
                 /* don't ignore this window, so remove it from the available
                    area */
@@ -323,8 +328,9 @@ static gboolean place_under_mouse(ObClient *client, gint *x, gint *y)
     gint px, py;
     Rect *area;
 
+    if (!screen_pointer_pos(&px, &py))
+        return FALSE;
     area = pick_pointer_head(client);
-    screen_pointer_pos(&px, &py);
 
     l = area->x;
     t = area->y;
@@ -442,6 +448,7 @@ gboolean place_client(ObClient *client, gint *x, gint *y,
         (config_place_policy == OB_PLACE_POLICY_MOUSE &&
          place_under_mouse(client, x, y)) ||
         place_nooverlap(client, x, y) ||
+        place_under_mouse(client, x, y) ||
         place_random(client, x, y);
     g_assert(ret);
 
This page took 0.022354 seconds and 4 git commands to generate.