Commit 0ccbaa82 authored by David Fuhrmann's avatar David Fuhrmann

macosx: change handling of arrow keys slightly

When the key is assigned to an main menu item: In this case the event
is never passed to the controls, so we want to handle it here for these
exeptional cases.

For all other cases: The event is ignored here and handled by the controls
(playlist, or video view, which also sends it to vlc core).
parent 837e3ea6
...@@ -122,6 +122,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -122,6 +122,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (BOOL)performKeyEquivalent:(NSEvent *)o_event - (BOOL)performKeyEquivalent:(NSEvent *)o_event
{ {
BOOL b_force = NO;
// these are key events which should be handled by vlc core, but are attached to a main menu item // these are key events which should be handled by vlc core, but are attached to a main menu item
if( ![self isEvent: o_event forKey: "key-vol-up"] && if( ![self isEvent: o_event forKey: "key-vol-up"] &&
![self isEvent: o_event forKey: "key-vol-down"] && ![self isEvent: o_event forKey: "key-vol-down"] &&
...@@ -132,8 +133,10 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -132,8 +133,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
if([[NSApp mainMenu] performKeyEquivalent:o_event]) if([[NSApp mainMenu] performKeyEquivalent:o_event])
return TRUE; return TRUE;
} }
else
b_force = YES;
return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event] || return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event force:b_force] ||
[(VLCControls *)[[VLCMain sharedInstance] controls] keyEvent:o_event]; [(VLCControls *)[[VLCMain sharedInstance] controls] keyEvent:o_event];
} }
......
...@@ -175,7 +175,7 @@ struct intf_sys_t ...@@ -175,7 +175,7 @@ struct intf_sys_t
- (NSString *)localizedString:(const char *)psz; - (NSString *)localizedString:(const char *)psz;
- (char *)delocalizeString:(NSString *)psz; - (char *)delocalizeString:(NSString *)psz;
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width; - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event; - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
- (NSString *)VLCKeyToString:(NSString *)theString; - (NSString *)VLCKeyToString:(NSString *)theString;
- (unsigned int)VLCModifiersToCocoa:(NSString *)theString; - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
- (void)updateCurrentlyUsedHotkeys; - (void)updateCurrentlyUsedHotkeys;
......
...@@ -1315,7 +1315,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1315,7 +1315,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
* shortcut key. If it is, pass it off to VLC for handling and return YES, * shortcut key. If it is, pass it off to VLC for handling and return YES,
* otherwise ignore it and return NO (where it will get handled by Cocoa). * otherwise ignore it and return NO (where it will get handled by Cocoa).
*****************************************************************************/ *****************************************************************************/
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force
{ {
unichar key = 0; unichar key = 0;
vlc_value_t val; vlc_value_t val;
...@@ -1346,7 +1346,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1346,7 +1346,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return YES; return YES;
} }
if( val.i_int == 0 ) // ignore only when no modifier is pressed if( !b_force )
{ {
switch( key ) switch( key )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment