[gtk+/client-side-windows: 212/284] Report the steady state in gdk_display_pointer_is_grabbed



commit 025b6aa741ebdb07986dc9afb9190496c8bbbd80
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Feb 2 15:37:02 2009 +0100

    Report the steady state in gdk_display_pointer_is_grabbed
    
    For instance if we grab the pointer and then check if its grabbed
    so that we know to ungrab we don't care that the grab is not
    yet active, so report the steady state (i.e. the last grab)
---
 gdk/gdkdisplay.c |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 74f08fc..d3cb845 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -750,24 +750,6 @@ generate_grab_broken_event (GdkWindow *window,
     }
 }
 
-/* Get the pointer grab in effects for events we just sent */
-GdkPointerGrabInfo *
-_gdk_display_get_active_pointer_grab (GdkDisplay *display)
-{
-  GdkPointerGrabInfo *info;
-
-  if (display->pointer_grabs == NULL)
-    return NULL;
-
-  info = display->pointer_grabs->data;
-
-  if (info->activated)
-    return info;
-  
-  return NULL;
-}
-
-
 GdkPointerGrabInfo *
 _gdk_display_get_last_pointer_grab (GdkDisplay *display)
 {
@@ -1266,7 +1248,10 @@ gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
   
   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
 
-  info = _gdk_display_get_active_pointer_grab (display);
+  /* What we're interested in is the steady state (ie last grab),
+     because we're interested e.g. if we grabbed so that we
+     can ungrab, even if our grab is not active just yet. */
+  info = _gdk_display_get_last_pointer_grab (display);
   
   if (info)
     {
@@ -1299,7 +1284,10 @@ gdk_display_pointer_is_grabbed (GdkDisplay *display)
   
   g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
 
-  info = _gdk_display_get_active_pointer_grab (display);
+  /* What we're interested in is the steady state (ie last grab),
+     because we're interested e.g. if we grabbed so that we
+     can ungrab, even if our grab is not active just yet. */
+  info = _gdk_display_get_last_pointer_grab (display);
   
   return (info && !info->implicit);
 }



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