]> Dogcows Code - chaz/openbox/commitdiff
when an app tries to move to 0,0 and there is a strut there (java swing!), move it...
authorDana Jansens <danakj@orodu.net>
Mon, 1 Mar 2010 20:55:27 +0000 (15:55 -0500)
committerDana Jansens <danakj@orodu.net>
Mon, 1 Mar 2010 21:32:23 +0000 (16:32 -0500)
openbox/client.c
openbox/event.c

index 3fe3faa189cfb5b94e18a2375dbdb4ce4e818f89..83ea46f15d9a68402559f9002458d6496c4f72b9 100644 (file)
@@ -345,9 +345,11 @@ void client_manage(Window window, ObPrompt *prompt)
             Rect *r;
 
             r = screen_area(self->desktop, SCREEN_AREA_ALL_MONITORS, NULL);
-            place.x = r->x;
-            place.y = r->y;
-            ob_debug("Moving buggy app from (0,0) to (%d,%d)", r->x, r->y);
+            if (r->x || r->y) {
+                place.x = r->x;
+                place.y = r->y;
+                ob_debug("Moving buggy app from (0,0) to (%d,%d)", r->x, r->y);
+            }
             g_slice_free(Rect, r);
         }
 
index 14aa696bb119689bca9f110947b1c13fe857b682..7596fe3e4175b91548b9dcd862ae2c706a8d3acf 100644 (file)
@@ -1247,6 +1247,49 @@ static void event_handle_client(ObClient *client, XEvent *e)
                notify is sent or not */
         }
 
+        /* check for broken apps (java swing) moving to 0,0 when there is a
+           strut there.
+
+           XXX remove this some day...that would be nice. but really unexpected
+           from Sun Microsystems.
+        */
+        g_print("x %d y %d grav %d %d\n", x, y, client->gravity, NorthWestGravity);
+        if (x == 0 && y == 0 && client->gravity == NorthWestGravity) {
+            const Rect to = { x, y, w, h };
+            Rect const *monitor, *allmonitors;
+            monitor = screen_physical_area_monitor(client_monitor(client));
+            allmonitors = screen_physical_area_all_monitors();
+
+            /* oldschool fullscreen windows are allowed */
+            if (!(client->decorations == 0 &&
+                  (RECT_EQUAL(to, *monitor) ||
+                   RECT_EQUAL(to, *allmonitors))))
+            {
+                Rect *r;
+
+                r = screen_area(client->desktop, SCREEN_AREA_ALL_MONITORS,
+                                NULL);
+                if (r->x || r->y) {
+                    /* move the window only to the corner outside struts */
+                    x = r->x;
+                    y = r->y;
+
+                    ob_debug_type(OB_DEBUG_APP_BUGS,
+                                  "Application %s is trying to move via "
+                                  "ConfigureRequest to 0,0 using "
+                                  "NorthWestGravity, while there is a "
+                                  "strut there. "
+                                  "Moving buggy app from (0,0) to (%d,%d)",
+                                  client->title, r->x, r->y);
+                }
+
+                g_slice_free(Rect, r);
+
+                /* they still requested a move, so don't change whether a
+                   notify is sent or not */
+            }
+        }
+
         {
             gint lw, lh;
 
This page took 0.037517 seconds and 4 git commands to generate.