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)
This commit is contained in:
Alexander Larsson 2009-02-02 15:37:02 +01:00 committed by Alexander Larsson
parent 5be3f38535
commit 025b6aa741

View File

@ -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);
}