gtk+ r20100 - in trunk: . gdk/quartz
- From: rhult svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r20100 - in trunk: . gdk/quartz
- Date: Mon, 12 May 2008 12:23:28 +0100 (BST)
Author: rhult
Date: Mon May 12 11:23:28 2008
New Revision: 20100
URL: http://svn.gnome.org/viewvc/gtk+?rev=20100&view=rev
Log:
2008-05-12 Richard Hult <richard imendio com>
* gdk/quartz/gdkevents-quartz.c:
* gdk/quartz/gdkquartz.h: Remove special casing of menu key events
as it's no longer necessary; instead the added quartz API to get
the nsevent from an event should be used. Also move the global
filter up so it's done before the check for window-less events.
Modified:
trunk/ChangeLog
trunk/gdk/quartz/gdkevents-quartz.c
Modified: trunk/gdk/quartz/gdkevents-quartz.c
==============================================================================
--- trunk/gdk/quartz/gdkevents-quartz.c (original)
+++ trunk/gdk/quartz/gdkevents-quartz.c Mon May 12 11:23:28 2008
@@ -2,7 +2,7 @@
*
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright (C) 1998-2002 Tor Lillqvist
- * Copyright (C) 2005-2007 Imendio AB
+ * Copyright (C) 2005-2008 Imendio AB
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -105,17 +105,12 @@
return buf;
}
-/* A category that exposes the protected carbon event for an NSEvent. */
- interface NSEvent (GdkQuartzNSEvent)
-- (void *)gdk_quartz_event_ref;
- end
-
- implementation NSEvent (GdkQuartzNSEvent)
-- (void *)gdk_quartz_event_ref
+NSEvent *
+gdk_quartz_event_get_nsevent (GdkEvent *event)
{
- return _eventRef;
+ /* FIXME: If the event here is unallocated, we crash. */
+ return ((GdkEventPrivate *) event)->windowing_data;
}
- end
void
_gdk_events_init (void)
@@ -1697,46 +1692,6 @@
*/
}
- /* Special-case menu shortcut events. We create command events for
- * those and forward to the corresponding menu.
- */
- if ((!_gdk_quartz_keyboard_grab_window ||
- (_gdk_quartz_keyboard_grab_window && keyboard_grab_owner_events)) &&
- [nsevent type] == NSKeyDown)
- {
- EventRef event_ref;
- MenuRef menu_ref;
- MenuItemIndex index;
-
- event_ref = [nsevent gdk_quartz_event_ref];
- if (IsMenuKeyEvent (NULL, event_ref,
- kMenuEventQueryOnly,
- &menu_ref, &index))
- {
- MenuCommand menu_command;
- HICommand hi_command;
-
- if (GetMenuItemCommandID (menu_ref, index, &menu_command) != noErr)
- return FALSE;
-
- hi_command.commandID = menu_command;
- hi_command.menu.menuRef = menu_ref;
- hi_command.menu.menuItemIndex = index;
-
- CreateEvent (NULL, kEventClassCommand, kEventCommandProcess,
- 0, kEventAttributeUserEvent, &event_ref);
- SetEventParameter (event_ref, kEventParamDirectObject,
- typeHICommand,
- sizeof (HICommand), &hi_command);
-
- SendEventToEventTarget (event_ref, GetMenuEventTarget (menu_ref));
-
- ReleaseEvent (event_ref);
-
- return TRUE;
- }
- }
-
/* Handle our generated "fake" crossing events. */
if ([nsevent type] == NSApplicationDefined &&
[nsevent subtype] == GDK_QUARTZ_EVENT_SUBTYPE_FAKE_CROSSING)
@@ -1766,6 +1721,19 @@
nswindow = [nsevent window];
+ /* Apply any global filters. */
+ if (_gdk_default_filters)
+ {
+ result = apply_filters (NULL, nsevent, _gdk_default_filters);
+
+ /* If result is GDK_FILTER_CONTINUE, we continue as if nothing
+ * happened. If it is GDK_FILTER_REMOVE,
+ * we return TRUE and won't send the message to Quartz.
+ */
+ if (result == GDK_FILTER_REMOVE)
+ return TRUE;
+ }
+
/* Ignore events for no window or ones not created by GDK. */
if (!nswindow || ![[nswindow contentView] isKindOfClass:[GdkQuartzView class]])
return FALSE;
@@ -1780,19 +1748,6 @@
return FALSE;
}
- /* Apply any global filters. */
- if (_gdk_default_filters)
- {
- result = apply_filters (NULL, nsevent, _gdk_default_filters);
-
- /* If result is GDK_FILTER_CONTINUE, we continue as if nothing
- * happened. If it is GDK_FILTER_REMOVE,
- * we return TRUE and won't send the message to Quartz.
- */
- if (result == GDK_FILTER_REMOVE)
- return TRUE;
- }
-
/* Take care of NSMouseEntered/Exited events and mouse movements
* events and emit the right GDK crossing events.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]