From 8944094f7164e2649a235fc699cc03b99355a0c8 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 5 Nov 2014 09:58:57 +0100 Subject: [PATCH] Allow selecting menu entries during menuHideDelay if you click again, bug 5501 --- openbox/event.c | 10 ++++++++-- openbox/menu.c | 7 +++++++ openbox/menu.h | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index be42ddbf..5774f67d 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1836,8 +1836,14 @@ static gboolean event_handle_menu_input(XEvent *ev) if ((e = menu_entry_frame_under(ev->xbutton.x_root, ev->xbutton.y_root))) { - if (ev->type == ButtonPress && e->frame->child) - menu_frame_select(e->frame->child, NULL, TRUE); + if (ev->type == ButtonPress) { + /* We know this is a new press, so we don't have to + * block release events anymore */ + menu_hide_delay_reset(); + + if (e->frame->child) + menu_frame_select(e->frame->child, NULL, TRUE); + } menu_frame_select(e->frame, e, TRUE); if (ev->type == ButtonRelease) menu_entry_frame_execute(e, ev->xbutton.state); diff --git a/openbox/menu.c b/openbox/menu.c index ae69acbb..8804e128 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -454,6 +454,7 @@ static gboolean menu_hide_delay_func(gpointer data) { menu_can_hide = TRUE; menu_timeout_id = 0; + return FALSE; /* no repeat */ } @@ -518,6 +519,12 @@ gboolean menu_hide_delay_reached(void) return menu_can_hide; } +void menu_hide_delay_reset(void) +{ + if (menu_timeout_id) g_source_remove(menu_timeout_id); + menu_hide_delay_func(NULL); +} + static ObMenuEntry* menu_entry_new(ObMenu *menu, ObMenuEntryType type, gint id) { ObMenuEntry *self; diff --git a/openbox/menu.h b/openbox/menu.h index 3f5d024a..8c2ecd77 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -185,6 +185,7 @@ void menu_show(gchar *name, const GravityPoint *pos, gint monitor, gboolean mouse, gboolean user_positioned, struct _ObClient *client); gboolean menu_hide_delay_reached(void); +void menu_hide_delay_reset(void); /*! The show function is called right after a menu is shown */ void menu_set_show_func(ObMenu *menu, ObMenuShowFunc func);