From 992e5add42ddc126b7872c53b88fc3bff47fed3f Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 28 Apr 2018 08:17:58 +0900 Subject: wayland renderer: Implement grab_keyboard This avoids locking oneself out when running bemenu interactively, as input would be grabbed too early without that and layer shell does not allow to 'ungrab' focus by clicking on another window --- lib/renderers/wayland/wayland.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/renderers/wayland/wayland.c') diff --git a/lib/renderers/wayland/wayland.c b/lib/renderers/wayland/wayland.c index 5309280..dd97009 100644 --- a/lib/renderers/wayland/wayland.c +++ b/lib/renderers/wayland/wayland.c @@ -189,6 +189,18 @@ set_bottom(const struct bm_menu *menu, bool bottom) } } +static void +grab_keyboard(const struct bm_menu *menu, bool grab) +{ + struct wayland *wayland = menu->renderer->internal; + assert(wayland); + + struct window *window; + wl_list_for_each(window, &wayland->windows, link) { + bm_wl_window_grab_keyboard(window, wayland->display, grab); + } +} + static void destructor(struct bm_menu *menu) { @@ -282,6 +294,7 @@ register_renderer(struct render_api *api) api->poll_key = poll_key; api->render = render; api->set_bottom = set_bottom; + api->grab_keyboard = grab_keyboard; api->priorty = BM_PRIO_GUI; api->version = BM_PLUGIN_VERSION; return "wayland"; -- cgit v1.2.3-70-g09d2