]> git.sesse.net Git - vlc/commitdiff
macosx: cleanup some of the hotkeys in macosx. Still doesn't solve my issues with...
authorDerk-Jan Hartman <hartman@videolan.org>
Sun, 10 Aug 2008 14:51:53 +0000 (16:51 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Sun, 10 Aug 2008 15:10:01 +0000 (17:10 +0200)
modules/gui/macosx/intf.m
modules/gui/macosx/simple_prefs.m
modules/gui/macosx/vout.m

index 51292a47ab0607b9be20c0ea5c73894ec3b65d31..f31abc8092ae6f8a3f6eb56d0ae70b8c4aadbdf1 100644 (file)
@@ -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 },
index 1a2c9142cacd5d642e279237303e5689b8c5c8a8..edb5a205bfc28dad903e1e5bf1769e05f2642ff3 100644 (file)
@@ -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
index 0f55c636d63d1b4ad7fb293ab63452834f00e5c0..3e173e1cce015f9a38568aae8e3f58b1f6d36fea 100644 (file)
@@ -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 )
     {