diff options
author | Richard Hult <richard@imendio.com> | 2007-06-03 18:48:47 +0000 |
---|---|---|
committer | Richard Hult <rhult@src.gnome.org> | 2007-06-03 18:48:47 +0000 |
commit | 975e7683b8338070e7d08e5e172b48b60d6655e7 (patch) | |
tree | 35e5f6b82b938c082524e0c737936f7569947d02 /gdk | |
parent | 3927b5ceae9e2b53bf18b938fe22a463870a9e7a (diff) | |
download | gtk+-975e7683b8338070e7d08e5e172b48b60d6655e7.tar.gz |
Make pointer grab emulation work a bit better:
2007-06-03 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkevents-quartz.c: Make pointer grab emulation work a bit
better:
(gdk_display_pointer_is_grabbed): Do what the docs say and don't
consider implicit grabs here.
(gdk_pointer_grab): Overriding a grab by the same app should always be
succesful.
(gdk_event_translate): Implicit grabs should not be owner events.
svn path=/trunk/; revision=18016
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/quartz/gdkevents-quartz.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c index a66dd709a9..dbc42f947e 100644 --- a/gdk/quartz/gdkevents-quartz.c +++ b/gdk/quartz/gdkevents-quartz.c @@ -183,7 +183,8 @@ pointer_ungrab_internal (gboolean only_if_implicit) gboolean gdk_display_pointer_is_grabbed (GdkDisplay *display) { - return _gdk_quartz_pointer_grab_window != NULL; + return (_gdk_quartz_pointer_grab_window != NULL && + !pointer_grab_implicit); } gboolean @@ -241,15 +242,11 @@ gdk_pointer_grab (GdkWindow *window, if (_gdk_quartz_pointer_grab_window) { - if (_gdk_quartz_pointer_grab_window == window && !pointer_grab_implicit) - return GDK_GRAB_ALREADY_GRABBED; - else - { - if (_gdk_quartz_pointer_grab_window != window) - generate_grab_broken_event (_gdk_quartz_pointer_grab_window, - FALSE, pointer_grab_implicit, window); - pointer_ungrab_internal (TRUE); - } + if (_gdk_quartz_pointer_grab_window != window) + generate_grab_broken_event (_gdk_quartz_pointer_grab_window, + FALSE, pointer_grab_implicit, window); + + pointer_ungrab_internal (FALSE); } return pointer_grab_internal (window, owner_events, event_mask, @@ -1428,14 +1425,13 @@ gdk_event_translate (NSEvent *nsevent) GdkEventMask event_mask; /* Emulate implicit grab, when the window has both PRESS and RELEASE - * in its mask, like X (and make it owner_events since that's what - * implicit grabs are like). + * in its mask, like X. */ event_mask = (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); if (!_gdk_quartz_pointer_grab_window && (GDK_WINDOW_OBJECT (window)->event_mask & event_mask) == event_mask) { - pointer_grab_internal (window, TRUE, + pointer_grab_internal (window, FALSE, GDK_WINDOW_OBJECT (window)->event_mask, NULL, NULL, TRUE); } |