summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xtoq/XtoqApplication.m49
-rw-r--r--src/xtoq/XtoqController.m3
2 files changed, 49 insertions, 3 deletions
diff --git a/src/xtoq/XtoqApplication.m b/src/xtoq/XtoqApplication.m
index fe323db..3fcea9d 100644
--- a/src/xtoq/XtoqApplication.m
+++ b/src/xtoq/XtoqApplication.m
@@ -274,6 +274,55 @@ XtoqApplicationMain(int argc, char** argv)
break;
}
+ case NSFlagsChanged:
+ {
+ static int currentModFlags = 0;
+ int modFlags = [e modifierFlags];
+ BOOL key_pressed = NO;
+
+ if (modFlags & NSAlphaShiftKeyMask) {
+ NSLog(@"Alpha key mask");
+ }
+
+ if ((modFlags & NSShiftKeyMask)
+ && !(currentModFlags & NSShiftKeyMask)) {
+ key_pressed = YES;
+ }
+
+ if ((modFlags & NSControlKeyMask)
+ && !(currentModFlags & NSControlKeyMask)) {
+ key_pressed = YES;
+ }
+
+ if ((modFlags & NSAlternateKeyMask)
+ && !(currentModFlags & NSAlternateKeyMask)) {
+ key_pressed = YES;
+ }
+
+ if ((modFlags & NSCommandKeyMask)
+ && !(currentModFlags & NSCommandKeyMask)) {
+ key_pressed = YES;
+ }
+
+ if (key_pressed) {
+ NSDictionary * dictionary =
+ [NSDictionary dictionaryWithObject:e
+ forKey:@"1"];
+ [notificationCenter postNotificationName:@"XTOQviewKeyDownEvent"
+ object:self
+ userInfo:dictionary];
+ } else {
+ NSDictionary * dictionary =
+ [NSDictionary dictionaryWithObject:e
+ forKey:@"1"];
+ [notificationCenter postNotificationName:@"XTOQviewKeyUpEvent"
+ object:self
+ userInfo:dictionary];
+ }
+ currentModFlags = modFlags;
+ break;
+ }
+
default:
break;
}
diff --git a/src/xtoq/XtoqController.m b/src/xtoq/XtoqController.m
index 1821c4c..8965a8c 100644
--- a/src/xtoq/XtoqController.m
+++ b/src/xtoq/XtoqController.m
@@ -192,10 +192,7 @@
// note this keyInfo is the key in <key, value> not the key pressed
NSEvent * event = [keyInfo objectForKey: @"1"];
unsigned short aChar = [event keyCode];
- NSString* charNSString = [event characters];
- const char* charcharstar = [charNSString UTF8String];
- NSLog(@"%s pressed", charcharstar);
// FIXME: Uses a 'magic number' for offset into keymap - should a
// #define or gotten programmatically.
dispatch_async(xcwmDispatchQueue,