can be caused by *<margin>* settings or exclusive layer-shell clients
such as panels.
+## MENU
+
+```
+<menu>
+ <ignoreButtonReleasePeriod>250</ignoreButtonReleasePeriod>
+</menu>
+```
+
+*<menu><ignoreButtonReleasePeriod>*
+ How long (in milliseconds) the initial button release event is ignored
+ for. The reason for this logic and behaviour is to avoid a fast
+ press-move-release sequence indended to just open the menu resulting in
+ the closure of the menu or the selection of (typically the first) menu
+ item. This behaviour only affects the first button-release. It is not
+ anticipated that most users will want to change this, but the config
+ option has been exposed for unusual use-cases. It is equivalent to
+ Openbox's `<hideDelay>`. Default is 250 ms.
+
## ENVIRONMENT VARIABLES
*XCURSOR_THEME* and *XCURSOR_SIZE* are supported to set cursor theme
} else {
wlr_log(WLR_ERROR, "Missing 'button' argument for tablet button mapping");
}
+ } else if (!strcasecmp(nodename, "ignoreButtonReleasePeriod.menu")) {
+ rc.menu_ignore_button_release_period = atoi(content);
}
}
rc.workspace_config.popuptime = INT_MIN;
rc.workspace_config.min_nr_workspaces = 1;
+
+ rc.menu_ignore_button_release_period = 250;
}
static void
return consumed_by_frame_context;
}
+static uint32_t press_msec;
+
static void
cursor_button_press(struct seat *seat, uint32_t button,
enum wlr_button_state button_state, uint32_t time_msec)
struct server *server = seat->server;
struct cursor_context ctx = get_cursor_context(server);
+ /* Used on next button release to check if it can close menu or select menu item */
+ press_msec = time_msec;
+
/* Determine closest resize edges in case action is Resize */
uint32_t resize_edges = cursor_get_resize_edges(seat->cursor, &ctx);
}
if (server->input_mode == LAB_INPUT_STATE_MENU) {
+ /*
+ * If menu was already opened on press, set a very small value
+ * so subsequent release always closes menu or selects menu item.
+ */
+ press_msec = 0;
return;
}
seat_reset_pressed(seat);
if (server->input_mode == LAB_INPUT_STATE_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);
+ /* TODO: take into account overflow of time_msec */
+ if (time_msec - press_msec > rc.menu_ignore_button_release_period) {
+ 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;
}