diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2024-02-27 15:04:31 +0100 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2024-02-27 15:04:31 +0100 |
| commit | ce011981471978f0d038ca8a780e29ff915937f0 (patch) | |
| tree | a2c5a82dd201cd352e66d9a396617d3a6ce04c83 | |
| parent | e0607936fb19825145696a2452e9141f37b3ee53 (diff) | |
xdg-shell: implement popup repositioning
| -rw-r--r-- | include/sway/tree/view.h | 1 | ||||
| -rw-r--r-- | sway/desktop/xdg_shell.c | 8 | ||||
| -rw-r--r-- | sway/server.c | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index ef1a26b8..7faacdcc 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -192,6 +192,7 @@ struct sway_xdg_popup { struct wl_listener surface_commit; struct wl_listener new_popup; + struct wl_listener reposition; struct wl_listener destroy; }; diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 27a73f8a..47ab902e 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -35,6 +35,7 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) { wl_list_remove(&popup->new_popup.link); wl_list_remove(&popup->destroy.link); wl_list_remove(&popup->surface_commit.link); + wl_list_remove(&popup->reposition.link); wlr_scene_node_destroy(&popup->scene_tree->node); free(popup); } @@ -70,6 +71,11 @@ static void popup_handle_surface_commit(struct wl_listener *listener, void *data } } +static void popup_handle_reposition(struct wl_listener *listener, void *data) { + struct sway_xdg_popup *popup = wl_container_of(listener, popup, reposition); + popup_unconstrain(popup); +} + static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup, struct sway_view *view, struct wlr_scene_tree *parent) { struct wlr_xdg_surface *xdg_surface = wlr_popup->base; @@ -116,6 +122,8 @@ static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup, popup->surface_commit.notify = popup_handle_surface_commit; wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup); popup->new_popup.notify = popup_handle_new_popup; + wl_signal_add(&wlr_popup->events.reposition, &popup->reposition); + popup->reposition.notify = popup_handle_reposition; wl_signal_add(&wlr_popup->events.destroy, &popup->destroy); popup->destroy.notify = popup_handle_destroy; diff --git a/sway/server.c b/sway/server.c index 684b1dbd..cb8bdbf9 100644 --- a/sway/server.c +++ b/sway/server.c @@ -65,7 +65,7 @@ #include <wlr/types/wlr_drm_lease_v1.h> #endif -#define SWAY_XDG_SHELL_VERSION 2 +#define SWAY_XDG_SHELL_VERSION 3 #define SWAY_LAYER_SHELL_VERSION 4 #define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1 |
