From 6a59e38aeb71ad55191a20d81f9367141673c96b Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Fri, 27 May 2022 16:42:47 +0300 Subject: [PATCH] xdg-shell: schedule a configure on maximize request This commit reverts 03879290dbee26127f6867ef60bc2a7f9a6c8c5f and fc84bcb7fb0ffa29b1f9bed287762241a3473803. --- include/sway/tree/view.h | 1 + sway/desktop/xdg_shell.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 95708a04..0dcbf1aa 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -131,6 +131,7 @@ struct sway_xdg_shell_view { struct wl_listener commit; struct wl_listener request_move; struct wl_listener request_resize; + struct wl_listener request_maximize; struct wl_listener request_fullscreen; struct wl_listener set_title; struct wl_listener set_app_id; diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 16121733..8da922d5 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -325,6 +325,13 @@ static void handle_new_popup(struct wl_listener *listener, void *data) { popup_create(wlr_popup, &xdg_shell_view->view); } +static void handle_request_maximize(struct wl_listener *listener, void *data) { + struct sway_xdg_shell_view *xdg_shell_view = + wl_container_of(listener, xdg_shell_view, request_maximize); + struct wlr_xdg_toplevel *toplevel = xdg_shell_view->view.wlr_xdg_toplevel; + wlr_xdg_surface_schedule_configure(toplevel->base); +} + static void handle_request_fullscreen(struct wl_listener *listener, void *data) { struct sway_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, request_fullscreen); @@ -398,6 +405,7 @@ static void handle_unmap(struct wl_listener *listener, void *data) { wl_list_remove(&xdg_shell_view->commit.link); wl_list_remove(&xdg_shell_view->new_popup.link); + wl_list_remove(&xdg_shell_view->request_maximize.link); wl_list_remove(&xdg_shell_view->request_fullscreen.link); wl_list_remove(&xdg_shell_view->request_move.link); wl_list_remove(&xdg_shell_view->request_resize.link); @@ -446,6 +454,10 @@ static void handle_map(struct wl_listener *listener, void *data) { wl_signal_add(&toplevel->base->events.new_popup, &xdg_shell_view->new_popup); + xdg_shell_view->request_maximize.notify = handle_request_maximize; + wl_signal_add(&toplevel->events.request_maximize, + &xdg_shell_view->request_maximize); + xdg_shell_view->request_fullscreen.notify = handle_request_fullscreen; wl_signal_add(&toplevel->events.request_fullscreen, &xdg_shell_view->request_fullscreen);