[gtk+] GtkMenuShell: Store device on GTK+ device grab.



commit c5a4bd0578f6b0f612e2f9866c645fdecdddf720
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 16 01:13:42 2010 +0200

    GtkMenuShell: Store device on GTK+ device grab.
    
    gtk_menu_shell_deactivate() needs to know the device to end the
    GTK+ grab.

 gtk/gtkmenushell.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index f4cdc46..7c62a3d 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -550,9 +550,13 @@ _gtk_menu_shell_activate (GtkMenuShell *menu_shell)
 {
   if (!menu_shell->active)
     {
-      gtk_device_grab_add (GTK_WIDGET (menu_shell),
-                           gtk_get_current_event_device (),
-                           TRUE);
+      GdkDevice *device;
+
+      device = gtk_get_current_event_device ();
+
+      _gtk_menu_shell_set_grab_device (menu_shell, device);
+      gtk_device_grab_add (GTK_WIDGET (menu_shell), device, TRUE);
+
       menu_shell->have_grab = TRUE;
       menu_shell->active = TRUE;
     }
@@ -1105,10 +1109,10 @@ gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell)
             gdk_device_ungrab (keyboard, GDK_CURRENT_TIME);
 
           menu_shell->have_xgrab = FALSE;
-          _gtk_menu_shell_set_grab_device (menu_shell, NULL);
 	}
 
       menu_shell->keyboard_mode = FALSE;
+      _gtk_menu_shell_set_grab_device (menu_shell, NULL);
 
       _gtk_menu_shell_update_mnemonics (menu_shell);
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]