- (void)showHotkeySettings;
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex;
-- (void)changeHotkeyTo: (int)i_theNewKey;
+- (BOOL)changeHotkeyTo: (int)i_theNewKey;
@end
@interface VLCHotkeyChangeWindow : NSWindow
-- (void)keyDown:(NSEvent *)theEvent;
-
@end
}
}
-- (void)changeHotkeyTo: (int)i_theNewKey
+- (BOOL)changeHotkeyTo: (int)i_theNewKey
{
int i_returnValue;
i_returnValue = [o_hotkeysNonUseableKeys indexOfObject: [NSNumber numberWithInt: i_theNewKey]];
[o_hotkeys_change_keys_lbl setStringValue: _NS("Invalid combination")];
[o_hotkeys_change_taken_lbl setStringValue: _NS("Regrettably, these keys cannot be assigned as hotkey shortcuts.")];
[o_hotkeys_change_ok_btn setEnabled: NO];
+ return NO;
}
else
{
[o_hotkeys_change_taken_lbl setStringValue: @""];
[o_hotkeys_change_ok_btn setEnabled: YES];
+ return YES;
}
}
@implementation VLCHotkeyChangeWindow
+- (BOOL)acceptsFirstResponder
+{
+ return YES;
+}
+
+- (BOOL)becomeFirstResponder
+{
+ return YES;
+}
+
- (BOOL)resignFirstResponder
{
/* We need to stay the first responder or we'll miss the user's input */
return NO;
}
-- (void)keyDown:(NSEvent *)o_theEvent
+- (BOOL)performKeyEquivalent:(NSEvent *)o_theEvent
{
unichar key;
int i_key = 0;
if( key )
{
i_key |= CocoaKeyToVLC( key );
- [[[VLCMain sharedInstance] getSimplePreferences] changeHotkeyTo: i_key];
+ return [[[VLCMain sharedInstance] getSimplePreferences] changeHotkeyTo: i_key];
}
+ return FALSE;
}
@end