aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar Tobias Langendorf <junglerobba@jngl.one>2020-07-18 21:26:15 +0200
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-07-22 18:50:57 -0400
commit4f718e6c75d2168d417b4b41c0e3d5408e0afded (patch)
tree6166a859d2d273ba592d0d15cebf0979fa1c4640 /sway/desktop/xwayland.c
parentswaybar: allow status line cleanup to proceed when hidden (diff)
downloadsway-4f718e6c75d2168d417b4b41c0e3d5408e0afded.tar.gz
sway-4f718e6c75d2168d417b4b41c0e3d5408e0afded.tar.zst
sway-4f718e6c75d2168d417b4b41c0e3d5408e0afded.zip
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/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c25
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) {
222 return; 222 return;
223 } 223 }
224 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; 224 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
225
226 if (activated && surface->minimized) {
227 wlr_xwayland_surface_set_minimized(surface, false);
228 }
229
225 wlr_xwayland_surface_activate(surface, activated); 230 wlr_xwayland_surface_activate(surface, activated);
226} 231}
227 232
@@ -406,6 +411,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
406 wl_list_remove(&xwayland_view->destroy.link); 411 wl_list_remove(&xwayland_view->destroy.link);
407 wl_list_remove(&xwayland_view->request_configure.link); 412 wl_list_remove(&xwayland_view->request_configure.link);
408 wl_list_remove(&xwayland_view->request_fullscreen.link); 413 wl_list_remove(&xwayland_view->request_fullscreen.link);
414 wl_list_remove(&xwayland_view->request_minimize.link);
409 wl_list_remove(&xwayland_view->request_move.link); 415 wl_list_remove(&xwayland_view->request_move.link);
410 wl_list_remove(&xwayland_view->request_resize.link); 416 wl_list_remove(&xwayland_view->request_resize.link);
411 wl_list_remove(&xwayland_view->request_activate.link); 417 wl_list_remove(&xwayland_view->request_activate.link);
@@ -508,6 +514,21 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
508 transaction_commit_dirty(); 514 transaction_commit_dirty();
509} 515}
510 516
517static void handle_request_minimize(struct wl_listener *listener, void *data) {
518 struct sway_xwayland_view *xwayland_view =
519 wl_container_of(listener, xwayland_view, request_minimize);
520 struct sway_view *view = &xwayland_view->view;
521 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
522 if (!xsurface->mapped) {
523 return;
524 }
525
526 struct wlr_xwayland_minimize_event *e = data;
527 struct sway_seat *seat = input_manager_current_seat();
528 bool focused = seat_get_focus(seat) == &view->container->node;
529 wlr_xwayland_surface_set_minimized(xsurface, !focused && e->minimize);
530}
531
511static void handle_request_move(struct wl_listener *listener, void *data) { 532static void handle_request_move(struct wl_listener *listener, void *data) {
512 struct sway_xwayland_view *xwayland_view = 533 struct sway_xwayland_view *xwayland_view =
513 wl_container_of(listener, xwayland_view, request_move); 534 wl_container_of(listener, xwayland_view, request_move);
@@ -653,6 +674,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
653 &xwayland_view->request_fullscreen); 674 &xwayland_view->request_fullscreen);
654 xwayland_view->request_fullscreen.notify = handle_request_fullscreen; 675 xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
655 676
677 wl_signal_add(&xsurface->events.request_minimize,
678 &xwayland_view->request_minimize);
679 xwayland_view->request_minimize.notify = handle_request_minimize;
680
656 wl_signal_add(&xsurface->events.request_activate, 681 wl_signal_add(&xsurface->events.request_activate,
657 &xwayland_view->request_activate); 682 &xwayland_view->request_activate);
658 xwayland_view->request_activate.notify = handle_request_activate; 683 xwayland_view->request_activate.notify = handle_request_activate;