diff options
author | Tobias Langendorf <junglerobba@jngl.one> | 2020-07-18 21:26:15 +0200 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-07-22 18:50:57 -0400 |
commit | 4f718e6c75d2168d417b4b41c0e3d5408e0afded (patch) | |
tree | 6166a859d2d273ba592d0d15cebf0979fa1c4640 /sway | |
parent | 66b7ac6a82ccf62e6408443f66c6a370a314ebaa (diff) | |
download | sway-4f718e6c75d2168d417b4b41c0e3d5408e0afded.tar.xz |
Fix X11 clients getting stuck minimized
Usually it should be enough to simply not grant a client's
minimize request, however some applications (Steam, fullscreen
games in Wine) don't wait for the compositor and minimize anyway,
getting them stuck in an unrecoverable state.
Restoring them immediately lead to heavy flickering when unfocused
on my test application (Earth Defense Force 5 via Steam), so it's
preferable to grant their request without actually minimizing and
then restoring them once they are in focus again.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/xwayland.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index c972fd3a..db21dc78 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -222,6 +222,11 @@ static void set_activated(struct sway_view *view, bool activated) { return; } struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; + + if (activated && surface->minimized) { + wlr_xwayland_surface_set_minimized(surface, false); + } + wlr_xwayland_surface_activate(surface, activated); } @@ -406,6 +411,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { wl_list_remove(&xwayland_view->destroy.link); wl_list_remove(&xwayland_view->request_configure.link); wl_list_remove(&xwayland_view->request_fullscreen.link); + wl_list_remove(&xwayland_view->request_minimize.link); wl_list_remove(&xwayland_view->request_move.link); wl_list_remove(&xwayland_view->request_resize.link); wl_list_remove(&xwayland_view->request_activate.link); @@ -508,6 +514,21 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) transaction_commit_dirty(); } +static void handle_request_minimize(struct wl_listener *listener, void *data) { + struct sway_xwayland_view *xwayland_view = + wl_container_of(listener, xwayland_view, request_minimize); + struct sway_view *view = &xwayland_view->view; + struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; + if (!xsurface->mapped) { + return; + } + + struct wlr_xwayland_minimize_event *e = data; + struct sway_seat *seat = input_manager_current_seat(); + bool focused = seat_get_focus(seat) == &view->container->node; + wlr_xwayland_surface_set_minimized(xsurface, !focused && e->minimize); +} + static void handle_request_move(struct wl_listener *listener, void *data) { struct sway_xwayland_view *xwayland_view = wl_container_of(listener, xwayland_view, request_move); @@ -653,6 +674,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { &xwayland_view->request_fullscreen); xwayland_view->request_fullscreen.notify = handle_request_fullscreen; + wl_signal_add(&xsurface->events.request_minimize, + &xwayland_view->request_minimize); + xwayland_view->request_minimize.notify = handle_request_minimize; + wl_signal_add(&xsurface->events.request_activate, &xwayland_view->request_activate); xwayland_view->request_activate.notify = handle_request_activate; |