[RFC weston] xwm: update override-redirect surface's position upon configure_notify

Ilia Bozhinov ammen99 at gmail.com
Tue Jun 27 21:08:40 UTC 2017


When we receive configure_notify we should update the surface's
position by calling xwayland_api->set_xwayland(). Otherwise some surfaces
like dnd surfaces from xwayland views are "stuck" at one place. When
setting XWAYLAND state though we should always call view_set_position(),
not just the first time we set this state.

Signed-off-by: Ilia Bozhinov <ammen99 at gmail.com>
---
 libweston-desktop/xwayland.c | 2 +-
 xwayland/window-manager.c    | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
index 4f4b453f..002e2523 100644
--- a/libweston-desktop/xwayland.c
+++ b/libweston-desktop/xwayland.c
@@ -112,7 +112,6 @@ weston_desktop_xwayland_surface_change_state(struct weston_desktop_xwayland_surf
 				weston_desktop_surface_create_view(surface->surface);
 			weston_layer_entry_insert(&surface->xwayland->layer.view_list,
 						  &surface->view->layer_link);
-			weston_view_set_position(surface->view, x, y);
 			surface->view->is_mapped = true;
 			wsurface->is_mapped = true;
 		}
@@ -316,6 +315,7 @@ set_xwayland(struct weston_desktop_xwayland_surface *surface, int x, int y)
 {
 	weston_desktop_xwayland_surface_change_state(surface, XWAYLAND, NULL,
 						     x, y);
+	weston_view_set_position(surface->view, x, y);
 }
 
 static int
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 25008539..05e78a7e 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -739,6 +739,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
 {
 	xcb_configure_notify_event_t *configure_notify =
 		(xcb_configure_notify_event_t *) event;
+	const struct weston_desktop_xwayland_interface *xwayland_api =
+		wm->server->compositor->xwayland_interface;
 	struct weston_wm_window *window;
 
 	wm_log("XCB_CONFIGURE_NOTIFY (window %d) %d,%d @ %dx%d%s\n",
@@ -760,6 +762,11 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
 		if (window->frame)
 			frame_resize_inside(window->frame,
 					    window->width, window->height);
+
+		/* We should check if shsurf has been created because sometimes
+		 * there are races(configure_notify is sent before xserver_map_surface) */
+		if (window->shsurf)
+			xwayland_api->set_xwayland(window->shsurf, window->x, window->y);
 	}
 }
 
-- 
2.13.0



More information about the wayland-devel mailing list