diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 3e9fd2b70..a8955ebd8 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -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; diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 25c07c8c5..c801ad2eb 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -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( diff --git a/types/xdg_shell/wlr_xdg_shell.c b/types/xdg_shell/wlr_xdg_shell.c index 0cbadc271..7d21cb5df 100644 --- a/types/xdg_shell/wlr_xdg_shell.c +++ b/types/xdg_shell/wlr_xdg_shell.c @@ -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;