Commit ba9cae3a authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

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).
(cherry picked from commit 0ccbaa82)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 2752db79
......@@ -122,6 +122,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (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
if( ![self isEvent: o_event forKey: "key-vol-up"] &&
![self isEvent: o_event forKey: "key-vol-down"] &&
......@@ -132,8 +133,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
if([[NSApp mainMenu] performKeyEquivalent:o_event])
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];
}
......
......@@ -175,7 +175,7 @@ struct intf_sys_t
- (NSString *)localizedString:(const char *)psz;
- (char *)delocalizeString:(NSString *)psz;
- (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;
- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
- (void)updateCurrentlyUsedHotkeys;
......
......@@ -1305,7 +1305,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
* 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).
*****************************************************************************/
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force
{
unichar key = 0;
vlc_value_t val;
......@@ -1336,7 +1336,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return YES;
}
if( val.i_int == 0 ) // ignore only when no modifier is pressed
if( !b_force )
{
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