xdg-shell: introduce popup_grab event

This commit is contained in:
Kirill Primak 2025-01-12 13:33:51 +03:00
parent dc6e09ffb6
commit 42dc9fbee2
3 changed files with 17 additions and 0 deletions

View file

@ -26,6 +26,7 @@ struct wlr_xdg_shell {
struct wl_signal new_surface; // struct wlr_xdg_surface
struct wl_signal new_toplevel; // struct wlr_xdg_toplevel
struct wl_signal new_popup; // struct wlr_xdg_popup
struct wl_signal popup_grab; // struct wlr_xdg_shell_popup_grab_event
struct wl_signal destroy;
} events;
@ -36,6 +37,12 @@ struct wlr_xdg_shell {
} WLR_PRIVATE;
};
struct wlr_xdg_shell_popup_grab_event {
struct wlr_xdg_popup *popup;
struct wlr_seat_client *seat_client;
uint32_t serial;
};
struct wlr_xdg_client {
struct wlr_xdg_shell *shell;
struct wl_resource *resource;

View file

@ -306,6 +306,14 @@ static void xdg_popup_handle_grab(struct wl_client *client,
&popup_grab->keyboard_grab);
wlr_seat_touch_start_grab(seat_client->seat,
&popup_grab->touch_grab);
struct wlr_xdg_shell_popup_grab_event event = {
.popup = popup,
.seat_client = seat_client,
.serial = serial,
};
wl_signal_emit_mutable(&popup->base->client->shell->events.popup_grab, &event);
}
static void xdg_popup_handle_reposition(

View file

@ -133,6 +133,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
assert(wl_list_empty(&xdg_shell->events.new_surface.listener_list));
assert(wl_list_empty(&xdg_shell->events.new_toplevel.listener_list));
assert(wl_list_empty(&xdg_shell->events.new_popup.listener_list));
assert(wl_list_empty(&xdg_shell->events.popup_grab.listener_list));
assert(wl_list_empty(&xdg_shell->events.destroy.listener_list));
wl_list_remove(&xdg_shell->display_destroy.link);
@ -166,6 +167,7 @@ struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display,
wl_signal_init(&xdg_shell->events.new_surface);
wl_signal_init(&xdg_shell->events.new_toplevel);
wl_signal_init(&xdg_shell->events.new_popup);
wl_signal_init(&xdg_shell->events.popup_grab);
wl_signal_init(&xdg_shell->events.destroy);
xdg_shell->display_destroy.notify = handle_display_destroy;