diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-19 21:08:51 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-19 21:08:51 +1000 |
commit | 63d6233fcb601abd40f6c611aa4193766aaf9044 (patch) | |
tree | ab483bbac370d68b62fdc54ab6e61ff17229b97b | |
parent | Merge pull request #2300 from emersion/override-redirect-updates (diff) | |
download | sway-63d6233fcb601abd40f6c611aa4193766aaf9044.tar.gz sway-63d6233fcb601abd40f6c611aa4193766aaf9044.tar.zst sway-63d6233fcb601abd40f6c611aa4193766aaf9044.zip |
Allow xwayland views to become urgent when on a non-visible workspace
This removes the urgency stuff from the commit handler and puts it in a
new set_hints handler instead. This allows the xwayland surface to
become urgent without having to commit (which doesn't happen if it's on
an non-visible workspace).
-rw-r--r-- | include/sway/tree/view.h | 1 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 21 |
2 files changed, 18 insertions, 4 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index e270f851..068d92c6 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -140,6 +140,7 @@ struct sway_xwayland_view { | |||
140 | struct wl_listener set_title; | 140 | struct wl_listener set_title; |
141 | struct wl_listener set_class; | 141 | struct wl_listener set_class; |
142 | struct wl_listener set_window_type; | 142 | struct wl_listener set_window_type; |
143 | struct wl_listener set_hints; | ||
143 | struct wl_listener map; | 144 | struct wl_listener map; |
144 | struct wl_listener unmap; | 145 | struct wl_listener unmap; |
145 | struct wl_listener destroy; | 146 | struct wl_listener destroy; |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 7737a33a..72dc7ca2 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -290,10 +290,6 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
290 | } | 290 | } |
291 | 291 | ||
292 | view_damage_from(view); | 292 | view_damage_from(view); |
293 | |||
294 | if (view->allow_request_urgent) { | ||
295 | view_set_urgent(view, (bool)xsurface->hints_urgency); | ||
296 | } | ||
297 | } | 293 | } |
298 | 294 | ||
299 | static void handle_destroy(struct wl_listener *listener, void *data) { | 295 | static void handle_destroy(struct wl_listener *listener, void *data) { |
@@ -312,6 +308,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
312 | wl_list_remove(&xwayland_view->set_title.link); | 308 | wl_list_remove(&xwayland_view->set_title.link); |
313 | wl_list_remove(&xwayland_view->set_class.link); | 309 | wl_list_remove(&xwayland_view->set_class.link); |
314 | wl_list_remove(&xwayland_view->set_window_type.link); | 310 | wl_list_remove(&xwayland_view->set_window_type.link); |
311 | wl_list_remove(&xwayland_view->set_hints.link); | ||
315 | wl_list_remove(&xwayland_view->map.link); | 312 | wl_list_remove(&xwayland_view->map.link); |
316 | wl_list_remove(&xwayland_view->unmap.link); | 313 | wl_list_remove(&xwayland_view->unmap.link); |
317 | view_destroy(&xwayland_view->view); | 314 | view_destroy(&xwayland_view->view); |
@@ -437,6 +434,19 @@ static void handle_set_window_type(struct wl_listener *listener, void *data) { | |||
437 | view_execute_criteria(view); | 434 | view_execute_criteria(view); |
438 | } | 435 | } |
439 | 436 | ||
437 | static void handle_set_hints(struct wl_listener *listener, void *data) { | ||
438 | struct sway_xwayland_view *xwayland_view = | ||
439 | wl_container_of(listener, xwayland_view, set_hints); | ||
440 | struct sway_view *view = &xwayland_view->view; | ||
441 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | ||
442 | if (!xsurface->mapped) { | ||
443 | return; | ||
444 | } | ||
445 | if (view->allow_request_urgent) { | ||
446 | view_set_urgent(view, (bool)xsurface->hints_urgency); | ||
447 | } | ||
448 | } | ||
449 | |||
440 | struct sway_view *view_from_wlr_xwayland_surface( | 450 | struct sway_view *view_from_wlr_xwayland_surface( |
441 | struct wlr_xwayland_surface *xsurface) { | 451 | struct wlr_xwayland_surface *xsurface) { |
442 | return xsurface->data; | 452 | return xsurface->data; |
@@ -489,6 +499,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { | |||
489 | &xwayland_view->set_window_type); | 499 | &xwayland_view->set_window_type); |
490 | xwayland_view->set_window_type.notify = handle_set_window_type; | 500 | xwayland_view->set_window_type.notify = handle_set_window_type; |
491 | 501 | ||
502 | wl_signal_add(&xsurface->events.set_hints, &xwayland_view->set_hints); | ||
503 | xwayland_view->set_hints.notify = handle_set_hints; | ||
504 | |||
492 | wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap); | 505 | wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap); |
493 | xwayland_view->unmap.notify = handle_unmap; | 506 | xwayland_view->unmap.notify = handle_unmap; |
494 | 507 | ||