Commit 56aebbc7 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed hotkey support for the arrow keys and improved their handling in the sprefs

we'll need a similar fix for function keys and friends
parent 42cab23e
...@@ -1137,6 +1137,18 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1137,6 +1137,18 @@ unsigned int CocoaKeyToVLC( unichar i_key )
theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""]; theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""]; theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
} }
if ([theString length] > 1)
{
if([theString rangeOfString:@"Up"].location != NSNotFound)
return [NSString stringWithFormat:@"%C", NSUpArrowFunctionKey];
else if([theString rangeOfString:@"Down"].location != NSNotFound)
return [NSString stringWithFormat:@"%C", NSDownArrowFunctionKey];
else if([theString rangeOfString:@"Right"].location != NSNotFound)
return [NSString stringWithFormat:@"%C", NSRightArrowFunctionKey];
else if([theString rangeOfString:@"Left"].location != NSNotFound)
return [NSString stringWithFormat:@"%C", NSLeftArrowFunctionKey];
}
return theString; return theString;
} }
......
...@@ -85,6 +85,10 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -85,6 +85,10 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString: [NSString stringWithUTF8String: "\xE2\x8C\x83"]]; theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString: [NSString stringWithUTF8String: "\xE2\x8C\x83"]];
theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""]; theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""]; theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
theString = [theString stringByReplacingOccurrencesOfString:@"Right" withString:[NSString stringWithUTF8String:"\xE2\x86\x92"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Left" withString:[NSString stringWithUTF8String:"\xE2\x86\x90"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Up" withString:[NSString stringWithUTF8String:"\xE2\x86\x91"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Down" withString:[NSString stringWithUTF8String:"\xE2\x86\x93"]];
theString = [theString capitalizedString]; theString = [theString capitalizedString];
} }
else else
...@@ -1256,6 +1260,9 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -1256,6 +1260,9 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
- (BOOL)performKeyEquivalent:(NSEvent *)o_theEvent - (BOOL)performKeyEquivalent:(NSEvent *)o_theEvent
{ {
NSMutableString *tempString = [[[NSMutableString alloc] init] autorelease]; NSMutableString *tempString = [[[NSMutableString alloc] init] autorelease];
NSString *keyString = [o_theEvent characters];
unichar key = [keyString characterAtIndex:0];
if( [o_theEvent modifierFlags] & NSControlKeyMask ) if( [o_theEvent modifierFlags] & NSControlKeyMask )
[tempString appendString:@"Ctrl-"]; [tempString appendString:@"Ctrl-"];
...@@ -1268,11 +1275,20 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -1268,11 +1275,20 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
if( [o_theEvent modifierFlags] & NSCommandKeyMask ) if( [o_theEvent modifierFlags] & NSCommandKeyMask )
[tempString appendString:@"Command-"]; [tempString appendString:@"Command-"];
if (![[[o_theEvent charactersIgnoringModifiers] lowercaseString] isEqualToString:@""]) { if( key == NSUpArrowFunctionKey )
[tempString appendString:@"Up"];
else if( key == NSDownArrowFunctionKey )
[tempString appendString:@"Down"];
else if( key == NSLeftArrowFunctionKey )
[tempString appendString:@"Left"];
else if( key == NSRightArrowFunctionKey )
[tempString appendString:@"Right"];
else if (![[[o_theEvent charactersIgnoringModifiers] lowercaseString] isEqualToString:@""])
[tempString appendString:[[o_theEvent charactersIgnoringModifiers] lowercaseString]]; [tempString appendString:[[o_theEvent charactersIgnoringModifiers] lowercaseString]];
return [[[VLCMain sharedInstance] simplePreferences] changeHotkeyTo: tempString]; else
}
return NO; return NO;
return [[[VLCMain sharedInstance] simplePreferences] changeHotkeyTo: tempString];
} }
@end @end
......
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