changeset 25:5396bc2158b9

Added event.keyIdentifier and event.keyLocation properties to quasimodal DOM event data.
author Atul Varma <avarma@mozilla.com>
date Mon, 12 Apr 2010 06:57:47 -0700
parents f2f634d576cf
children 284fe09c6e64
files QuasimodalEventTap.m Quasimode.m
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/QuasimodalEventTap.m	Mon Apr 12 01:40:16 2010 -0700
+++ b/QuasimodalEventTap.m	Mon Apr 12 06:57:47 2010 -0700
@@ -126,8 +126,8 @@
 
       NSNumber *keycodeNum = [NSNumber numberWithUnsignedInt: keycode];
 
-      NSArray *keys = [NSArray arrayWithObjects: @"type", @"chars",
-                               @"keycode", nil];
+      NSArray *keys = [NSArray arrayWithObjects: @"type", @"keyIdentifier",
+                               @"keyLocation", nil];
       NSArray *values = [NSArray arrayWithObjects: eventType, chars,
                                  keycodeNum, nil];
       NSDictionary *dict = [NSDictionary dictionaryWithObjects: values
--- a/Quasimode.m	Mon Apr 12 01:40:16 2010 -0700
+++ b/Quasimode.m	Mon Apr 12 06:57:47 2010 -0700
@@ -13,7 +13,10 @@
 
 @implementation Quasimode
 - onEvent:(NSNotification *)notification {
-  NSString *type = [[notification userInfo] valueForKey: @"type"];
+  NSDictionary *info = [notification userInfo];
+  NSString *type = [info valueForKey: @"type"];
+  NSString *keyIdentifier = [info valueForKey: @"keyIdentifier"];
+  NSNumber *keyLocation = [info valueForKey: @"keyLocation"];
   DOMDocument *document = [[view mainFrame] DOMDocument];
   DOMEvent *event = [document createEvent: @"KeyboardEvent"];
   DOMKeyboardEvent *keyEvent = (DOMKeyboardEvent *) event;
@@ -21,8 +24,8 @@
             canBubble: NO
             cancelable: NO
             view: [document defaultView]
-            keyIdentifier: nil
-            keyLocation: 0
+            keyIdentifier: keyIdentifier
+            keyLocation: [keyLocation unsignedIntValue]
             ctrlKey: NO
             altKey: NO
             shiftKey: NO