[vlc-devel] commit: macosx: cleanup some of the hotkeys in macosx. Still doesn' t solve my issues with ACTION events, but solves issues with "shit" key-combos. (Derk-Jan Hartman )

git version control git at videolan.org
Sun Aug 10 17:08:25 CEST 2008


vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Sun Aug 10 16:51:53 2008 +0200| [52638891205fe3fc4df1b69dd4d969d52faaeb71] | committer: Derk-Jan Hartman 

macosx: cleanup some of the hotkeys in macosx. Still doesn't solve my issues with ACTION events, but solves issues with "shit" key-combos.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=52638891205fe3fc4df1b69dd4d969d52faaeb71
---

 modules/gui/macosx/intf.m         |    2 +
 modules/gui/macosx/simple_prefs.m |  118 +++---------------------------------
 modules/gui/macosx/vout.m         |    2 +-
 3 files changed, 13 insertions(+), 109 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 51292a4..f31abc8 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -262,10 +262,12 @@ static struct
     { NSF10FunctionKey, KEY_F10 },
     { NSF11FunctionKey, KEY_F11 },
     { NSF12FunctionKey, KEY_F12 },
+    { NSInsertFunctionKey, KEY_INSERT },
     { NSHomeFunctionKey, KEY_HOME },
     { NSEndFunctionKey, KEY_END },
     { NSPageUpFunctionKey, KEY_PAGEUP },
     { NSPageDownFunctionKey, KEY_PAGEDOWN },
+    { NSMenuFunctionKey, KEY_MENU },
     { NSTabCharacter, KEY_TAB },
     { NSCarriageReturnCharacter, KEY_ENTER },
     { NSEnterCharacter, KEY_ENTER },
diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index 1a2c914..edb5a20 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -1236,125 +1236,27 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
 
 - (void)keyDown:(NSEvent *)o_theEvent
 {
-    int i_nonReadableKey = 0;
+    unichar key;
+    int i_key = 0;
 
     if( [o_theEvent modifierFlags] & NSControlKeyMask )
-        i_nonReadableKey = i_nonReadableKey | KEY_MODIFIER_CTRL;
+        i_key |= KEY_MODIFIER_CTRL;
 
     if( [o_theEvent modifierFlags] & NSAlternateKeyMask  )
-        i_nonReadableKey = i_nonReadableKey | KEY_MODIFIER_ALT;
+        i_key |= KEY_MODIFIER_ALT;
 
     if( [o_theEvent modifierFlags] & NSShiftKeyMask )
-        i_nonReadableKey = i_nonReadableKey | KEY_MODIFIER_SHIFT;
+        i_key |= KEY_MODIFIER_SHIFT;
 
     if( [o_theEvent modifierFlags] & NSCommandKeyMask )
-        i_nonReadableKey = i_nonReadableKey | KEY_MODIFIER_COMMAND;
+        i_key |= KEY_MODIFIER_COMMAND;
 
-    if( [o_theEvent modifierFlags] & NSFunctionKeyMask  )
+    key = [[[o_theEvent charactersIgnoringModifiers] lowercaseString] characterAtIndex: 0];
+    if( key )
     {
-        unichar key = 0;
-        key = [[o_theEvent charactersIgnoringModifiers] characterAtIndex: 0];
-        
-        switch( key )
-        {
-            case 0x1b:
-                i_nonReadableKey = i_nonReadableKey | KEY_ESC;
-                break;
-            case NSF1FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F1;
-                break;
-            case NSF2FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F2;
-                break;
-            case NSF3FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F3;
-                break;
-            case NSF4FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F4;
-                break;
-            case NSF5FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F5;
-                break;
-            case NSF6FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F6;
-                break;
-            case NSF7FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F7;
-                break;
-            case NSF8FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F8;
-                break;
-            case NSF9FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F9;
-                break;
-            case NSF10FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F10;
-                break;
-            case NSF11FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F11;
-                break;
-            case NSF12FunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_F12;
-                break;
-            case NSInsertFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_INSERT;
-                break;
-            case NSHomeFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_HOME;
-                break;
-            case NSEndFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_END;
-                break;
-            case NSPageUpFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_PAGEUP;
-                break;
-            case NSPageDownFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_PAGEDOWN;
-                break;
-            case NSMenuFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_MENU;
-                break;
-            case NSTabCharacter:
-                i_nonReadableKey = i_nonReadableKey | KEY_TAB;
-                break;
-            case NSDeleteCharacter:
-                i_nonReadableKey = i_nonReadableKey | KEY_DELETE;
-                break;
-            case NSBackspaceCharacter:
-                i_nonReadableKey = i_nonReadableKey | KEY_BACKSPACE;
-                break;
-            case NSUpArrowFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_UP;
-                break;
-            case NSDownArrowFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_DOWN;
-                break;
-            case NSRightArrowFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_RIGHT;
-                break;
-            case NSLeftArrowFunctionKey:
-                i_nonReadableKey = i_nonReadableKey | KEY_LEFT;
-                break;
-            case NSEnterCharacter:
-                i_nonReadableKey = i_nonReadableKey | KEY_ENTER;
-                break;
-            default:
-            {
-                msg_Warn( VLCIntf, "user pressed unknown function key" );
-                i_nonReadableKey = 0;
-                break;
-            }
-        }
+        i_key |= CocoaKeyToVLC( key );
+        [[[VLCMain sharedInstance] getSimplePreferences] changeHotkeyTo: i_key];
     }
-    else
-    {
-        if( [[o_theEvent charactersIgnoringModifiers] isEqualToString: @" "] )
-            i_nonReadableKey = i_nonReadableKey | KEY_SPACE;
-        else
-            i_nonReadableKey = i_nonReadableKey | StringToKey( (char *)[[[o_theEvent charactersIgnoringModifiers] lowercaseString] UTF8String] );
-    }
-
-    [[[VLCMain sharedInstance] getSimplePreferences] changeHotkeyTo: i_nonReadableKey];
 }
 
 @end
diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m
index 0f55c63..3e173e1 100644
--- a/modules/gui/macosx/vout.m
+++ b/modules/gui/macosx/vout.m
@@ -480,7 +480,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     if( i_pressed_modifiers & NSCommandKeyMask )
         val.i_int |= KEY_MODIFIER_COMMAND;
 
-    key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
+    key = [[[o_event charactersIgnoringModifiers] lowercaseString] characterAtIndex: 0];
 
     if( key )
     {




More information about the vlc-devel mailing list