mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 01:31:13 +00:00
menu: Deactivate the menu if the GdkWindow is withdrawn
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
This commit is contained in:
parent
5badf835e9
commit
7cc3eb04ec
@ -1018,6 +1018,15 @@ gtk_menu_window_event (GtkWidget *window,
|
||||
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;
|
||||
}
|
||||
|
@ -612,7 +612,8 @@ gtk_menu_shell_deactivate (GtkMenuShell *menu_shell)
|
||||
{
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user