aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2020-10-18 00:07:41 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2020-10-18 15:18:53 +0200
commit181798c2feb69c930a5800c4a26e1c29797d4ef2 (patch)
tree88f21dc7b02db4db8a26c4b3423a589294821ec0 /sway/desktop/xwayland.c
parentseat: use default output mapping if there is no input config (diff)
downloadsway-181798c2feb69c930a5800c4a26e1c29797d4ef2.tar.gz
sway-181798c2feb69c930a5800c4a26e1c29797d4ef2.tar.zst
sway-181798c2feb69c930a5800c4a26e1c29797d4ef2.zip
xwayland: listen to `set_geometry` event
Closes #5735, refs #3007. This makes the "Search everywhere" dialog in JetBrains IDEs movable.
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c17
1 files changed, 13 insertions, 4 deletions
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) {
47 wl_container_of(listener, surface, commit); 47 wl_container_of(listener, surface, commit);
48 struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; 48 struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
49 49
50 desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
51 false);
52}
53
54static void unmanaged_handle_set_geometry(struct wl_listener *listener, void *data) {
55 struct sway_xwayland_unmanaged *surface =
56 wl_container_of(listener, surface, set_geometry);
57 struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
58
50 if (xsurface->x != surface->lx || xsurface->y != surface->ly) { 59 if (xsurface->x != surface->lx || xsurface->y != surface->ly) {
51 // Surface has moved 60 // Surface has moved
52 desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, 61 desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
@@ -55,9 +64,6 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) {
55 surface->ly = xsurface->y; 64 surface->ly = xsurface->y;
56 desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, 65 desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
57 true); 66 true);
58 } else {
59 desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y,
60 false);
61 } 67 }
62} 68}
63 69
@@ -68,6 +74,9 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) {
68 74
69 wl_list_insert(root->xwayland_unmanaged.prev, &surface->link); 75 wl_list_insert(root->xwayland_unmanaged.prev, &surface->link);
70 76
77 wl_signal_add(&xsurface->events.set_geometry, &surface->set_geometry);
78 surface->set_geometry.notify = unmanaged_handle_set_geometry;
79
71 wl_signal_add(&xsurface->surface->events.commit, &surface->commit); 80 wl_signal_add(&xsurface->surface->events.commit, &surface->commit);
72 surface->commit.notify = unmanaged_handle_commit; 81 surface->commit.notify = unmanaged_handle_commit;
73 82
@@ -89,6 +98,7 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
89 struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; 98 struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
90 desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true); 99 desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true);
91 wl_list_remove(&surface->link); 100 wl_list_remove(&surface->link);
101 wl_list_remove(&surface->set_geometry.link);
92 wl_list_remove(&surface->commit.link); 102 wl_list_remove(&surface->commit.link);
93 103
94 struct sway_seat *seat = input_manager_current_seat(); 104 struct sway_seat *seat = input_manager_current_seat();
@@ -174,7 +184,6 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
174 return surface; 184 return surface;
175} 185}
176 186
177
178static struct sway_xwayland_view *xwayland_view_from_view( 187static struct sway_xwayland_view *xwayland_view_from_view(
179 struct sway_view *view) { 188 struct sway_view *view) {
180 if (!sway_assert(view->type == SWAY_VIEW_XWAYLAND, 189 if (!sway_assert(view->type == SWAY_VIEW_XWAYLAND,