Skip to content

Instantly share code, notes, and snippets.

@naan
Created December 31, 2010 19:38
Show Gist options
  • Save naan/761278 to your computer and use it in GitHub Desktop.
Save naan/761278 to your computer and use it in GitHub Desktop.
diff -r f4c422de6fce widget/src/cocoa/nsChildView.mm
--- a/widget/src/cocoa/nsChildView.mm Thu Dec 30 12:51:49 2010 -0500
+++ b/widget/src/cocoa/nsChildView.mm Fri Dec 31 01:35:46 2010 -0800
@@ -4860,10 +4866,17 @@
NSString* chars = [aKeyEvent characters];
if ([chars length] > 0)
outGeckoEvent->charCode = [chars characterAtIndex:0];
-
+
// convert control-modified charCode to raw charCode (with appropriate case)
- if (outGeckoEvent->isControl && outGeckoEvent->charCode <= 26)
- outGeckoEvent->charCode += (outGeckoEvent->isShift) ? ('A' - 1) : ('a' - 1);
+ if (outGeckoEvent->isControl) {
+ /* ACTIVESTATE, charCode of ctrl-space is 0x00 */
+ if (outGeckoEvent->charCode == 0) {
+ outGeckoEvent->charCode = 0x20;
+ }
+ else if (outGeckoEvent->charCode <= 26) {
+ outGeckoEvent->charCode += (outGeckoEvent->isShift) ? ('A' - 1) : ('a' - 1);
+ }
+ }
// Accel and access key handling needs to know the characters that this
// key produces with Shift up or down. So, provide this information
@@ -5719,6 +5732,7 @@
}
}
+/* XXX ACTIVESTATE: allowing to customize ctrl+space keybinding.
// If this is the context menu key command, send a context menu key event.
unsigned int modifierFlags =
nsCocoaUtils::GetCocoaEventModifierFlags(theEvent) & NSDeviceIndependentModifierFlagsMask;
@@ -5733,7 +5747,7 @@
mKeyDownHandled = PR_FALSE;
return handled;
}
-
+*/
nsKeyEvent geckoEvent(PR_TRUE, NS_KEY_PRESS, nsnull);
[self convertCocoaKeyEvent:theEvent toGeckoEvent:&geckoEvent];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment