I checked out the SVN sources and build iTerm (nice code btw) in an attempt to fix the non-working Meta key (Alt/Opt to send esc+keycode).
It turns out that this code fails: [code] keyString = [NSString stringWithFormat: @"0x%x-0x%x", keyCode, theModifiers]; theKeyMapping = [keyMappings objectForKey: keyString]; if(theKeyMapping == nil) { if(text) *text = nil; return (-1); } [/code]
"keyString" is invalid for some reason.
If I stick in: - (BOOL) hasKeyMappingForEvent: (NSEvent *) event highPriority: (BOOL) priority {
+ return 1; return (keyBindingAction >= 0 && keyBindingPriority >= priority);
The meta key works, but clearly always returning true for binding, and high-priority is not a great solution.
Anyone want to throw me some hints ?
I attempted to patch _actionForKeyCode: with:
[code] if (theModifiers & 0x80000) { *highPriority = TRUE; return 0; } [/code]
but it does not make any difference.
Ah ok, managed to get Meta key working as it should, and additionally, I can chose just left, or right, or both; Alt keys as the Meta key.
[code] #if 1 if (modflag & NSAlternateKeyMask) {
// Just use Left Alt/Opt? //if (modflag & NX_DEVICELALTKEYMASK) return 1;
// Just use Right Alt/Opt? //if (modflag & NX_DEVICERALTKEYMASK) return 1;
// Either Alt/Opt key is pushed. return 1; }
#endif
return (keyBindingAction >= 0 && keyBindingPriority >= priority); [/code]
Log in to post a comment.
I checked out the SVN sources and build iTerm (nice code btw) in an attempt to fix the non-working Meta key (Alt/Opt to send esc+keycode).
It turns out that this code fails:
[code]
keyString = [NSString stringWithFormat: @"0x%x-0x%x", keyCode, theModifiers];
theKeyMapping = [keyMappings objectForKey: keyString];
if(theKeyMapping == nil)
{
if(text)
*text = nil;
return (-1);
}
[/code]
"keyString" is invalid for some reason.
If I stick in:
- (BOOL) hasKeyMappingForEvent: (NSEvent *) event highPriority: (BOOL) priority
{
+ return 1;
return (keyBindingAction >= 0 && keyBindingPriority >= priority);
The meta key works, but clearly always returning true for binding, and high-priority is not a great solution.
Anyone want to throw me some hints ?
I attempted to patch _actionForKeyCode: with:
[code]
if (theModifiers & 0x80000) {
*highPriority = TRUE;
return 0;
}
[/code]
but it does not make any difference.
Ah ok, managed to get Meta key working as it should, and additionally, I can chose just left, or right, or both; Alt keys as the Meta key.
[code]
#if 1
if (modflag & NSAlternateKeyMask) {
// Just use Left Alt/Opt?
//if (modflag & NX_DEVICELALTKEYMASK) return 1;
// Just use Right Alt/Opt?
//if (modflag & NX_DEVICERALTKEYMASK) return 1;
// Either Alt/Opt key is pushed.
return 1;
}
#endif
return (keyBindingAction >= 0 && keyBindingPriority >= priority);
[/code]