]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland: Don't center views with explicitly specified position
authorJohn Lindgren <john@jlindgren.net>
Mon, 5 Sep 2022 01:45:03 +0000 (21:45 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 6 Sep 2022 11:39:22 +0000 (13:39 +0200)
src/xwayland.c

index 5bfacecef1770762db344f803b802ac659292b46..d092b3ea1646afe6db0d564d26749c072dbeda32 100644 (file)
@@ -276,6 +276,27 @@ handle_override_redirect(struct wl_listener *listener, void *data)
        }
 }
 
+static void
+set_initial_position(struct view *view)
+{
+       /* Don't center views with position explicitly specified */
+       bool has_position = view->xwayland_surface->size_hints &&
+               (view->xwayland_surface->size_hints->flags &
+                       (XCB_ICCCM_SIZE_HINT_US_POSITION |
+                        XCB_ICCCM_SIZE_HINT_P_POSITION));
+
+       if (has_position) {
+               /* Just make sure the view is on-screen */
+               view_adjust_for_layout_change(view);
+       } else {
+               struct wlr_box box =
+                       output_usable_area_from_cursor_coords(view->server);
+               view->x = box.x;
+               view->y = box.y;
+               view_center(view);
+       }
+}
+
 static void
 top_left_edge_boundary_check(struct view *view)
 {
@@ -333,11 +354,7 @@ map(struct view *view)
                }
 
                if (!view->maximized && !view->fullscreen) {
-                       struct wlr_box box =
-                               output_usable_area_from_cursor_coords(view->server);
-                       view->x = box.x;
-                       view->y = box.y;
-                       view_center(view);
+                       set_initial_position(view);
                }
 
                view_moved(view);