diff options
-rw-r--r-- | include/sway/tree/view.h | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 13 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 22 | ||||
-rw-r--r-- | sway/input/cursor.c | 14 |
4 files changed, 31 insertions, 20 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index faf38bdf..03d27ceb 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -87,6 +87,8 @@ struct sway_xwayland_unmanaged { | |||
87 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 87 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
88 | struct wl_list link; | 88 | struct wl_list link; |
89 | 89 | ||
90 | int lx, ly; | ||
91 | |||
90 | struct wl_listener request_configure; | 92 | struct wl_listener request_configure; |
91 | struct wl_listener commit; | 93 | struct wl_listener commit; |
92 | struct wl_listener map; | 94 | struct wl_listener map; |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index a7f40ef8..aa18f1b8 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -267,17 +267,14 @@ static void render_output(struct sway_output *output, struct timespec *when, | |||
267 | 267 | ||
268 | // render unmanaged views on top | 268 | // render unmanaged views on top |
269 | struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged; | 269 | struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged; |
270 | struct sway_xwayland_unmanaged *sway_surface; | 270 | struct sway_xwayland_unmanaged *unmanaged_surface; |
271 | wl_list_for_each(sway_surface, unmanaged, link) { | 271 | wl_list_for_each(unmanaged_surface, unmanaged, link) { |
272 | struct wlr_xwayland_surface *xsurface = | 272 | struct wlr_xwayland_surface *xsurface = |
273 | sway_surface->wlr_xwayland_surface; | 273 | unmanaged_surface->wlr_xwayland_surface; |
274 | if (xsurface->surface == NULL) { | ||
275 | continue; | ||
276 | } | ||
277 | 274 | ||
278 | const struct wlr_box view_box = { | 275 | const struct wlr_box view_box = { |
279 | .x = xsurface->x, | 276 | .x = unmanaged_surface->lx, |
280 | .y = xsurface->y, | 277 | .y = unmanaged_surface->ly, |
281 | .width = xsurface->width, | 278 | .width = xsurface->width, |
282 | .height = xsurface->height, | 279 | .height = xsurface->height, |
283 | }; | 280 | }; |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 4797b801..e3da1da7 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -29,19 +29,35 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { | |||
29 | struct sway_xwayland_unmanaged *surface = | 29 | struct sway_xwayland_unmanaged *surface = |
30 | wl_container_of(listener, surface, commit); | 30 | wl_container_of(listener, surface, commit); |
31 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; | 31 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; |
32 | desktop_damage_from_surface(xsurface->surface, xsurface->x, xsurface->y); | 32 | |
33 | // TODO: handle window motion | 33 | if (xsurface->x != surface->lx || xsurface->y != surface->ly) { |
34 | // Surface has moved | ||
35 | desktop_damage_whole_surface(xsurface->surface, | ||
36 | surface->lx, surface->ly); | ||
37 | surface->lx = xsurface->x; | ||
38 | surface->ly = xsurface->y; | ||
39 | desktop_damage_whole_surface(xsurface->surface, | ||
40 | surface->lx, surface->ly); | ||
41 | } else { | ||
42 | desktop_damage_from_surface(xsurface->surface, | ||
43 | xsurface->x, xsurface->y); | ||
44 | } | ||
34 | } | 45 | } |
35 | 46 | ||
36 | static void unmanaged_handle_map(struct wl_listener *listener, void *data) { | 47 | static void unmanaged_handle_map(struct wl_listener *listener, void *data) { |
37 | struct sway_xwayland_unmanaged *surface = | 48 | struct sway_xwayland_unmanaged *surface = |
38 | wl_container_of(listener, surface, map); | 49 | wl_container_of(listener, surface, map); |
39 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; | 50 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; |
51 | |||
40 | wl_list_insert(&root_container.sway_root->xwayland_unmanaged, | 52 | wl_list_insert(&root_container.sway_root->xwayland_unmanaged, |
41 | &surface->link); | 53 | &surface->link); |
54 | |||
42 | wl_signal_add(&xsurface->surface->events.commit, &surface->commit); | 55 | wl_signal_add(&xsurface->surface->events.commit, &surface->commit); |
43 | surface->commit.notify = unmanaged_handle_commit; | 56 | surface->commit.notify = unmanaged_handle_commit; |
44 | desktop_damage_whole_surface(xsurface->surface, xsurface->x, xsurface->y); | 57 | |
58 | surface->lx = xsurface->x; | ||
59 | surface->ly = xsurface->y; | ||
60 | desktop_damage_whole_surface(xsurface->surface, surface->lx, surface->ly); | ||
45 | } | 61 | } |
46 | 62 | ||
47 | static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { | 63 | static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 195ddce9..b83bc9fe 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -48,17 +48,13 @@ static struct sway_container *container_at_cursor(struct sway_cursor *cursor, | |||
48 | struct wlr_surface **surface, double *sx, double *sy) { | 48 | struct wlr_surface **surface, double *sx, double *sy) { |
49 | // check for unmanaged views first | 49 | // check for unmanaged views first |
50 | struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged; | 50 | struct wl_list *unmanaged = &root_container.sway_root->xwayland_unmanaged; |
51 | struct sway_xwayland_unmanaged *sway_surface; | 51 | struct sway_xwayland_unmanaged *unmanaged_surface; |
52 | wl_list_for_each_reverse(sway_surface, unmanaged, link) { | 52 | wl_list_for_each_reverse(unmanaged_surface, unmanaged, link) { |
53 | struct wlr_xwayland_surface *xsurface = | 53 | struct wlr_xwayland_surface *xsurface = |
54 | sway_surface->wlr_xwayland_surface; | 54 | unmanaged_surface->wlr_xwayland_surface; |
55 | if (xsurface->surface == NULL) { | ||
56 | continue; | ||
57 | } | ||
58 | |||
59 | struct wlr_box box = { | 55 | struct wlr_box box = { |
60 | .x = xsurface->x, | 56 | .x = unmanaged_surface->lx, |
61 | .y = xsurface->y, | 57 | .y = unmanaged_surface->ly, |
62 | .width = xsurface->width, | 58 | .width = xsurface->width, |
63 | .height = xsurface->height, | 59 | .height = xsurface->height, |
64 | }; | 60 | }; |