[vlc-commits] [Git][videolan/vlc][master] macosx: Fix menu offsets on Big Sur and later
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Fri Dec 30 14:54:56 UTC 2022
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
0679ad12 by Dave Nicolson at 2022-12-30T14:36:37+00:00
macosx: Fix menu offsets on Big Sur and later
- - - - -
3 changed files:
- modules/gui/macosx/UI/MainMenu.xib
- modules/gui/macosx/menus/VLCMainMenu.h
- modules/gui/macosx/menus/VLCMainMenu.m
Changes:
=====================================
modules/gui/macosx/UI/MainMenu.xib
=====================================
@@ -104,6 +104,7 @@
<outlet property="rate_sld" destination="4597" id="HsT-Rx-eia"/>
<outlet property="rate_slowerLabel" destination="4600" id="vRN-S8-MSb"/>
<outlet property="rate_view" destination="4596" id="MPC-hG-6bj"/>
+ <outlet property="rate_view_offset_constraint" destination="Zdw-tm-Z6L" id="EXY-EB-QXd"/>
<outlet property="record" destination="5137" id="Ka3-jl-auY"/>
<outlet property="rendererMenu" destination="ODg-VN-8Tv" id="3Ox-BO-HyW"/>
<outlet property="rendererMenuItem" destination="wYl-A2-q30" id="obH-UF-FmA"/>
@@ -126,6 +127,7 @@
<outlet property="subtitleSizeSmallerLabel" destination="DE3-cs-bVc" id="74W-Xn-pGS"/>
<outlet property="subtitleSizeTextField" destination="uVr-yv-xcp" id="45Z-1j-gDB"/>
<outlet property="subtitleSizeView" destination="GSo-om-Xt7" id="qOx-XX-QUJ"/>
+ <outlet property="subtitleSizeViewOffsetConstraint" destination="cYQ-Os-xxJ" id="wXc-df-LK6"/>
<outlet property="subtitle_bgcolor" destination="5581" id="moz-G5-DBl"/>
<outlet property="subtitle_bgcolorMenu" destination="5582" id="gPd-5S-3xK"/>
<outlet property="subtitle_bgopacity" destination="5568" id="aPB-o5-iU6"/>
@@ -133,6 +135,7 @@
<outlet property="subtitle_bgopacityLabel_gray" destination="5548" id="NBY-zL-Uln"/>
<outlet property="subtitle_bgopacity_sld" destination="5555" id="NKB-tp-uwe"/>
<outlet property="subtitle_bgopacity_view" destination="5547" id="KR2-v5-OeA"/>
+ <outlet property="subtitle_bgopacity_view_offset_constraint" destination="2NC-Yr-P6e" id="yLP-DA-eVo"/>
<outlet property="subtitle_outlinethickness" destination="5571" id="Zml-NY-nvy"/>
<outlet property="subtitle_outlinethicknessMenu" destination="5572" id="x2V-5T-aCd"/>
<outlet property="subtitle_textcolor" destination="5576" id="RjP-9r-hxv"/>
=====================================
modules/gui/macosx/menus/VLCMainMenu.h
=====================================
@@ -75,6 +75,7 @@
@property (readwrite, weak) IBOutlet NSMenuItem *record;
@property (readwrite, weak) IBOutlet NSMenuItem *rate;
@property (readwrite, weak) IBOutlet NSView *rate_view;
+ at property (readwrite, weak) IBOutlet NSLayoutConstraint *rate_view_offset_constraint;
@property (readwrite, weak) IBOutlet NSTextField *rateLabel;
@property (readwrite, weak) IBOutlet NSTextField *rate_slowerLabel;
@property (readwrite, weak) IBOutlet NSTextField *rate_normalLabel;
@@ -144,6 +145,7 @@
@property (readwrite, weak) IBOutlet NSMenuItem *openSubtitleFile;
@property (readwrite, weak) IBOutlet NSMenuItem *subtitleSize;
@property (readwrite, weak) IBOutlet NSView *subtitleSizeView;
+ at property (readwrite, weak) IBOutlet NSLayoutConstraint *subtitleSizeViewOffsetConstraint;
@property (readwrite, weak) IBOutlet NSTextField *subtitleSizeLabel;
@property (readwrite, weak) IBOutlet NSTextField *subtitleSizeSmallerLabel;
@property (readwrite, weak) IBOutlet NSTextField *subtitleSizeLargerLabel;
@@ -155,6 +157,7 @@
@property (readwrite, weak) IBOutlet NSMenuItem *subtitle_bgcolor;
@property (readwrite, weak) IBOutlet NSMenuItem *subtitle_bgopacity;
@property (readwrite, weak) IBOutlet NSView *subtitle_bgopacity_view;
+ at property (readwrite, weak) IBOutlet NSLayoutConstraint *subtitle_bgopacity_view_offset_constraint;
@property (readwrite, weak) IBOutlet NSTextField *subtitle_bgopacityLabel;
@property (readwrite, weak) IBOutlet NSTextField *subtitle_bgopacityLabel_gray;
@property (readwrite, weak) IBOutlet NSSlider *subtitle_bgopacity_sld;
=====================================
modules/gui/macosx/menus/VLCMainMenu.m
=====================================
@@ -153,6 +153,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
/* configure playback / controls menu */
self.controlsMenu.delegate = self;
+ self.subtitlesMenu.delegate = self;
[_rendererNoneItem setState:NSOnState];
_rendererMenuController = [[VLCRendererMenuController alloc] init];
_rendererMenuController.rendererNoneItem = _rendererNoneItem;
@@ -1862,6 +1863,34 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
{
[_cancelRendererDiscoveryTimer invalidate];
[_rendererMenuController startRendererDiscoveries];
+
+ if (@available(macOS 10.16, *)) {
+
+ const int menuItemOffset = 14;
+ const int menuItemOffsetWithActiveState = 24;
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (menu == self->_controlsMenu) {
+ BOOL controlsMenuHasActiveState = NO;
+ for (NSMenuItem *viewMenuItem in menu.itemArray) {
+ if (viewMenuItem.state == NSControlStateValueOn) {
+ controlsMenuHasActiveState = YES;
+ }
+ }
+
+ if (controlsMenuHasActiveState) {
+ self->_rate_view_offset_constraint.constant = menuItemOffsetWithActiveState;
+ } else {
+ self->_rate_view_offset_constraint.constant = menuItemOffset;
+ }
+ }
+
+ if (menu == self->_subtitlesMenu) {
+ self->_subtitle_bgopacity_view_offset_constraint.constant = menuItemOffset;
+ self->_subtitleSizeViewOffsetConstraint.constant = menuItemOffset;
+ }
+ });
+ }
}
- (void)menuDidClose:(NSMenu *)menu
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0679ad1293792392a82dc2fb3d79c901b4ede149
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0679ad1293792392a82dc2fb3d79c901b4ede149
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list