}
if (server->input_mode == LAB_INPUT_STATE_MENU) {
- /* We are closing the menu on RELEASE to not leak a stray release */
- if (ctx.type != LAB_SSD_MENU) {
- close_menu = true;
- } else if (menu_call_actions(ctx.node)) {
- /* Action was successful, may fail if item just opens a submenu */
- close_menu = true;
- }
+ /*
+ * We close the menu on RELEASE to not leak a stray releases and
+ * to be consistent with Openbox
+ */
+ close_menu = true;
return;
}
if (server->input_mode == LAB_INPUT_STATE_MENU) {
if (close_menu) {
- menu_close_root(server);
- cursor_update_common(server, &ctx, time_msec,
- /*cursor_has_moved*/ false);
+ if (ctx.type == LAB_SSD_MENU) {
+ menu_call_selected_actions(server);
+ } else {
+ menu_close_root(server);
+ cursor_update_common(server, &ctx, time_msec,
+ /*cursor_has_moved*/ false);
+ }
close_menu = false;
}
return;
menu_submenu_leave(server);
break;
case XKB_KEY_Return:
- if (menu_call_selected_actions(server)) {
- menu_close_root(server);
- cursor_update_focus(server);
- }
+ menu_call_selected_actions(server);
break;
case XKB_KEY_Escape:
menu_close_root(server);
return false;
}
- actions_run(item->parent->triggered_by_view,
- item->parent->server, &item->actions, 0);
-
/*
* We close the menu here to provide a faster feedback to the user.
* We do that without resetting the input state so src/cursor.c
menu_close(item->parent->server->menu_current);
item->parent->server->menu_current = NULL;
+ struct server *server = item->parent->server;
+ menu_close_root(server);
+ cursor_update_focus(server);
+
+ /*
+ * We call the actions after menu_close_root() so that virtual keyboard
+ * input is sent to the focused_surface instead of being absorbed by the
+ * menu. Consider for example: `wlrctl keyboard type abc`
+ */
+ actions_run(item->parent->triggered_by_view, server, &item->actions, 0);
+
return true;
}