aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/tree/view.h1
-rw-r--r--sway/desktop/xwayland.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 665c516f..a32f5907 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -147,6 +147,7 @@ struct sway_xwayland_view {
147 struct wl_listener request_move; 147 struct wl_listener request_move;
148 struct wl_listener request_resize; 148 struct wl_listener request_resize;
149 struct wl_listener request_maximize; 149 struct wl_listener request_maximize;
150 struct wl_listener request_minimize;
150 struct wl_listener request_configure; 151 struct wl_listener request_configure;
151 struct wl_listener request_fullscreen; 152 struct wl_listener request_fullscreen;
152 struct wl_listener request_activate; 153 struct wl_listener request_activate;
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;