[vlc-commits] [Git][videolan/vlc][master] macosx: replace deprecated NS*KeyMask constants with NSEventModifierFlag variants
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Apr 17 12:41:09 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
3d0b82e8 by Serhii Bykov at 2026-04-17T11:38:58+00:00
macosx: replace deprecated NS*KeyMask constants with NSEventModifierFlag variants
- - - - -
8 changed files:
- modules/gui/macosx/coreinteraction/VLCHotkeysController.m
- modules/gui/macosx/extensions/NSString+Helpers.m
- modules/gui/macosx/library/VLCLibraryCollectionView.m
- modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m
- modules/gui/macosx/menus/VLCMainMenu.m
- modules/gui/macosx/preferences/VLCHotkeyChangeWindow.m
- modules/gui/macosx/windows/video/VLCVoutView.m
- modules/video_output/window_macosx.m
Changes:
=====================================
modules/gui/macosx/coreinteraction/VLCHotkeysController.m
=====================================
@@ -87,13 +87,13 @@
i_pressed_modifiers = [anEvent modifierFlags];
- if (i_pressed_modifiers & NSShiftKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagShift)
val.i_int |= KEY_MODIFIER_SHIFT;
- if (i_pressed_modifiers & NSControlKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagControl)
val.i_int |= KEY_MODIFIER_CTRL;
- if (i_pressed_modifiers & NSAlternateKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagOption)
val.i_int |= KEY_MODIFIER_ALT;
- if (i_pressed_modifiers & NSCommandKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagCommand)
val.i_int |= KEY_MODIFIER_COMMAND;
NSString *characters = [anEvent charactersIgnoringModifiers];
@@ -108,7 +108,7 @@
}
}
/* 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) {
+ else if (key == 'f' && i_pressed_modifiers & NSEventModifierFlagControl && i_pressed_modifiers & NSEventModifierFlagCommand) {
[playerController toggleFullscreen];
} else if (p_vout) {
val.i_int |= (int)CocoaKeyToVLC(key);
@@ -157,10 +157,10 @@
NSString *characters = [anEvent charactersIgnoringModifiers];
if ([characters length] > 0) {
return [[characters lowercaseString] isEqualToString: vlcKeyString] &&
- (keyModifiers & NSShiftKeyMask) == ([anEvent modifierFlags] & NSShiftKeyMask) &&
- (keyModifiers & NSControlKeyMask) == ([anEvent modifierFlags] & NSControlKeyMask) &&
- (keyModifiers & NSAlternateKeyMask) == ([anEvent modifierFlags] & NSAlternateKeyMask) &&
- (keyModifiers & NSCommandKeyMask) == ([anEvent modifierFlags] & NSCommandKeyMask);
+ (keyModifiers & NSEventModifierFlagShift) == ([anEvent modifierFlags] & NSEventModifierFlagShift) &&
+ (keyModifiers & NSEventModifierFlagControl) == ([anEvent modifierFlags] & NSEventModifierFlagControl) &&
+ (keyModifiers & NSEventModifierFlagOption) == ([anEvent modifierFlags] & NSEventModifierFlagOption) &&
+ (keyModifiers & NSEventModifierFlagCommand) == ([anEvent modifierFlags] & NSEventModifierFlagCommand);
}
return NO;
}
@@ -203,16 +203,16 @@
val.i_int = 0;
i_pressed_modifiers = [o_event modifierFlags];
- if (i_pressed_modifiers & NSControlKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagControl)
val.i_int |= KEY_MODIFIER_CTRL;
- if (i_pressed_modifiers & NSAlternateKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagOption)
val.i_int |= KEY_MODIFIER_ALT;
- if (i_pressed_modifiers & NSShiftKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagShift)
val.i_int |= KEY_MODIFIER_SHIFT;
- if (i_pressed_modifiers & NSCommandKeyMask)
+ if (i_pressed_modifiers & NSEventModifierFlagCommand)
val.i_int |= KEY_MODIFIER_COMMAND;
NSString * characters = [o_event charactersIgnoringModifiers];
@@ -220,7 +220,7 @@
key = [[characters lowercaseString] characterAtIndex: 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) {
+ if (key == 'f' && i_pressed_modifiers & NSEventModifierFlagControl && i_pressed_modifiers & NSEventModifierFlagCommand) {
[VLCMain.sharedInstance.playQueueController.playerController toggleFullscreen];
return YES;
}
@@ -248,10 +248,10 @@
unsigned int i_keyModifiers = VLCModifiersToCocoa((char *)str);
if ([[characters lowercaseString] isEqualToString:VLCKeyToString((char *)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)) {
+ (i_keyModifiers & NSEventModifierFlagShift) == (i_pressed_modifiers & NSEventModifierFlagShift) &&
+ (i_keyModifiers & NSEventModifierFlagControl) == (i_pressed_modifiers & NSEventModifierFlagControl) &&
+ (i_keyModifiers & NSEventModifierFlagOption) == (i_pressed_modifiers & NSEventModifierFlagOption) &&
+ (i_keyModifiers & NSEventModifierFlagCommand) == (i_pressed_modifiers & NSEventModifierFlagCommand)) {
b_found_key = YES;
break;
}
=====================================
modules/gui/macosx/extensions/NSString+Helpers.m
=====================================
@@ -550,13 +550,13 @@ unsigned int VLCModifiersToCocoa(char *theChar)
unsigned int new = 0;
if (strstr(theChar, "Command") != NULL)
- new |= NSCommandKeyMask;
+ new |= NSEventModifierFlagCommand;
if (strstr(theChar, "Alt") != NULL)
- new |= NSAlternateKeyMask;
+ new |= NSEventModifierFlagOption;
if (strstr(theChar, "Shift") != NULL)
- new |= NSShiftKeyMask;
+ new |= NSEventModifierFlagShift;
if (strstr(theChar, "Ctrl") != NULL)
- new |= NSControlKeyMask;
+ new |= NSEventModifierFlagControl;
return new;
}
=====================================
modules/gui/macosx/library/VLCLibraryCollectionView.m
=====================================
@@ -44,7 +44,7 @@ NSString * const VLCLibraryCollectionViewItemAdjustmentSmaller = @"VLCLibraryCol
{
if (![self.collectionViewLayout isKindOfClass:VLCLibraryCollectionViewFlowLayout.class] ||
![self.delegate isKindOfClass:VLCLibraryCollectionViewDelegate.class] ||
- !(event.modifierFlags & NSCommandKeyMask)) {
+ !(event.modifierFlags & NSEventModifierFlagCommand)) {
return;
}
=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m
=====================================
@@ -230,9 +230,9 @@ NSString *VLCMediaSourceCellIdentifier = @"VLCLibraryCellIdentifier";
- (void)mouseDown:(NSEvent *)event
{
- if (event.modifierFlags & NSControlKeyMask) {
+ if (event.modifierFlags & NSEventModifierFlagControl) {
[self openContextMenu:event];
- } else if (event.modifierFlags & (NSShiftKeyMask | NSCommandKeyMask)) {
+ } else if (event.modifierFlags & (NSEventModifierFlagShift | NSEventModifierFlagCommand)) {
self.selected = !self.selected;
} else {
[super mouseDown:event];
=====================================
modules/gui/macosx/menus/VLCMainMenu.m
=====================================
@@ -995,7 +995,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
- (void)selectTrack:(NSMenuItem *)sender
{
NSEvent *currentEvent = [NSApp currentEvent];
- [_playerController selectTrack:[sender representedObject] exclusively:!(currentEvent.modifierFlags & NSAlternateKeyMask)];
+ [_playerController selectTrack:[sender representedObject] exclusively:!(currentEvent.modifierFlags & NSEventModifierFlagOption)];
}
- (void)unselectTrackCategory:(NSMenuItem *)sender
=====================================
modules/gui/macosx/preferences/VLCHotkeyChangeWindow.m
=====================================
@@ -51,13 +51,13 @@
NSUInteger i_modifiers = [theEvent modifierFlags];
/* modifiers */
- if (i_modifiers & NSCommandKeyMask)
+ if (i_modifiers & NSEventModifierFlagCommand)
[tempString appendString:@"Command-"];
- if (i_modifiers & NSControlKeyMask)
+ if (i_modifiers & NSEventModifierFlagControl)
[tempString appendString:@"Ctrl-"];
- if (i_modifiers & NSShiftKeyMask)
+ if (i_modifiers & NSEventModifierFlagShift)
[tempString appendString:@"Shift-"];
- if (i_modifiers & NSAlternateKeyMask)
+ if (i_modifiers & NSEventModifierFlagOption)
[tempString appendString:@"Alt-"];
/* non character keys */
=====================================
modules/gui/macosx/windows/video/VLCVoutView.m
=====================================
@@ -162,7 +162,7 @@
- (void)mouseDown:(NSEvent *)o_event
{
- if (([o_event type] == NSEventTypeLeftMouseDown) && (! ([o_event modifierFlags] & NSControlKeyMask))) {
+ if (([o_event type] == NSEventTypeLeftMouseDown) && (! ([o_event modifierFlags] & NSEventModifierFlagControl))) {
if (o_event.clickCount == 1) {
vlc_mutex_lock(&_mutex);
if (_wnd) {
@@ -174,7 +174,7 @@
}
} else if (([o_event type] == NSEventTypeRightMouseDown) ||
(([o_event type] == NSEventTypeLeftMouseDown) &&
- ([o_event modifierFlags] & NSControlKeyMask))) {
+ ([o_event modifierFlags] & NSEventModifierFlagControl))) {
[NSMenu popUpContextMenu: VLCMain.sharedInstance.mainMenu.voutMenu withEvent: o_event forView: self];
}
=====================================
modules/video_output/window_macosx.m
=====================================
@@ -492,7 +492,7 @@ NS_ASSUME_NONNULL_BEGIN
{
@synchronized(self) {
if (event.type == NSEventTypeLeftMouseDown &&
- !(event.modifierFlags & NSControlKeyMask) &&
+ !(event.modifierFlags & NSEventModifierFlagControl) &&
event.clickCount == 1) {
[_moduleDelegate reportMousePressed:MOUSE_BUTTON_LEFT];
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3d0b82e818cf4a11cbce36e015e8b5cfe2b9247d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3d0b82e818cf4a11cbce36e015e8b5cfe2b9247d
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list