From: tokyo4j Date: Wed, 24 Apr 2024 09:46:30 +0000 (+0900) Subject: cursor: do action/close menu in successive press & release X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=1d3ed457;p=proto%2Flabwc.git cursor: do action/close menu in successive press & release In OpenBox, when cursor button is pressed to open menu, a subsequent cursor button release can perform actions or close the menu. This commit makes labwc follow that behavior. Fixes: #1750 --- diff --git a/src/input/cursor.c b/src/input/cursor.c index 7d3a8733..df03dcf2 100644 --- a/src/input/cursor.c +++ b/src/input/cursor.c @@ -929,9 +929,6 @@ handle_press_mousebinding(struct server *server, struct cursor_context *ctx, return consumed_by_frame_context; } -/* Set in cursor_button_press(), used in cursor_button_release() */ -static bool close_menu; - static void cursor_button_press(struct seat *seat, uint32_t button, enum wlr_button_state button_state, uint32_t time_msec) @@ -949,11 +946,6 @@ cursor_button_press(struct seat *seat, uint32_t button, } if (server->input_mode == LAB_INPUT_STATE_MENU) { - /* - * We close the menu on RELEASE to not leak a stray releases and - * to be consistent with Openbox - */ - close_menu = true; return; } @@ -1019,15 +1011,12 @@ cursor_button_release(struct seat *seat, uint32_t button, seat_reset_pressed(seat); if (server->input_mode == LAB_INPUT_STATE_MENU) { - if (close_menu) { - 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; + 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); } return; }