diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2015-02-20 13:33:09 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2015-02-20 14:44:17 +0100 |
commit | fa48b42ef1b1e43b1728d0fea51f68e760dd37b0 (patch) | |
tree | 6bd3dac23248a3f16d0e27769312a0b38c75e5a1 | |
parent | 85ad434290bc92ecdd92eb86b997bf103b658f1d (diff) | |
download | gtk+-fa48b42ef1b1e43b1728d0fea51f68e760dd37b0.tar.gz |
menubutton: Fix possible button/popover state inconsistences
While a popover is hiding, the modal grab is already gone and the toggle
button is clickable again, but clicking again at that time will result in
gtk_widget_show() trying to show an already shown widget (although fading
out and hidden soon) and the toggle button activated.
So let the menubutton set the active status only if the menu/popover
widget wasn't already shown, and ensure this doesn't get triggered by
double/triple button press events.
-rw-r--r-- | gtk/gtkmenubutton.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c index 422c07fb99..de06bf1a2e 100644 --- a/gtk/gtkmenubutton.c +++ b/gtk/gtkmenubutton.c @@ -442,10 +442,16 @@ gtk_menu_button_button_press_event (GtkWidget *widget, if (event->button == GDK_BUTTON_PRIMARY) { - if (priv->menu) + /* Filter out double/triple clicks */ + if (event->type != GDK_BUTTON_PRESS) + return TRUE; + + if (priv->menu && !gtk_widget_get_visible (priv->menu)) popup_menu (menu_button, event); - else if (priv->popover) + else if (priv->popover && !gtk_widget_get_visible (priv->popover)) gtk_widget_show (priv->popover); + else + return TRUE; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); |