If the display server or GDK hides the window - fire the "deactivate" signal
to ensure that the internal state is consistent.
This patch also ensures that the "deactivate" signal will not be fired for a
menu that is not active.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=670881
case GDK_KEY_RELEASE:
handled = gtk_widget_event (menu, event);
break;
+ case GDK_WINDOW_STATE:
+ /* Window for the menu has been closed by the display server or by GDK.
+ * Update the internal state as if the user had clicked outside the
+ * menu
+ */
+ if (event->window_state.new_window_state & GDK_WINDOW_STATE_WITHDRAWN &&
+ event->window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN)
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL(menu));
+ break;
default:
break;
}
{
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
- g_signal_emit (menu_shell, menu_shell_signals[DEACTIVATE], 0);
+ if (menu_shell->priv->active)
+ g_signal_emit (menu_shell, menu_shell_signals[DEACTIVATE], 0);
}
static void