aboutsummaryrefslogtreecommitdiff
path: root/AppKit
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-03-12 22:01:03 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-03-12 22:01:03 +0000
commit613318eefe7b5d2b00773aabf863c9452c711736 (patch)
treeea027fa6916c74368523a20d6bc54db5fc31ff54 /AppKit
parentaf53ca3d77c9b21436bbacd7bc73dc0a4d3d8636 (diff)
[Author: dmaclach]
Reinstate the carbon event application handler. R=thomasvl DELTA=48 (48 added, 0 deleted, 0 changed)
Diffstat (limited to 'AppKit')
-rw-r--r--AppKit/GTMCarbonEvent.h12
-rw-r--r--AppKit/GTMCarbonEvent.m17
-rw-r--r--AppKit/GTMCarbonEventTest.m19
3 files changed, 48 insertions, 0 deletions
diff --git a/AppKit/GTMCarbonEvent.h b/AppKit/GTMCarbonEvent.h
index 83482e9..93ad949 100644
--- a/AppKit/GTMCarbonEvent.h
+++ b/AppKit/GTMCarbonEvent.h
@@ -337,6 +337,18 @@ GTM_EXTERN const OSType kGTMCarbonFrameworkSignature;
+ (GTMCarbonEventMonitorHandler *)sharedEventMonitorHandler;
@end
+// An event handler class representing the application event handler.
+//
+// there is only one of these per application. This way you can put
+// event handlers directly on the application if necessary.
+@interface GTMCarbonEventApplicationEventHandler : GTMCarbonEventHandler
+// Accessor to get the GTMCarbonEventApplicationEventHandler singleton.
+//
+// Returns:
+// pointer to the GTMCarbonEventApplicationEventHandler singleton.
++ (GTMCarbonEventApplicationEventHandler *)sharedApplicationEventHandler;
+@end
+
// An event handler class representing the toolbox dispatcher event handler
//
// there is only one of these per application. This way you can put
diff --git a/AppKit/GTMCarbonEvent.m b/AppKit/GTMCarbonEvent.m
index 2166331..479e49e 100644
--- a/AppKit/GTMCarbonEvent.m
+++ b/AppKit/GTMCarbonEvent.m
@@ -501,6 +501,23 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventMonitorHandler,
@end
+#if (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5)
+// Accidentally marked as !LP64 in the 10.5sdk, it's back in the 10.6 sdk.
+// If you remove this decl, please remove it from GTMCarbonEventTest.m as well.
+extern EventTargetRef GetApplicationEventTarget(void);
+#endif // (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5)
+
+@implementation GTMCarbonEventApplicationEventHandler
+
+GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventApplicationEventHandler,
+ sharedApplicationEventHandler);
+
+- (EventTargetRef)eventTarget {
+ return GetApplicationEventTarget();
+}
+
+@end
+
@implementation GTMCarbonEventDispatcherHandler
GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventDispatcherHandler,
diff --git a/AppKit/GTMCarbonEventTest.m b/AppKit/GTMCarbonEventTest.m
index 261b2d3..ff7fca5 100644
--- a/AppKit/GTMCarbonEventTest.m
+++ b/AppKit/GTMCarbonEventTest.m
@@ -36,6 +36,9 @@
@interface GTMCarbonEventMonitorHandlerTest : GTMTestCase
@end
+@interface GTMCarbonEventApplicationEventHandlerTest : GTMTestCase
+@end
+
@interface GTMCarbonEventDispatcherHandlerTest : GTMTestCase {
@private
BOOL hotKeyHit_;
@@ -237,6 +240,22 @@ static const UInt32 kTestParameterValue = 'bam ';
@end
+#if (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5)
+// Accidentally marked as !LP64 in the 10.5sdk, it's back in the 10.6 sdk.
+// If you remove this decl, please remove it from GTMCarbonEvent.m as well.
+extern EventTargetRef GetApplicationEventTarget(void);
+#endif // (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5)
+
+@implementation GTMCarbonEventApplicationEventHandlerTest
+
+- (void)testEventHandler {
+ GTMCarbonEventApplicationEventHandler *handler
+ = [GTMCarbonEventApplicationEventHandler sharedApplicationEventHandler];
+ STAssertEquals([handler eventTarget], GetApplicationEventTarget(), nil);
+}
+
+@end
+
@implementation GTMCarbonEventDispatcherHandlerTest
- (void)testEventHandler {