[vlc-commits] macosx: Fix width resizing for simple prefs window on OSX lion
David Fuhrmann
git at videolan.org
Sun Jan 7 20:03:32 CET 2018
vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun Jan 7 19:15:40 2018 +0100| [0cdacf2b9012611ac30c2175344e872cbf974df2] | committer: David Fuhrmann
macosx: Fix width resizing for simple prefs window on OSX lion
Add workaround for Lion to respect with-resizing behaviour for
simple prefs window. Disable max-width for window, as this causes
flickering on Lion.
refs #19424
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=0cdacf2b9012611ac30c2175344e872cbf974df2
---
modules/gui/macosx/UI/SimplePreferences.xib | 19 +++++++++----------
modules/gui/macosx/VLCSimplePrefsController.m | 11 +++++++++--
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/modules/gui/macosx/UI/SimplePreferences.xib b/modules/gui/macosx/UI/SimplePreferences.xib
index b8059a115e..653fe04688 100644
--- a/modules/gui/macosx/UI/SimplePreferences.xib
+++ b/modules/gui/macosx/UI/SimplePreferences.xib
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="17C88" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<development version="7000" identifier="xcode"/>
@@ -164,7 +164,6 @@
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="105" y="903" width="580" height="620"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
- <value key="maxSize" type="size" width="580" height="1400"/>
<view key="contentView" id="2266">
<rect key="frame" x="0.0" y="0.0" width="580" height="620"/>
<autoresizingMask key="autoresizingMask"/>
@@ -180,10 +179,10 @@
</view>
</subviews>
<constraints>
- <constraint firstAttribute="bottom" secondItem="HOX-DS-Fgr" secondAttribute="bottom" priority="50" id="K7G-L9-E1u"/>
- <constraint firstItem="HOX-DS-Fgr" firstAttribute="leading" secondItem="ecH-Hh-jJF" secondAttribute="leading" id="SGZ-aS-bLe"/>
- <constraint firstItem="HOX-DS-Fgr" firstAttribute="top" secondItem="ecH-Hh-jJF" secondAttribute="top" id="d18-94-8pD"/>
- <constraint firstAttribute="trailing" secondItem="HOX-DS-Fgr" secondAttribute="trailing" id="nkd-2f-qUW"/>
+ <constraint firstAttribute="bottom" secondItem="HOX-DS-Fgr" secondAttribute="bottom" priority="5" id="7ew-2Y-7ct"/>
+ <constraint firstAttribute="trailing" secondItem="HOX-DS-Fgr" secondAttribute="trailing" id="8GE-iX-VYW"/>
+ <constraint firstItem="HOX-DS-Fgr" firstAttribute="top" secondItem="ecH-Hh-jJF" secondAttribute="top" id="Chc-4R-C0j"/>
+ <constraint firstItem="HOX-DS-Fgr" firstAttribute="leading" secondItem="ecH-Hh-jJF" secondAttribute="leading" id="Cr6-OY-NmH"/>
</constraints>
<color key="backgroundColor" name="controlHighlightColor" catalog="System" colorSpace="catalog"/>
</clipView>
@@ -194,8 +193,8 @@
<rect key="frame" x="-100" y="-100" width="568" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
- <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="5eR-1v-88a">
- <rect key="frame" x="553" y="1" width="16" height="298"/>
+ <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="0.5" horizontal="NO" id="5eR-1v-88a">
+ <rect key="frame" x="563" y="1" width="16" height="573"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
@@ -1963,7 +1962,7 @@ Gw
<rect key="frame" x="20" y="60" width="530" height="311"/>
<clipView key="contentView" id="EbT-aN-Pgg">
<rect key="frame" x="1" y="0.0" width="528" height="310"/>
- <autoresizingMask key="autoresizingMask"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" emptySelection="NO" autosaveName="sprefs_hotkeys_view" headerView="3541" id="2670">
<rect key="frame" x="0.0" y="0.0" width="528" height="287"/>
@@ -2086,7 +2085,7 @@ Gw
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="2800">
- <rect key="frame" x="151" y="76" width="138" height="18"/>
+ <rect key="frame" x="152" y="76" width="137" height="18"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="center" title="${PRESSED_KEYS}" usesSingleLineMode="YES" id="3530">
<font key="font" metaFont="systemBold" size="14"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
diff --git a/modules/gui/macosx/VLCSimplePrefsController.m b/modules/gui/macosx/VLCSimplePrefsController.m
index 59d2372641..4a4f34dadf 100644
--- a/modules/gui/macosx/VLCSimplePrefsController.m
+++ b/modules/gui/macosx/VLCSimplePrefsController.m
@@ -186,6 +186,13 @@ static NSString* VLCHotkeysSettingToolbarIdentifier = @"Hotkeys Settings Item Id
/* setup useful stuff */
_hotkeysNonUseableKeys = [NSArray arrayWithObjects:@"Command-c", @"Command-x", @"Command-v", @"Command-a", @"Command-," , @"Command-h", @"Command-Alt-h", @"Command-Shift-o", @"Command-o", @"Command-d", @"Command-n", @"Command-s", @"Command-l", @"Command-r", @"Command-3", @"Command-m", @"Command-w", @"Command-Shift-w", @"Command-Shift-c", @"Command-Shift-p", @"Command-i", @"Command-e", @"Command-Shift-e", @"Command-b", @"Command-Shift-m", @"Command-Ctrl-m", @"Command-?", @"Command-Alt-?", @"Command-Shift-f", nil];
+
+ // Workaround for Mac OS X Lion, which does not apply the same constraints when set in IB
+ NSView *clipView = _contentView.superview;
+
+ NSDictionary *views = @{ @"view": _contentView };
+ NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|[view]|" options:0 metrics:nil views:views];
+ [clipView addConstraints:constraints];
}
#define CreateToolbarItem(name, desc, img, sel) \
@@ -1060,9 +1067,9 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
[_contentView addSubview:categoryView];
NSDictionary *views = @{ @"view": categoryView };
- NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|[view]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:views];
+ NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|[view]|" options:0 metrics:nil views:views];
[_contentView addConstraints:constraints];
- constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:views];
+ constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:0 metrics:nil views:views];
[_contentView addConstraints:constraints];
[_scrollView layoutSubtreeIfNeeded];
More information about the vlc-commits
mailing list