Break out into a separate function.

2007-06-16  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.c (gdk_event_translate) 
	(break_all_grabs): Break out into a separate function.

svn path=/trunk/; revision=18160
This commit is contained in:
Richard Hult 2007-06-16 15:43:23 +00:00 committed by Richard Hult
parent 48a45ff672
commit 4fd1fb4d9b
2 changed files with 31 additions and 18 deletions

View File

@ -1,3 +1,8 @@
2007-06-16 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkevents-quartz.c (gdk_event_translate)
(break_all_grabs): Break out into a separate function.
2007-06-16 Richard Hult <richard@imendio.com> 2007-06-16 Richard Hult <richard@imendio.com>
* gdk/quartz/GdkQuartzWindow.c: (isInMove): Implement, to be used * gdk/quartz/GdkQuartzWindow.c: (isInMove): Implement, to be used

View File

@ -253,6 +253,31 @@ gdk_pointer_grab (GdkWindow *window,
confine_to, cursor, FALSE); confine_to, cursor, FALSE);
} }
/* This is used to break any grabs in the case where we have to due to
* the grab emulation. Instead of enforcing the desktop wide grab, we
* break it when the app loses focus for example.
*/
static void
break_all_grabs (void)
{
if (_gdk_quartz_keyboard_grab_window)
{
generate_grab_broken_event (_gdk_quartz_keyboard_grab_window,
TRUE, FALSE,
NULL);
g_object_unref (_gdk_quartz_keyboard_grab_window);
_gdk_quartz_keyboard_grab_window = NULL;
}
if (_gdk_quartz_pointer_grab_window)
{
generate_grab_broken_event (_gdk_quartz_pointer_grab_window,
FALSE, pointer_grab_implicit,
NULL);
pointer_ungrab_internal (FALSE);
}
}
static void static void
fixup_event (GdkEvent *event) fixup_event (GdkEvent *event)
{ {
@ -1481,24 +1506,7 @@ gdk_event_translate (NSEvent *nsevent)
if ([nsevent type] == NSAppKitDefined) if ([nsevent type] == NSAppKitDefined)
{ {
if ([nsevent subtype] == NSApplicationDeactivatedEventType) if ([nsevent subtype] == NSApplicationDeactivatedEventType)
{ break_all_grabs ();
if (_gdk_quartz_keyboard_grab_window)
{
generate_grab_broken_event (_gdk_quartz_keyboard_grab_window,
TRUE, FALSE,
NULL);
g_object_unref (_gdk_quartz_keyboard_grab_window);
_gdk_quartz_keyboard_grab_window = NULL;
}
if (_gdk_quartz_pointer_grab_window)
{
generate_grab_broken_event (_gdk_quartz_pointer_grab_window,
FALSE, pointer_grab_implicit,
NULL);
pointer_ungrab_internal (FALSE);
}
}
} }
window = find_window_for_ns_event (nsevent, &x, &y); window = find_window_for_ns_event (nsevent, &x, &y);