Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix playback history window doesn't respect reduce motion, #4870 #4871

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions iina.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
49542982216C34950058F680 /* ToolbarItemIcon.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 49542981216C34950058F680 /* ToolbarItemIcon.pdf */; };
49542986216C34950058F680 /* OpenInIINA.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 49542973216C34950058F680 /* OpenInIINA.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
496B19921E2968530035AF10 /* PIP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 496B19911E2968530035AF10 /* PIP.framework */; };
512B8FDD2BC2376E00AF41BF /* OutlineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512B8FDC2BC2376E00AF41BF /* OutlineView.swift */; };
513A4FFA29B53F8100A8EA7D /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 513A4FF929B53F8100A8EA7D /* Atomic.swift */; };
515B5E5A2A579903001FCD49 /* iina-plugin in Copy Executables */ = {isa = PBXBuildFile; fileRef = E38558872A484A2D0083772D /* iina-plugin */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
5196819A29EC963F00B05D55 /* CoreDisplay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5196819929EC963F00B05D55 /* CoreDisplay.framework */; };
Expand Down Expand Up @@ -880,6 +881,7 @@
4964988E2919E47900CD61A5 /* OpenInIINA.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = OpenInIINA.xcconfig; sourceTree = "<group>"; };
496B19911E2968530035AF10 /* PIP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PIP.framework; path = /System/Library/PrivateFrameworks/PIP.framework; sourceTree = "<group>"; };
49F7E3BF2920D65C002DA28E /* Availability.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Availability.xcconfig; sourceTree = "<group>"; };
512B8FDC2BC2376E00AF41BF /* OutlineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OutlineView.swift; sourceTree = "<group>"; };
513A4FF929B53F8100A8EA7D /* Atomic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = "<group>"; };
51537C7229FA26DD00F9A472 /* Nightly.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Nightly.xcconfig; sourceTree = "<group>"; };
5158FAB429F881B000F626E6 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2385,6 +2387,7 @@
E32712B424F2B8CA00359DAB /* ScreenshootOSDView.xib */,
E3958563253133E80096811F /* SidebarTabView.swift */,
E3958564253133E80096811F /* SidebarTabView.xib */,
512B8FDC2BC2376E00AF41BF /* OutlineView.swift */,
);
name = Accessories;
sourceTree = "<group>";
Expand Down Expand Up @@ -2993,6 +2996,7 @@
841B14281E941DFF00744AB8 /* TimeLabelOverflowedStackView.swift in Sources */,
E33BA5C7204BD9FE0069A0F6 /* SubChooseViewController.swift in Sources */,
51CACB9529D500290034CEE5 /* VideoPIPViewController.swift in Sources */,
512B8FDD2BC2376E00AF41BF /* OutlineView.swift in Sources */,
8460FBA91D6497490081841B /* PlaylistViewController.swift in Sources */,
8450404A1E0B13230079C194 /* CropBoxView.swift in Sources */,
84F7258F1D486185000DEF1B /* MPVProperty.swift in Sources */,
Expand Down
28 changes: 17 additions & 11 deletions iina/AccessibilityPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,30 @@ import Foundation

