From 181798c2feb69c930a5800c4a26e1c29797d4ef2 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 18 Oct 2020 00:07:41 -0400 Subject: xwayland: listen to `set_geometry` event Closes #5735, refs #3007. This makes the "Search everywhere" dialog in JetBrains IDEs movable. --- sway/desktop/xwayland.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sway') diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index e35473bf..cee0ab10 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -47,6 +47,15 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { wl_container_of(listener, surface, commit); struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; + desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, + false); +} + +static void unmanaged_handle_set_geometry(struct wl_listener *listener, void *data) { + struct sway_xwayland_unmanaged *surface = + wl_container_of(listener, surface, set_geometry); + struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; + if (xsurface->x != surface->lx || xsurface->y != surface->ly) { // Surface has moved desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, @@ -55,9 +64,6 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { surface->ly = xsurface->y; desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, true); - } else { - desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, - false); } } @@ -68,6 +74,9 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) { wl_list_insert(root->xwayland_unmanaged.prev, &surface->link); + wl_signal_add(&xsurface->events.set_geometry, &surface->set_geometry); + surface->set_geometry.notify = unmanaged_handle_set_geometry; + wl_signal_add(&xsurface->surface->events.commit, &surface->commit); surface->commit.notify = unmanaged_handle_commit; @@ -89,6 +98,7 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true); wl_list_remove(&surface->link); + wl_list_remove(&surface->set_geometry.link); wl_list_remove(&surface->commit.link); struct sway_seat *seat = input_manager_current_seat(); @@ -174,7 +184,6 @@ static struct sway_xwayland_unmanaged *create_unmanaged( return surface; } - static struct sway_xwayland_view *xwayland_view_from_view( struct sway_view *view) { if (!sway_assert(view->type == SWAY_VIEW_XWAYLAND, -- cgit v1.2.3