annotate QuasimodalEventTap.m @ 24:f2f634d576cf

quasimodal events now propogate to JS.
author Atul Varma <avarma@mozilla.com>
date Mon, 12 Apr 2010 01:40:16 -0700
parents ddc7cc16c48c
children 5396bc2158b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
17 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
18 CGEventType type,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
19 CGEventRef event,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
20 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
21
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
22 @implementation QuasimodalEventTap
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
23 - (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
24 [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
25 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
26 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
27 }
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
28
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
29 - (CGEventRef)processEventWithProxy: (CGEventTapProxy)proxy
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
30 type: (CGEventType)type
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
31 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
32 BOOL passOnEvent = !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
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 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
35 CGEventFlags flags = CGEventGetFlags(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
36
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
37 if (inQuasimode) {
22
ddc7cc16c48c added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents: 21
diff changeset
38 if (!(flags & quasimodeKey)) {
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
39 NSArray *keys = [NSArray arrayWithObjects: @"type", nil];
24
f2f634d576cf quasimodal events now propogate to JS.
Atul Varma <avarma@mozilla.com>
parents: 22
diff changeset
40 NSArray *values = [NSArray arrayWithObjects: @"quasimodeend", nil];
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
41 NSDictionary *dict = [NSDictionary dictionaryWithObjects: values
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
42 forKeys: keys];
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
43
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
44 [center postNotificationName: @"QuasimodeEvent"
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
45 object: name
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
46 userInfo: dict];
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
47
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
48 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
49 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
50 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
51
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
52 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
53
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
54 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
55 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
56 (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
57 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
58 );
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
59
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
60 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
61 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
62 (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
63 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
64 );
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
65
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
66 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
67 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
68
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
69 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
70 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
71
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
72 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
73 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
74 }
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
75 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
76 }
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
77 } else {
22
ddc7cc16c48c added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents: 21
diff changeset
78 if (flags & quasimodeKey) {
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
79 NSArray *keys = [NSArray arrayWithObjects: @"type", nil];
24
f2f634d576cf quasimodal events now propogate to JS.
Atul Varma <avarma@mozilla.com>
parents: 22
diff changeset
80 NSArray *values = [NSArray arrayWithObjects: @"quasimodestart", nil];
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
81 NSDictionary *dict = [NSDictionary dictionaryWithObjects: values
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
82 forKeys: keys];
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
83
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
84 [center postNotificationName: @"QuasimodeEvent"
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
85 object: name
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
86 userInfo: dict];
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
87
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
88 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
89 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
90 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
91 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
92 } else {
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
93 [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
94 }
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 } 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
97 /* 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
98
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 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
100 UniChar strbuf[MAX_STR_LEN];
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 UniCharCount charsCopied;
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 CGEventKeyboardGetUnicodeString(
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,
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 MAX_STR_LEN,
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 &charsCopied,
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 strbuf
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 NSString *chars = [NSString stringWithCharacters: strbuf
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 length: charsCopied];
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 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
113
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 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
115 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
116 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
117 );
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 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
120 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
121 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
122 lastQuasimodalKeyFlags = CGEventGetFlags(event);
24
f2f634d576cf quasimodal events now propogate to JS.
Atul Varma <avarma@mozilla.com>
parents: 22
diff changeset
123 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
124 } else
24
f2f634d576cf quasimodal events now propogate to JS.
Atul Varma <avarma@mozilla.com>
parents: 22
diff changeset
125 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
126
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 NSNumber *keycodeNum = [NSNumber numberWithUnsignedInt: 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
128
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
129 NSArray *keys = [NSArray arrayWithObjects: @"type", @"chars",
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
130 @"keycode", nil];
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
131 NSArray *values = [NSArray arrayWithObjects: eventType, chars,
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
132 keycodeNum, nil];
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
133 NSDictionary *dict = [NSDictionary dictionaryWithObjects: values
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
134 forKeys: keys];
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
135
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
136 [center postNotificationName: @"QuasimodeEvent"
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
137 object: name
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
138 userInfo: dict];
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
139 } else {
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
140 [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
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
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 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
145 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
146 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
147 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
148 }
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
149
22
ddc7cc16c48c added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents: 21
diff changeset
150 - (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
151 if (self = [super init]) {
22
ddc7cc16c48c added 'quasimodeKey:' parameter to QuasimodalEventTap's init selector.
Atul Varma <avarma@mozilla.com>
parents: 21
diff changeset
152 quasimodeKey = key;
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
153 numQuasimodalKeyDowns = 0;
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
154 inQuasimode = NO;
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
155
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
156 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
157 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
158
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
159 CGEventMask mask = (CGEventMaskBit(kCGEventKeyDown) |
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
160 CGEventMaskBit(kCGEventKeyUp) |
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
161 CGEventMaskBit(kCGEventFlagsChanged));
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
162
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
163 portRef = CGEventTapCreate(kCGHIDEventTap,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
164 kCGHeadInsertEventTap,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
165 0,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
166 mask,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
167 eventTapCallback,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
168 self);
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
169
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
170 if (portRef == NULL)
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
171 printf( "CGEventTapCreate() failed.\n" );
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
172
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
173 rlSrcRef = CFMachPortCreateRunLoopSource(kCFAllocatorDefault,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
174 portRef,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
175 0);
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
176
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
177 CFRunLoopAddSource(CFRunLoopGetCurrent(),
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
178 rlSrcRef,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
179 kCFRunLoopDefaultMode);
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
180 }
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
181 return 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
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
184 - (void)finalize {
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
185 CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
186 rlSrcRef,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
187 kCFRunLoopDefaultMode);
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
188
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
189 CFRelease(rlSrcRef);
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
190 CFRelease(portRef);
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
191 }
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
192 @end
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 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
195 CGEventType type,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
196 CGEventRef event,
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
197 void *refcon)
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
198
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
199 {
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
200 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
201 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
202 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
203 [[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
204 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
205 ];
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
206
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
207 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
208 [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
209 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
210 } else {
19
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
211 QuasimodalEventTap *tap = (QuasimodalEventTap *) refcon;
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
212 retval = [tap processEventWithProxy: proxy
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
213 type: type
8053681846ad Refactored event tap C code into an Objective-C class.
Atul Varma <avarma@mozilla.com>
parents: 18
diff changeset
214 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
215 }
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
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 [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
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 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
220 }