struct AccessibilityPreferences {

/// Adjusts an animation to be instantaneous if the macOS System Preference Reduce motion is enabled.
/// Adjusts an animation to be instantaneous if the IINA setting `Disable animations` is enabled.
/// - Parameter duration: Desired animation duration.
/// - Returns: `0` if reduce motion is enabled; otherwise the given duration.
/// - Returns: `0` if animations have been disabled; otherwise the given duration.
static func adjustedDuration(_ duration: TimeInterval) -> TimeInterval {
return motionReductionEnabled ? 0 : duration
return Preference.bool(for: PK.disableAnimations) ? 0 : duration
}

/// Reflects whether the macOS System Preference accessibility option to retuce motion is in an enabled state.
/// Reflects whether the macOS accessibility setting to reduce motion is in an enabled state.
///
/// This property provides a wrapper around the `NSWorkspace` property so that code that needs to check this preference setting
/// does not need to concern itself with this preference not being available until macOS Sierra.
/// This property provides a wrapper around the `NSWorkspace` property so that code that needs to check this setting does not
/// need to concern itself with this setting not being available until macOS Sierra.
///
/// Proper handling of the Reduce motion preference setting is covered in the
/// [Apple Human Interface Guidelines under Appearance Effects and Motion](https://developer.apple.com/design/human-interface-guidelines/accessibility/overview/appearance-effects/).
///
/// To change this preference, choose Apple menu > System Preferences, click Accessibility, click Display, then click Display and
/// check or uncheck Reduce motion.
/// Proper handling of the Reduce motion setting is covered in the Apple [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/) under
/// [Accessibility - Motion](https://developer.apple.com/design/human-interface-guidelines/accessibility#Motion).
///
/// To enable the
/// [Reduced motion](https://support.apple.com/guide/mac-help/stop-or-reduce-onscreen-motion-mchlc03f57a1/mac)
/// setting:
/// - Click on `System Settings…` under the  menu
/// - The `System Settings` window appears
/// - On the left side of the window click on `Accessibility`
/// - On the right side of the window click on `Display`
/// - In the `Display` section look for the `Reduced motion` setting
/// - Slide the toggle button to be on (blue)
/// - Returns: `true` if reduce motion is enabled; otherwise `false`.
static var motionReductionEnabled: Bool {
if #available(macOS 10.12, *) {
Expand Down
1 change: 1 addition & 0 deletions iina/AppData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct AppData {
static let toneMappingHelpLink = "https://en.wikipedia.org/wiki/Tone_mapping"
static let targetPeakHelpLink = "https://mpv.io/manual/stable/#options-target-peak"
static let algorithmHelpLink = "https://mpv.io/manual/stable/#options-tone-mapping"
static let disableAnimationsHelpLink = "https://developer.apple.com/design/human-interface-guidelines/accessibility#Motion"

static let widthWhenNoVideo = 640
static let heightWhenNoVideo = 360
Expand Down
2 changes: 1 addition & 1 deletion iina/Base.lproj/HistoryWindowController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<rect key="frame" x="1" y="1" width="598" height="266"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" tableStyle="fullWidth" columnReordering="NO" autosaveName="HistoryWindowTable" rowHeight="22" headerView="MiB-ow-W6T" viewBased="YES" indentationPerLevel="12" indentationMarkerFollowsCell="NO" outlineTableColumn="DIC-tR-R2F" id="6jR-CS-fgx" userLabel="PlaybackHistoryTable Outline View">
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" tableStyle="fullWidth" columnReordering="NO" autosaveName="HistoryWindowTable" rowHeight="22" headerView="MiB-ow-W6T" viewBased="YES" indentationPerLevel="12" indentationMarkerFollowsCell="NO" outlineTableColumn="DIC-tR-R2F" id="6jR-CS-fgx" userLabel="PlaybackHistoryTable Outline View" customClass="OutlineView" customModule="IINA" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="606" height="243"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="8" height="2"/>
Expand Down
61 changes: 60 additions & 1 deletion iina/Base.lproj/PrefUIViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<outlet property="pipDoNothing" destination="o7N-Tm-Aly" id="xg5-HZ-Usj"/>
<outlet property="pipHideWindow" destination="BMA-ed-2gf" id="UJv-H3-HDi"/>
<outlet property="pipMinimizeWindow" destination="YWw-1J-3Gr" id="5eN-rl-utd"/>
<outlet property="sectionAccessibilityView" destination="k9o-rY-z6u" id="p0I-TR-Sv6"/>
<outlet property="sectionAppearanceView" destination="M9c-Ak-HmK" id="96r-w6-H5K"/>
<outlet property="sectionOSCView" destination="gjB-It-iFS" id="cbg-O0-qMd"/>
<outlet property="sectionOSDView" destination="c8m-G4-or8" id="e6Y-FN-x1t"/>
Expand Down Expand Up @@ -703,6 +704,7 @@
<constraints>
<constraint firstAttribute="width" constant="18" id="DIC-cT-8P0"/>
<constraint firstAttribute="width" secondItem="2Fc-2d-hIJ" secondAttribute="height" multiplier="1:1" id="IBQ-ee-CQV"/>
<constraint firstAttribute="width" secondItem="2Fc-2d-hIJ" secondAttribute="height" multiplier="1:1" id="JSO-Tj-v8X"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="speed" id="PCr-gs-9Yc"/>
</imageView>
Expand Down Expand Up @@ -774,7 +776,6 @@
<constraint firstItem="HgG-px-UUt" firstAttribute="leading" secondItem="jbc-22-59W" secondAttribute="leading" id="GnR-7V-SWW"/>
<constraint firstItem="jbc-22-59W" firstAttribute="top" secondItem="4XH-GU-VhV" secondAttribute="top" id="H5x-dR-Abd"/>
<constraint firstAttribute="bottom" secondItem="rft-T0-lds" secondAttribute="bottom" constant="8" id="HLQ-xF-5Qa"/>
<constraint firstItem="2Fc-2d-hIJ" firstAttribute="width" secondItem="2Fc-2d-hIJ" secondAttribute="height" multiplier="1:1" id="JSO-Tj-v8X"/>
<constraint firstItem="omS-tS-OVJ" firstAttribute="leading" secondItem="q8D-b2-H0y" secondAttribute="trailing" constant="8" id="Kvt-R8-Efd"/>
<constraint firstItem="omS-tS-OVJ" firstAttribute="leading" secondItem="bYj-5g-zYO" secondAttribute="leading" id="LgY-kh-ww0"/>
<constraint firstItem="gVR-so-xgt" firstAttribute="baseline" secondItem="q8D-b2-H0y" secondAttribute="baseline" id="OEQ-c0-3H3"/>
Expand Down Expand Up @@ -1244,6 +1245,64 @@ Picture:</string>
</constraints>
<point key="canvasLocation" x="14" y="907"/>
</customView>
<customView misplaced="YES" id="k9o-rY-z6u" userLabel="Prefs &gt; UI &gt; Accessibility">
<rect key="frame" x="0.0" y="0.0" width="550" height="90"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField identifier="SectionTitleThumb" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="M1d-6z-urt" userLabel="Accessibility">
<rect key="frame" x="-2" y="70" width="91" height="16"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Accessibility:" id="AYW-Xu-ySw">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button translatesAutoresizingMaskIntoConstraints="NO" id="6DX-Ep-AbS" userLabel="Disable animations">
<rect key="frame" x="118" y="69" width="141" height="18"/>
<buttonCell key="cell" type="check" title="Disable animations" bezelStyle="regularSquare" imagePosition="left" inset="2" id="mjs-jg-wm1">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="lH7-Vv-0M1" name="value" keyPath="values.disableAnimations" id="C94-f2-ocl"/>
</connections>
</button>
<button horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4QU-uL-rQD" userLabel="Disable animations Help Button">
<rect key="frame" x="264" y="64" width="25" height="25"/>
<buttonCell key="cell" type="help" bezelStyle="helpButton" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="tqd-k0-pR0">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="disableAnimationsHelpAction:" target="-2" id="3Su-2O-LKG"/>
</connections>
</button>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="TmI-kk-Nbj">
<rect key="frame" x="118" y="8" width="434" height="56"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="9IR-Sf-wMq">
<font key="font" metaFont="label" size="11"/>
<string key="title">When the macOS Reduce Motion accessibility setting is enabled IINA will reduce user interface animations that are known to cause problems for those with vestibular disorders. Should that be insufficient, this setting can be used to reduce motion further by eliminating user interface animations.</string>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="TmI-kk-Nbj" firstAttribute="leading" secondItem="6DX-Ep-AbS" secondAttribute="leading" id="0an-by-LUR"/>
<constraint firstItem="M1d-6z-urt" firstAttribute="leading" secondItem="k9o-rY-z6u" secondAttribute="leading" id="5UK-qs-t0Z"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="4QU-uL-rQD" secondAttribute="trailing" id="ECi-04-TXI"/>
<constraint firstAttribute="bottom" secondItem="TmI-kk-Nbj" secondAttribute="bottom" constant="8" id="FdL-T8-5LI"/>
<constraint firstItem="4QU-uL-rQD" firstAttribute="leading" secondItem="6DX-Ep-AbS" secondAttribute="trailing" constant="8" id="MER-sj-cma"/>
<constraint firstItem="4QU-uL-rQD" firstAttribute="centerY" secondItem="6DX-Ep-AbS" secondAttribute="centerY" id="Nng-vM-pUe"/>
<constraint firstItem="TmI-kk-Nbj" firstAttribute="top" secondItem="4QU-uL-rQD" secondAttribute="bottom" constant="4" id="T9B-vQ-mWt"/>
<constraint firstItem="M1d-6z-urt" firstAttribute="trailing" relation="lessThanOrEqual" secondItem="k9o-rY-z6u" secondAttribute="leading" constant="120" id="j0m-fh-NoW"/>
<constraint firstItem="6DX-Ep-AbS" firstAttribute="top" secondItem="M1d-6z-urt" secondAttribute="top" id="j8G-1a-rlS"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="TmI-kk-Nbj" secondAttribute="trailing" id="mgO-TO-KgH"/>
<constraint firstItem="M1d-6z-urt" firstAttribute="top" secondItem="k9o-rY-z6u" secondAttribute="top" constant="8" id="nbs-Tz-GDd"/>
<constraint firstItem="6DX-Ep-AbS" firstAttribute="leading" secondItem="k9o-rY-z6u" secondAttribute="leading" constant="120" id="ray-E7-Kek"/>
</constraints>
<point key="canvasLocation" x="49" y="1061.5"/>
</customView>
</objects>
<resources>
<image name="osc_float" width="240" height="135"/>
Expand Down