aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2024-02-27 15:04:31 +0100
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2024-03-08 09:52:14 +0300
commit4e6d7612ffbd8e29713ae063937c8460e091bb75 (patch)
treea2c5a82dd201cd352e66d9a396617d3a6ce04c83 /sway
parentFetch input device vendor/product from libinput (diff)
downloadsway-4e6d7612ffbd8e29713ae063937c8460e091bb75.tar.gz
sway-4e6d7612ffbd8e29713ae063937c8460e091bb75.tar.zst
sway-4e6d7612ffbd8e29713ae063937c8460e091bb75.zip
xdg-shell: implement popup repositioning
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/xdg_shell.c8
-rw-r--r--sway/server.c2
2 files changed, 9 insertions, 1 deletions
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) {
35 wl_list_remove(&popup->new_popup.link); 35 wl_list_remove(&popup->new_popup.link);
36 wl_list_remove(&popup->destroy.link); 36 wl_list_remove(&popup->destroy.link);
37 wl_list_remove(&popup->surface_commit.link); 37 wl_list_remove(&popup->surface_commit.link);
38 wl_list_remove(&popup->reposition.link);
38 wlr_scene_node_destroy(&popup->scene_tree->node); 39 wlr_scene_node_destroy(&popup->scene_tree->node);
39 free(popup); 40 free(popup);
40} 41}
@@ -70,6 +71,11 @@ static void popup_handle_surface_commit(struct wl_listener *listener, void *data
70 } 71 }
71} 72}
72 73
74static void popup_handle_reposition(struct wl_listener *listener, void *data) {
75 struct sway_xdg_popup *popup = wl_container_of(listener, popup, reposition);
76 popup_unconstrain(popup);
77}
78
73static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup, 79static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup,
74 struct sway_view *view, struct wlr_scene_tree *parent) { 80 struct sway_view *view, struct wlr_scene_tree *parent) {
75 struct wlr_xdg_surface *xdg_surface = wlr_popup->base; 81 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,
116 popup->surface_commit.notify = popup_handle_surface_commit; 122 popup->surface_commit.notify = popup_handle_surface_commit;
117 wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup); 123 wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup);
118 popup->new_popup.notify = popup_handle_new_popup; 124 popup->new_popup.notify = popup_handle_new_popup;
125 wl_signal_add(&wlr_popup->events.reposition, &popup->reposition);
126 popup->reposition.notify = popup_handle_reposition;
119 wl_signal_add(&wlr_popup->events.destroy, &popup->destroy); 127 wl_signal_add(&wlr_popup->events.destroy, &popup->destroy);
120 popup->destroy.notify = popup_handle_destroy; 128 popup->destroy.notify = popup_handle_destroy;
121 129
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 @@
65#include <wlr/types/wlr_drm_lease_v1.h> 65#include <wlr/types/wlr_drm_lease_v1.h>
66#endif 66#endif
67 67
68#define SWAY_XDG_SHELL_VERSION 2 68#define SWAY_XDG_SHELL_VERSION 3
69#define SWAY_LAYER_SHELL_VERSION 4 69#define SWAY_LAYER_SHELL_VERSION 4
70#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1 70#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1
71 71