mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-16 08:21:40 -04:00
Add grab to wlr_xdg_popup.events
...so that compositors can give keyboard focus to unfocused layer-shell clients on popup grab. A use case is to give xfce4-panel and lxqt-panel keyboard focus when their respective menus are opened via IPC mechanisms (xfce4-panel-applicationmenu and lxqt-qdbus-openmenu respectively).
This commit is contained in:
parent
436bcf9a47
commit
6a7d78bb54
2 changed files with 5 additions and 0 deletions
|
|
@ -108,6 +108,7 @@ struct wlr_xdg_popup {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
|
|
||||||
struct wl_signal reposition;
|
struct wl_signal reposition;
|
||||||
|
struct wl_signal grab;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
struct wl_list grab_link; // wlr_xdg_popup_grab.popups
|
struct wl_list grab_link; // wlr_xdg_popup_grab.popups
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,8 @@ static void xdg_popup_handle_grab(struct wl_client *client,
|
||||||
&popup_grab->keyboard_grab);
|
&popup_grab->keyboard_grab);
|
||||||
wlr_seat_touch_start_grab(seat_client->seat,
|
wlr_seat_touch_start_grab(seat_client->seat,
|
||||||
&popup_grab->touch_grab);
|
&popup_grab->touch_grab);
|
||||||
|
|
||||||
|
wl_signal_emit_mutable(&popup->events.grab, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_popup_handle_reposition(
|
static void xdg_popup_handle_reposition(
|
||||||
|
|
@ -416,6 +418,7 @@ void create_xdg_popup(struct wlr_xdg_surface *surface, struct wlr_xdg_surface *p
|
||||||
|
|
||||||
wl_signal_init(&surface->popup->events.destroy);
|
wl_signal_init(&surface->popup->events.destroy);
|
||||||
wl_signal_init(&surface->popup->events.reposition);
|
wl_signal_init(&surface->popup->events.reposition);
|
||||||
|
wl_signal_init(&surface->popup->events.grab);
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
surface->popup->parent = parent->surface;
|
surface->popup->parent = parent->surface;
|
||||||
|
|
@ -475,6 +478,7 @@ void destroy_xdg_popup(struct wlr_xdg_popup *popup) {
|
||||||
|
|
||||||
assert(wl_list_empty(&popup->events.destroy.listener_list));
|
assert(wl_list_empty(&popup->events.destroy.listener_list));
|
||||||
assert(wl_list_empty(&popup->events.reposition.listener_list));
|
assert(wl_list_empty(&popup->events.reposition.listener_list));
|
||||||
|
assert(wl_list_empty(&popup->events.grab.listener_list));
|
||||||
|
|
||||||
wlr_surface_synced_finish(&popup->synced);
|
wlr_surface_synced_finish(&popup->synced);
|
||||||
popup->base->popup = NULL;
|
popup->base->popup = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue