Commit 6325b1c3 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed NSRangeException when triggering modifier keys without...

macosx: fixed NSRangeException when triggering modifier keys without characters as enabled by some international keyboards (close #7268)
(cherry picked from commit c97faddc527a0455c93419982b23763a3d6485d8)

Conflicts:
	modules/gui/macosx/MainWindow.m
	modules/gui/macosx/intf.m
parent c772af6d
...@@ -113,11 +113,15 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -113,11 +113,15 @@ static VLCMainWindow *_o_sharedInstance = nil;
unsigned int i_keyModifiers = [[VLCMain sharedInstance] VLCModifiersToCocoa:o_key]; unsigned int i_keyModifiers = [[VLCMain sharedInstance] VLCModifiersToCocoa:o_key];
return [[[o_event charactersIgnoringModifiers] lowercaseString] isEqualToString: [[VLCMain sharedInstance] VLCKeyToString: o_key]] && NSString * characters = [o_event charactersIgnoringModifiers];
(i_keyModifiers & NSShiftKeyMask) == ([o_event modifierFlags] & NSShiftKeyMask) && if ([characters length] > 0) {
(i_keyModifiers & NSControlKeyMask) == ([o_event modifierFlags] & NSControlKeyMask) && return [[characters lowercaseString] isEqualToString: [[VLCMain sharedInstance] VLCKeyToString: o_key]] &&
(i_keyModifiers & NSAlternateKeyMask) == ([o_event modifierFlags] & NSAlternateKeyMask) && (i_keyModifiers & NSShiftKeyMask) == ([o_event modifierFlags] & NSShiftKeyMask) &&
(i_keyModifiers & NSCommandKeyMask) == ([o_event modifierFlags] & NSCommandKeyMask); (i_keyModifiers & NSControlKeyMask) == ([o_event modifierFlags] & NSControlKeyMask) &&
(i_keyModifiers & NSAlternateKeyMask) == ([o_event modifierFlags] & NSAlternateKeyMask) &&
(i_keyModifiers & NSCommandKeyMask) == ([o_event modifierFlags] & NSCommandKeyMask);
}
return NO;
} }
- (BOOL)performKeyEquivalent:(NSEvent *)o_event - (BOOL)performKeyEquivalent:(NSEvent *)o_event
...@@ -750,7 +754,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -750,7 +754,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_split_view setHidden: YES]; [o_split_view setHidden: YES];
[o_video_view setHidden: NO]; [o_video_view setHidden: NO];
if( [[o_video_view subviews] count] > 0 ) if( [[o_video_view subviews] count] > 0 )
[self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]]; [self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
} }
...@@ -821,7 +825,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -821,7 +825,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)setRepeatOne - (void)setRepeatOne
{ {
[o_repeat_btn setImage: o_repeat_one_img]; [o_repeat_btn setImage: o_repeat_one_img];
[o_repeat_btn setAlternateImage: o_repeat_one_pressed_img]; [o_repeat_btn setAlternateImage: o_repeat_one_pressed_img];
} }
- (void)setRepeatAll - (void)setRepeatAll
...@@ -1026,7 +1030,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1026,7 +1030,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
* which will fit inside the screen. * which will fit inside the screen.
* *
* This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+. * This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+.
* Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>, * Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>,
* Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk> * Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Copyright (C) 1996 Free Software Foundation, Inc. * Copyright (C) 1996 Free Software Foundation, Inc.
*/ */
...@@ -1052,7 +1056,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1052,7 +1056,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
difference2 = screenRect.origin.y - frameRect.origin.y; difference2 = screenRect.origin.y - frameRect.origin.y;
difference2 -= difference; difference2 -= difference;
// Take in account the space between the top of window and the top of the // Take in account the space between the top of window and the top of the
// screen which can be used to move the bottom of the window on the screen // screen which can be used to move the bottom of the window on the screen
if (difference2 > 0) if (difference2 > 0)
{ {
...@@ -1080,7 +1084,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1080,7 +1084,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
be allowed to zoom to full screen. be allowed to zoom to full screen.
* *
* This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+. * This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+.
* Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>, * Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>,
* Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk> * Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Copyright (C) 1996 Free Software Foundation, Inc. * Copyright (C) 1996 Free Software Foundation, Inc.
*/ */
...@@ -1163,7 +1167,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1163,7 +1167,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
// needed when entering lion fullscreen mode // needed when entering lion fullscreen mode
if( b_fullscreen ) if( b_fullscreen )
return proposedFrameSize; return proposedFrameSize;
if( [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked] ) if( [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked] )
{ {
NSRect videoWindowFrame = [videoWindow frame]; NSRect videoWindowFrame = [videoWindow frame];
...@@ -2163,14 +2167,14 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2163,14 +2167,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
[NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)]; [NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
var_SetBool( pl_Get( VLCIntf ), "fullscreen", true ); var_SetBool( pl_Get( VLCIntf ), "fullscreen", true );
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if( p_vout ) if( p_vout )
{ {
var_SetBool( p_vout, "fullscreen", true ); var_SetBool( p_vout, "fullscreen", true );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
[o_video_view setFrame: [[self contentView] frame]]; [o_video_view setFrame: [[self contentView] frame]];
b_fullscreen = YES; b_fullscreen = YES;
...@@ -2195,7 +2199,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2195,7 +2199,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if ([[VLCMain sharedInstance] activeVideoPlayback]) if ([[VLCMain sharedInstance] activeVideoPlayback])
[o_bottombar_view setHidden: YES]; [o_bottombar_view setHidden: YES];
[self setMovableByWindowBackground: NO]; [self setMovableByWindowBackground: NO];
} }
...@@ -2213,7 +2217,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2213,7 +2217,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
var_SetBool( pl_Get( VLCIntf ), "fullscreen", false ); var_SetBool( pl_Get( VLCIntf ), "fullscreen", false );
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if( p_vout ) if( p_vout )
{ {
...@@ -2247,7 +2251,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2247,7 +2251,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if ([[VLCMain sharedInstance] activeVideoPlayback]) if ([[VLCMain sharedInstance] activeVideoPlayback])
[o_bottombar_view setHidden: NO]; [o_bottombar_view setHidden: NO];
[self setMovableByWindowBackground: YES]; [self setMovableByWindowBackground: YES];
} }
...@@ -2594,7 +2598,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2594,7 +2598,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( [o_attribute_name isEqualTo: NSAccessibilityMinimizeButtonAttribute] ) if( [o_attribute_name isEqualTo: NSAccessibilityMinimizeButtonAttribute] )
return [[o_tbv minimizeButton] cell]; return [[o_tbv minimizeButton] cell];
if( [o_attribute_name isEqualTo: NSAccessibilityZoomButtonAttribute] ) if( [o_attribute_name isEqualTo: NSAccessibilityZoomButtonAttribute] )
return [[o_tbv zoomButton] cell]; return [[o_tbv zoomButton] cell];
} }
...@@ -2712,7 +2716,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2712,7 +2716,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
* which will fit inside the screen. * which will fit inside the screen.
* *
* This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+. * This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+.
* Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>, * Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>,
* Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk> * Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Copyright (C) 1996 Free Software Foundation, Inc. * Copyright (C) 1996 Free Software Foundation, Inc.
*/ */
...@@ -2738,7 +2742,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2738,7 +2742,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
difference2 = screenRect.origin.y - frameRect.origin.y; difference2 = screenRect.origin.y - frameRect.origin.y;
difference2 -= difference; difference2 -= difference;
// Take in account the space between the top of window and the top of the // Take in account the space between the top of window and the top of the
// screen which can be used to move the bottom of the window on the screen // screen which can be used to move the bottom of the window on the screen
if (difference2 > 0) if (difference2 > 0)
{ {
...@@ -2766,7 +2770,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2766,7 +2770,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
be allowed to zoom to full screen. be allowed to zoom to full screen.
* *
* This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+. * This method is based upon NSWindow.m, part of the GNUstep GUI Library, licensed under LGPLv2+.
* Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>, * Authors: Scott Christley <scottc@net-community.com>, Venkat Ajjanagadde <venkat@ocbi.com>,
* Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk> * Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Copyright (C) 1996 Free Software Foundation, Inc. * Copyright (C) 1996 Free Software Foundation, Inc.
*/ */
...@@ -2810,7 +2814,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2810,7 +2814,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
if( !b_dark_interface ) if( !b_dark_interface )
return [super accessibilityAttributeNames]; return [super accessibilityAttributeNames];
static NSMutableArray *attributes = nil; static NSMutableArray *attributes = nil;
if ( attributes == nil ) { if ( attributes == nil ) {
attributes = [[super accessibilityAttributeNames] mutableCopy]; attributes = [[super accessibilityAttributeNames] mutableCopy];
...@@ -2819,7 +2823,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2819,7 +2823,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
NSAccessibilityMinimizeButtonAttribute, NSAccessibilityMinimizeButtonAttribute,
NSAccessibilityZoomButtonAttribute, NSAccessibilityZoomButtonAttribute,
nil]; nil];
for( NSString *attribute in appendAttributes ) for( NSString *attribute in appendAttributes )
{ {
if( ![attributes containsObject:attribute] ) if( ![attributes containsObject:attribute] )
...@@ -2834,20 +2838,20 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2834,20 +2838,20 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( b_dark_interface ) if( b_dark_interface )
{ {
VLCMainWindowTitleView *o_tbv = [[VLCMainWindow sharedInstance] detachedTitlebarView]; VLCMainWindowTitleView *o_tbv = [[VLCMainWindow sharedInstance] detachedTitlebarView];
if( [o_attribute_name isEqualTo: NSAccessibilitySubroleAttribute] ) if( [o_attribute_name isEqualTo: NSAccessibilitySubroleAttribute] )
return NSAccessibilityStandardWindowSubrole; return NSAccessibilityStandardWindowSubrole;
if( [o_attribute_name isEqualTo: NSAccessibilityCloseButtonAttribute] ) if( [o_attribute_name isEqualTo: NSAccessibilityCloseButtonAttribute] )
return [[o_tbv closeButton] cell]; return [[o_tbv closeButton] cell];
if( [o_attribute_name isEqualTo: NSAccessibilityMinimizeButtonAttribute] ) if( [o_attribute_name isEqualTo: NSAccessibilityMinimizeButtonAttribute] )
return [[o_tbv minimizeButton] cell]; return [[o_tbv minimizeButton] cell];
if( [o_attribute_name isEqualTo: NSAccessibilityZoomButtonAttribute] ) if( [o_attribute_name isEqualTo: NSAccessibilityZoomButtonAttribute] )
return [[o_tbv zoomButton] cell]; return [[o_tbv zoomButton] cell];
} }
return [super accessibilityAttributeValue: o_attribute_name]; return [super accessibilityAttributeValue: o_attribute_name];
} }
......
...@@ -140,41 +140,46 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -140,41 +140,46 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
if( i_pressed_modifiers & NSCommandKeyMask ) if( i_pressed_modifiers & NSCommandKeyMask )
val.i_int |= KEY_MODIFIER_COMMAND; val.i_int |= KEY_MODIFIER_COMMAND;
key = [[[o_event charactersIgnoringModifiers] lowercaseString] characterAtIndex: 0]; NSString * characters = [o_event charactersIgnoringModifiers];
if ([characters length] > 0)
if( key )
{ {
vout_thread_t * p_vout = getVout(); key = [[characters lowercaseString] characterAtIndex: 0];
/* Escape should always get you out of fullscreen */
if( key == (unichar) 0x1b ) if( key )
{
playlist_t * p_playlist = pl_Get( VLCIntf );
if( var_GetBool( p_playlist, "fullscreen" ) )
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
/* handle Lion's default key combo for fullscreen-toggle in addition to our own hotkeys */
else if( key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask )
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
else if ( p_vout )
{ {
if( key == ' ' ) vout_thread_t * p_vout = getVout();
/* Escape should always get you out of fullscreen */
if( key == (unichar) 0x1b )
{ {
[[VLCCoreInteraction sharedInstance] play]; playlist_t * p_playlist = pl_Get( VLCIntf );
if( var_GetBool( p_playlist, "fullscreen") )
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
} }
else /* handle Lion's default key combo for fullscreen-toggle in addition to our own hotkeys */
else if( key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask )
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
else if ( p_vout )
{ {
val.i_int |= (int)CocoaKeyToVLC( key ); if( key == ' ' )
var_Set( p_vout->p_libvlc, "key-pressed", val ); {
[[VLCCoreInteraction sharedInstance] play];
}
else
{
val.i_int |= (int)CocoaKeyToVLC( key );
var_Set( p_vout->p_libvlc, "key-pressed", val );
}
} }
} else
else msg_Dbg( VLCIntf, "could not send keyevent to VLC core" );
msg_Dbg( VLCIntf, "could not send keyevent to VLC core" );
if (p_vout) if (p_vout)
vlc_object_release( p_vout ); vlc_object_release( p_vout );
return;
}
} }
else [super keyDown: o_event];
[super keyDown: o_event];
} }
- (BOOL)performKeyEquivalent:(NSEvent *)o_event - (BOOL)performKeyEquivalent:(NSEvent *)o_event
......
...@@ -345,34 +345,38 @@ ...@@ -345,34 +345,38 @@
- (BOOL)keyEvent:(NSEvent *)o_event - (BOOL)keyEvent:(NSEvent *)o_event
{ {
BOOL eventHandled = NO; BOOL eventHandled = NO;
unichar key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0]; NSString * characters = [o_event charactersIgnoringModifiers];
if ([characters length] > 0)
if( key )
{ {
input_thread_t * p_input = pl_CurrentInput( VLCIntf ); unichar key = [characters characterAtIndex: 0];
if( p_input != NULL )
{
vout_thread_t *p_vout = input_GetVout( p_input );
if( p_vout != NULL ) if( key )
{
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
if( p_input != NULL )
{ {
/* Escape */ vout_thread_t *p_vout = input_GetVout( p_input );
if( key == (unichar) 0x1b )
if( p_vout != NULL )
{ {
if (var_GetBool( p_vout, "fullscreen" )) /* Escape */
if( key == (unichar) 0x1b )
{ {
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; if (var_GetBool( p_vout, "fullscreen" ))
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
eventHandled = YES;
}
}
else if( key == ' ' )
{
[self play:self];
eventHandled = YES; eventHandled = YES;
} }
vlc_object_release( p_vout );
} }
else if( key == ' ' ) vlc_object_release( p_input );
{
[self play:self];
eventHandled = YES;
}
vlc_object_release( p_vout );
} }
vlc_object_release( p_input );
} }
} }
return eventHandled; return eventHandled;
......
...@@ -1340,62 +1340,66 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1340,62 +1340,66 @@ unsigned int CocoaKeyToVLC( unichar i_key )
val.i_int |= KEY_MODIFIER_COMMAND; val.i_int |= KEY_MODIFIER_COMMAND;
} }
key = [[[o_event charactersIgnoringModifiers] lowercaseString] characterAtIndex: 0]; NSString * characters = [o_event charactersIgnoringModifiers];
if ([characters length] > 0)
/* handle Lion's default key combo for fullscreen-toggle in addition to our own hotkeys */
if( key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask )
{ {
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; key = [[characters lowercaseString] characterAtIndex: 0];
return YES;
}
if( !b_force ) /* handle Lion's default key combo for fullscreen-toggle in addition to our own hotkeys */
{ if( key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask )
switch( key )
{ {
case NSDeleteCharacter: [[VLCCoreInteraction sharedInstance] toggleFullscreen];
case NSDeleteFunctionKey: return YES;
case NSDeleteCharFunctionKey:
case NSBackspaceCharacter:
case NSUpArrowFunctionKey:
case NSDownArrowFunctionKey:
case NSRightArrowFunctionKey:
case NSLeftArrowFunctionKey:
case NSEnterCharacter:
case NSCarriageReturnCharacter:
return NO;
} }
}
if( key == 0x0020 ) // space key if( !b_force )
{ {
[[VLCCoreInteraction sharedInstance] play]; switch( key )
return YES; {
} case NSDeleteCharacter:
case NSDeleteFunctionKey:
case NSDeleteCharFunctionKey:
case NSBackspaceCharacter:
case NSUpArrowFunctionKey:
case NSDownArrowFunctionKey:
case NSRightArrowFunctionKey:
case NSLeftArrowFunctionKey:
case NSEnterCharacter:
case NSCarriageReturnCharacter:
return NO;
}
}
val.i_int |= CocoaKeyToVLC( key ); if( key == 0x0020 ) // space key
{
[[VLCCoreInteraction sharedInstance] play];
return YES;
}
BOOL b_found_key = NO; val.i_int |= CocoaKeyToVLC( key );
for( int i = 0; i < [o_usedHotkeys count]; i++ )
{ BOOL b_found_key = NO;
NSString *str = [o_usedHotkeys objectAtIndex: i]; for( int i = 0; i < [o_usedHotkeys count]; i++ )
unsigned int i_keyModifiers = [self VLCModifiersToCocoa: str];
if( [[[o_event charactersIgnoringModifiers] lowercaseString] isEqualToString: [self VLCKeyToString: str]] &&
(i_keyModifiers & NSShiftKeyMask) == (i_pressed_modifiers & NSShiftKeyMask) &&
(i_keyModifiers & NSControlKeyMask) == (i_pressed_modifiers & NSControlKeyMask) &&
(i_keyModifiers & NSAlternateKeyMask) == (i_pressed_modifiers & NSAlternateKeyMask) &&
(i_keyModifiers & NSCommandKeyMask) == (i_pressed_modifiers & NSCommandKeyMask) )
{ {
b_found_key = YES; NSString *str = [o_usedHotkeys objectAtIndex: i];
break; unsigned int i_keyModifiers = [self VLCModifiersToCocoa: str];
if( [[characters lowercaseString] isEqualToString: [self VLCKeyToString: str]] &&
(i_keyModifiers & NSShiftKeyMask) == (i_pressed_modifiers & NSShiftKeyMask) &&
(i_keyModifiers & NSControlKeyMask) == (i_pressed_modifiers & NSControlKeyMask) &&
(i_keyModifiers & NSAlternateKeyMask) == (i_pressed_modifiers & NSAlternateKeyMask) &&
(i_keyModifiers & NSCommandKeyMask) == (i_pressed_modifiers & NSCommandKeyMask) )
{
b_found_key = YES;
break;
}
} }
}
if( b_found_key ) if( b_found_key )
{ {
var_SetInteger( p_intf->p_libvlc, "key-pressed", val.i_int ); var_SetInteger( p_intf->p_libvlc, "key-pressed", val.i_int );
return YES; return YES;
}
} }
return NO; return NO;
...@@ -1427,7 +1431,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1427,7 +1431,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
} }
} }
module_config_free (p_config); module_config_free (p_config);
if( o_usedHotkeys ) if( o_usedHotkeys )
[o_usedHotkeys release]; [o_usedHotkeys release];
o_usedHotkeys = [[NSArray alloc] initWithArray: o_tempArray copyItems: YES]; o_usedHotkeys = [[NSArray alloc] initWithArray: o_tempArray copyItems: YES];
...@@ -1444,7 +1448,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1444,7 +1448,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
if (b_nativeFullscreenMode) if (b_nativeFullscreenMode)
{ {
// this is called twice in certain situations, so only toogle if we really need to // this is called twice in certain situations, so only toogle if we really need to
if( ( b_fullscreen && !([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen) ) || if( ( b_fullscreen && !([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen) ) ||
( !b_fullscreen && ([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen) ) ) ( !b_fullscreen && ([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen) ) )
[o_mainwindow toggleFullScreen: self]; [o_mainwindow toggleFullScreen: self];
...@@ -1477,10 +1481,10 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1477,10 +1481,10 @@ unsigned int CocoaKeyToVLC( unichar i_key )
- (void)checkFullscreenChange:(NSNumber *)o_full - (void)checkFullscreenChange:(NSNumber *)o_full
{ {
BOOL b_full = [o_full boolValue]; BOOL b_full = [o_full boolValue];
if( p_intf && !var_GetBool( pl_Get( p_intf ), "fullscreen" ) != !b_full ) if( p_intf && !var_GetBool( pl_Get( p_intf ), "fullscreen" ) != !b_full )
{ {
var_SetBool( pl_Get(p_intf), "fullscreen", b_full ); var_SetBool( pl_Get(p_intf), "fullscreen", b_full );
} }
} }
...@@ -2039,7 +2043,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -2039,7 +2043,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
{ {
if (aTableView == o_msgs_table) if (aTableView == o_msgs_table)
return [o_msg_arr count]; return [o_msg_arr count];
return 0; return 0;
} }
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
......
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