mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 06:24:20 +01:00
xdg-shell: implement popup repositioning
This commit is contained in:
parent
f2a0e81b24
commit
4e6d7612ff
@ -192,6 +192,7 @@ struct sway_xdg_popup {
|
|||||||
|
|
||||||
struct wl_listener surface_commit;
|
struct wl_listener surface_commit;
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
|
struct wl_listener reposition;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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->new_popup.link);
|
||||||
wl_list_remove(&popup->destroy.link);
|
wl_list_remove(&popup->destroy.link);
|
||||||
wl_list_remove(&popup->surface_commit.link);
|
wl_list_remove(&popup->surface_commit.link);
|
||||||
|
wl_list_remove(&popup->reposition.link);
|
||||||
wlr_scene_node_destroy(&popup->scene_tree->node);
|
wlr_scene_node_destroy(&popup->scene_tree->node);
|
||||||
free(popup);
|
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,
|
static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup,
|
||||||
struct sway_view *view, struct wlr_scene_tree *parent) {
|
struct sway_view *view, struct wlr_scene_tree *parent) {
|
||||||
struct wlr_xdg_surface *xdg_surface = wlr_popup->base;
|
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;
|
popup->surface_commit.notify = popup_handle_surface_commit;
|
||||||
wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup);
|
wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup);
|
||||||
popup->new_popup.notify = popup_handle_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);
|
wl_signal_add(&wlr_popup->events.destroy, &popup->destroy);
|
||||||
popup->destroy.notify = popup_handle_destroy;
|
popup->destroy.notify = popup_handle_destroy;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SWAY_XDG_SHELL_VERSION 2
|
#define SWAY_XDG_SHELL_VERSION 3
|
||||||
#define SWAY_LAYER_SHELL_VERSION 4
|
#define SWAY_LAYER_SHELL_VERSION 4
|
||||||
#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1
|
#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user