]> git.mdlowis.com Git - proto/labwc.git/commitdiff
(Partly) fix handling of client-initiated configure requests
authorJohn Lindgren <john@jlindgren.net>
Sat, 2 Jul 2022 17:18:31 +0000 (13:18 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 3 Jul 2022 11:59:36 +0000 (12:59 +0100)
- Add missing call to wlr_scene_node_set_position() in
  unmanaged_handle_commit() -- this fixes moving unmanaged XWayland
  windows.

- Update view->pending_move_resize when we receive a configure request
  for a managed XWayland surface -- this fixes moving managed but
  undecorated XWayland windows.

- Also update view->pending_move_resize when we move a surface while a
  configure request is already pending -- this fixes a discrepancy
  between displayed and actual position for XWayland windows that try to
  set their own initial position, but then get overridden by labwc's
  positioning.

Moving undecorated XWayland windows is still really glitchy -- it appears
that an XWayland window gets sent incorrect mouse motion coordinates when
there is a pending configure request moving the window itself.

include/labwc.h
src/xwayland-unmanaged.c
src/xwayland.c

index 7dd863bd5407883b84a78a7fd356b1d711d59481..0af693ea76a9ced5b1933bcbaa663d146ed455b5 100644 (file)
@@ -365,6 +365,7 @@ struct view {
 struct xwayland_unmanaged {
        struct server *server;
        struct wlr_xwayland_surface *xwayland_surface;
+       struct wlr_scene_node *node;
        struct wl_list link;
        int lx, ly;
 
index 68fe4a0ac2e1e70b61621b8791a6c655760a26a8..fae8d0ba8f4d438cd289ef08f272c1f9e2a696af 100644 (file)
@@ -20,6 +20,8 @@ unmanaged_handle_commit(struct wl_listener *listener, void *data)
        struct wlr_xwayland_surface *xsurface = unmanaged->xwayland_surface;
        unmanaged->lx = xsurface->x;
        unmanaged->ly = xsurface->y;
+       wlr_scene_node_set_position(unmanaged->node,
+               unmanaged->lx, unmanaged->ly);
 }
 
 static void
@@ -59,10 +61,11 @@ unmanaged_handle_map(struct wl_listener *listener, void *data)
        }
 
        /* node will be destroyed automatically once surface is destroyed */
-       struct wlr_scene_node *node = &wlr_scene_surface_create(
+       unmanaged->node = &wlr_scene_surface_create(
                        unmanaged->server->unmanaged_tree,
                        xsurface->surface)->buffer->node;
-       wlr_scene_node_set_position(node, unmanaged->lx, unmanaged->ly);
+       wlr_scene_node_set_position(unmanaged->node,
+               unmanaged->lx, unmanaged->ly);
 }
 
 static void
index 1efd44158ed3707d1b8b1001f94f27701af50285..37cf4c0ec96747bc25923b49ceb7115afc9adda7 100644 (file)
@@ -144,6 +144,13 @@ handle_request_configure(struct wl_listener *listener, void *data)
        int height = event->height;
        view_adjust_size(view, &width, &height);
 
+       view->pending_move_resize.update_x = event->x != view->x;
+       view->pending_move_resize.update_y = event->y != view->y;
+       view->pending_move_resize.x = event->x;
+       view->pending_move_resize.y = event->y;
+       view->pending_move_resize.width = width;
+       view->pending_move_resize.height = height;
+
        wlr_xwayland_surface_configure(view->xwayland_surface,
                event->x, event->y, width, height);
 }
@@ -216,6 +223,13 @@ move(struct view *view, double x, double y)
 {
        view->x = x;
        view->y = y;
+
+       /* override any previous pending move */
+       view->pending_move_resize.update_x = false;
+       view->pending_move_resize.update_y = false;
+       view->pending_move_resize.x = x;
+       view->pending_move_resize.y = y;
+
        struct wlr_xwayland_surface *s = view->xwayland_surface;
        wlr_xwayland_surface_configure(s, (int16_t)x, (int16_t)y,
                (uint16_t)s->width, (uint16_t)s->height);