Mercurial > osx-quasimode
annotate QuasimodalEventTap.m @ 26:284fe09c6e64
quasimode events now come with complete modifier key information.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Mon, 12 Apr 2010 10:08:28 -0700 |
parents | 5396bc2158b9 |
children |
rev | line source |
---|---|
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
1 #include <AppKit/NSWorkspace.h> |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
2 #import <Foundation/NSAutoreleasePool.h> |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
3 #import <Foundation/NSString.h> |
20
58522f82a39e
Brought back the notification center code to QuasimodalEventTap, we can just use the in-process one instead of setting up some complicated observer protocol.
Atul Varma <avarma@mozilla.com>
parents:
19
diff
changeset
|
4 #import <Foundation/NSArray.h> |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
5 #import <Foundation/NSDictionary.h> |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
6 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
7 #import "QuasimodalEventTap.h" |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
8 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
9 #define MAX_STR_LEN 10 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
10 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
11 #ifdef DEBUG |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
12 #define DEBUG_MSG(msg) printf(msg); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
13 #else |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
14 #define DEBUG_MSG(msg) |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
15 #endif |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
16 |
26
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
17 static NSNumber *isPressed(CGEventFlags flags, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
18 CGEventFlags filter) |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
19 { |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
20 return [NSNumber numberWithBool: ((flags & filter) != 0)]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
21 } |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
22 |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
23 static CGEventRef eventTapCallback(CGEventTapProxy proxy, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
24 CGEventType type, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
25 CGEventRef event, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
26 void *refcon); |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
27 |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
28 @implementation QuasimodalEventTap |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
29 - (void)sendSomeKeyEvent { |
21
cdc615772d43
change notification protocol and made test program get notifications instead of relying on debug messages.
Atul Varma <avarma@mozilla.com>
parents:
20
diff
changeset
|
30 [center postNotificationName: @"NonQuasimodalKeypress" |
20
58522f82a39e
Brought back the notification center code to QuasimodalEventTap, we can just use the in-process one instead of setting up some complicated observer protocol.
Atul Varma <avarma@mozilla.com>
parents:
19
diff
changeset
|
31 object: name |
21
cdc615772d43
change notification protocol and made test program get notifications instead of relying on debug messages.
Atul Varma <avarma@mozilla.com>
parents:
20
diff
changeset
|
32 userInfo: nil]; |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
33 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
34 |
26
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
35 - (void)sendQuasimodeEvent:(CGEventRef)event |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
36 withType:(NSString *)eventType { |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
37 UniChar strbuf[MAX_STR_LEN]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
38 UniCharCount charsCopied; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
39 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
40 CGEventKeyboardGetUnicodeString(event, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
41 MAX_STR_LEN, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
42 &charsCopied, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
43 strbuf); |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
44 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
45 NSString *chars = [NSString stringWithCharacters: strbuf |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
46 length: charsCopied]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
47 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
48 int64_t keycode = CGEventGetIntegerValueField(event, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
49 kCGKeyboardEventKeycode); |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
50 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
51 NSNumber *keycodeNum = [NSNumber numberWithUnsignedInt: keycode]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
52 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
53 NSArray *keys = [NSArray arrayWithObjects: @"type", |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
54 @"keyIdentifier", |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
55 @"keyLocation", |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
56 @"ctrlKey", |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
57 @"altKey", |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
58 @"shiftKey", |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
59 @"metaKey", |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
60 nil]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
61 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
62 CGEventFlags flags = CGEventGetFlags(event); |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
63 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
64 NSArray *values = [NSArray arrayWithObjects: eventType, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
65 chars, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
66 keycodeNum, |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
67 isPressed(flags, kCGEventFlagMaskControl), |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
68 isPressed(flags, kCGEventFlagMaskAlternate), |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
69 isPressed(flags, kCGEventFlagMaskShift), |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
70 isPressed(flags, kCGEventFlagMaskCommand), |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
71 nil]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
72 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
73 NSDictionary *dict = [NSDictionary dictionaryWithObjects: values |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
74 forKeys: keys]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
75 |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
76 [center postNotificationName: @"QuasimodeEvent" |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
77 object: name |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
78 userInfo: dict]; |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
79 } |
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
80 |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
81 - (CGEventRef)processEventWithProxy: (CGEventTapProxy)proxy |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
82 type: (CGEventType)type |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
83 event: (CGEventRef)event { |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
84 BOOL passOnEvent = !inQuasimode; |
26
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
85 CGEventFlags flags = CGEventGetFlags(event); |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
86 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
87 if (type == kCGEventFlagsChanged) { |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
88 if (inQuasimode) { |
22
ddc7cc16c48c
added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents:
21
diff
changeset
|
89 if (!(flags & quasimodeKey)) { |
26
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
90 [self sendQuasimodeEvent: event withType: @"quasimodeend"]; |
20
58522f82a39e
Brought back the notification center code to QuasimodalEventTap, we can just use the in-process one instead of setting up some complicated observer protocol.
Atul Varma <avarma@mozilla.com>
parents:
19
diff
changeset
|
91 |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
92 inQuasimode = NO; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
93 if (numQuasimodalKeyDowns == 1) { |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
94 CGEventRef event[2]; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
95 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
96 DEBUG_MSG("Re-posting single keypress\n"); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
97 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
98 event[0] = CGEventCreateKeyboardEvent( |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
99 NULL, |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
100 (CGKeyCode) lastQuasimodalKeyCode, |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
101 true |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
102 ); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
103 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
104 event[1] = CGEventCreateKeyboardEvent( |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
105 NULL, |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
106 (CGKeyCode) lastQuasimodalKeyCode, |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
107 false |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
108 ); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
109 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
110 CGEventSetFlags(event[0], lastQuasimodalKeyFlags); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
111 CGEventSetFlags(event[1], lastQuasimodalKeyFlags); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
112 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
113 CGEventTapPostEvent(proxy, event[0]); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
114 CGEventTapPostEvent(proxy, event[1]); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
115 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
116 CFRelease(event[0]); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
117 CFRelease(event[1]); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
118 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
119 DEBUG_MSG("Exit quasimode\n"); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
120 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
121 } else { |
22
ddc7cc16c48c
added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents:
21
diff
changeset
|
122 if (flags & quasimodeKey) { |
26
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
123 [self sendQuasimodeEvent: event withType: @"quasimodestart"]; |
20
58522f82a39e
Brought back the notification center code to QuasimodalEventTap, we can just use the in-process one instead of setting up some complicated observer protocol.
Atul Varma <avarma@mozilla.com>
parents:
19
diff
changeset
|
124 |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
125 inQuasimode = YES; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
126 passOnEvent = NO; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
127 numQuasimodalKeyDowns = 0; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
128 DEBUG_MSG("Enter quasimode\n"); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
129 } else { |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
130 [self sendSomeKeyEvent]; |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
131 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
132 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
133 } else { |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
134 /* Key up/down event */ |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
135 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
136 if (inQuasimode) { |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
137 NSString *eventType; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
138 int64_t keycode = CGEventGetIntegerValueField( |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
139 event, |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
140 kCGKeyboardEventKeycode |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
141 ); |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
142 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
143 if (type == kCGEventKeyDown) { |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
144 numQuasimodalKeyDowns += 1; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
145 lastQuasimodalKeyCode = keycode; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
146 lastQuasimodalKeyFlags = CGEventGetFlags(event); |
24
f2f634d576cf
quasimodal events now propogate to JS.
Atul Varma <avarma@mozilla.com>
parents:
22
diff
changeset
|
147 eventType = @"quasimodekeydown"; |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
148 } else |
24
f2f634d576cf
quasimodal events now propogate to JS.
Atul Varma <avarma@mozilla.com>
parents:
22
diff
changeset
|
149 eventType = @"quasimodekeyup"; |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
150 |
26
284fe09c6e64
quasimode events now come with complete modifier key information.
Atul Varma <avarma@mozilla.com>
parents:
25
diff
changeset
|
151 [self sendQuasimodeEvent: event withType: eventType]; |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
152 } else { |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
153 [self sendSomeKeyEvent]; |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
154 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
155 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
156 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
157 if (passOnEvent) |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
158 return event; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
159 else |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
160 return NULL; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
161 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
162 |
22
ddc7cc16c48c
added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents:
21
diff
changeset
|
163 - (id)initWithName:(NSString *)objectName quasimodeKey:(CGEventFlags)key { |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
164 if (self = [super init]) { |
22
ddc7cc16c48c
added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents:
21
diff
changeset
|
165 quasimodeKey = key; |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
166 numQuasimodalKeyDowns = 0; |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
167 inQuasimode = NO; |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
168 |
20
58522f82a39e
Brought back the notification center code to QuasimodalEventTap, we can just use the in-process one instead of setting up some complicated observer protocol.
Atul Varma <avarma@mozilla.com>
parents:
19
diff
changeset
|
169 name = [objectName copy]; |
58522f82a39e
Brought back the notification center code to QuasimodalEventTap, we can just use the in-process one instead of setting up some complicated observer protocol.
Atul Varma <avarma@mozilla.com>
parents:
19
diff
changeset
|
170 center = [NSNotificationCenter defaultCenter]; |
58522f82a39e
Brought back the notification center code to QuasimodalEventTap, we can just use the in-process one instead of setting up some complicated observer protocol.
Atul Varma <avarma@mozilla.com>
parents:
19
diff
changeset
|
171 |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
172 CGEventMask mask = (CGEventMaskBit(kCGEventKeyDown) | |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
173 CGEventMaskBit(kCGEventKeyUp) | |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
174 CGEventMaskBit(kCGEventFlagsChanged)); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
175 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
176 portRef = CGEventTapCreate(kCGHIDEventTap, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
177 kCGHeadInsertEventTap, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
178 0, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
179 mask, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
180 eventTapCallback, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
181 self); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
182 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
183 if (portRef == NULL) |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
184 printf( "CGEventTapCreate() failed.\n" ); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
185 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
186 rlSrcRef = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
187 portRef, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
188 0); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
189 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
190 CFRunLoopAddSource(CFRunLoopGetCurrent(), |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
191 rlSrcRef, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
192 kCFRunLoopDefaultMode); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
193 } |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
194 return self; |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
195 } |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
196 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
197 - (void)finalize { |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
198 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
199 rlSrcRef, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
200 kCFRunLoopDefaultMode); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
201 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
202 CFRelease(rlSrcRef); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
203 CFRelease(portRef); |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
204 } |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
205 @end |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
206 |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
207 static CGEventRef eventTapCallback(CGEventTapProxy proxy, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
208 CGEventType type, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
209 CGEventRef event, |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
210 void *refcon) |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
211 |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
212 { |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
213 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
214 CGEventRef retval; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
215 NSString *bundleId = [ |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
216 [[NSWorkspace sharedWorkspace] activeApplication] |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
217 objectForKey: @"NSApplicationBundleIdentifier" |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
218 ]; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
219 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
220 if (bundleId && |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
221 [bundleId isEqualToString: @"com.blizzard.worldofwarcraft"]) { |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
222 retval = event; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
223 } else { |
19
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
224 QuasimodalEventTap *tap = (QuasimodalEventTap *) refcon; |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
225 retval = [tap processEventWithProxy: proxy |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
226 type: type |
8053681846ad
Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents:
18
diff
changeset
|
227 event: event]; |
18
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
228 } |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
229 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
230 [pool release]; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
231 |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
232 return retval; |
78807eea31b7
Added EnsoKeyNotifier.m from Enso source, renamed to QuasimodalEventTap.m w/ some notification center stuff removed and formatting fixed to match this codebase.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
233 } |