diff options
author | emersion <contact@emersion.fr> | 2018-04-05 18:48:35 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-04-05 18:48:35 -0400 |
commit | 641807d920854fdecc1307bd809c198db1a7dff1 (patch) | |
tree | a275dc0046e90f7b2eb4ee3195e9f44976757165 /sway/desktop | |
parent | Fix desktop_damage_whole_surface (diff) | |
download | sway-641807d920854fdecc1307bd809c198db1a7dff1.tar.gz sway-641807d920854fdecc1307bd809c198db1a7dff1.tar.zst sway-641807d920854fdecc1307bd809c198db1a7dff1.zip |
Handle unmanaged surfaces motion
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/output.c | 13 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 22 |
2 files changed, 24 insertions, 11 deletions
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) { |