8000 Rectify timeline in Touchbar freezes, #4058 by low-batt · Pull Request #4087 · iina/iina · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Rectify timeline in Touchbar freezes, #4058 #4087

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? 8000 Sign in to your account

Merged
merged 3 commits into from
Mar 22, 2023
Merged

Rectify timeline in Touchbar freezes, #4058 #4087

merged 3 commits into from
Mar 22, 2023

Conversation

low-batt
Copy link
Contributor

This commit will:

  • Add a new method makeTouchBar to PlayerCore
  • Change MainWindowController and MiniPlayerWindowController extensions in TouchBarSupport to call the new method
  • Add a hasTouchBar property to TouchBarSupport
  • Change MainWindowController.hideUI to not stop the timer that synchronizes the UI if the Mac has a touch bar

This corrects a regression added by a change to hideUI to stop the timer when the OSC is hidden in order to save energy. That change failed to take into account that the timer also synchronizes controls in the touch bar on MacBooks that have one.


Description:

This commit will:
- Add a new method makeTouchBar to PlayerCore
- Change MainWindowController and MiniPlayerWindowController extensions
  in TouchBarSupport to call the new method
- Add a hasTouchBar property to TouchBarSupport
- Change MainWindowController.hideUI to not stop the timer that
  synchronizes the UI if the Mac has a touch bar

This corrects a regression added by a change to hideUI to stop the timer
when the OSC is hidden in order to save energy. That change failed to
take into account that the timer also synchronizes controls in the
touch bar on MacBooks that have one.
@low-batt low-batt linked an issue Nov 19, 2022 that may be closed by this pull request
@low-batt low-batt requested review from saagarjha and uiryuu November 19, 2022 02:21
@low-batt
Copy link
Contributor Author

The regression was due to the change that stops the timer that synchronizes the UI when the OSC is hidden in order to save energy. That change failed to take into account that the timer also synchronizes controls in the touch bar on MacBooks that have one.

In trying to correct the regression and yet not run the timer when it is not needed I looked for APIs that would answer:

  • Does the Mac have a touch bar?
  • Is the touch bar configured to show app controls?
  • Is the touch bar awake?
  • Is the MacBook in closed clamshell mode?

Unfortunately Apple thinks there is no need for an application to know if the Mac has a touch bar. From the documentation for NSTouchBar:

There’s no need, and no API, for your app to know whether or not there’s a Touch Bar available. Whether your app is running on a machine that supports the Touch Bar or not, your app’s onscreen user interface (UI) appears and behaves the same way.

I found isVisible was true even when the touch bar was not displaying the application's UI.

So to determine if the Mac has a touch bar the code is checking whether AppKit has called makeTouchBar. This allows the timer to be stopped on Macs that do not have touch bars. This also avoided running the timer when a MacBook with a touch bar is running in closed clamshell mode.

Reviewers, is there a better way to determine if a touch bar is present?

This commit will:
- Change MainWindowController.hideUI to not stop the timer that
  synchronizes the UI if displaying the mini player
- Change PlayerCore.switchToMiniPlayer to ensure the timer is running
  if media is playing
@low-batt
Copy link
Contributor Author

I've added an additional commit that addresses issue #4051 as it involves the same code.

@low-batt low-batt linked an issue Nov 21, 2022 that may be closed by this pull request
1 task
This commit will rename the new hasTouchBar property to needsTouchBar
as recommended by review comment.
@uiryuu uiryuu merged commit b490ed5 into develop Mar 22, 2023
@uiryuu uiryuu deleted the fix-4058 branch March 22, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timeline in Touchbar freezes [UI]Playback/Timebar freezes at the start while playing any audio file
3 participants
0