Skip to content

Fix top of progress bar not behaving as such, #3911 #3915

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

Merged
merged 1 commit into from
Oct 21, 2022

Conversation

low-batt
Copy link
Contributor

The commit in the pull request will:

  • Change MainWindowController methods playSliderChanges and
    updateTimeLabel to position the time preview relative to the progress
    bar
  • Add method canShowThumbnailAbove to MainWindowController
  • Change updateTimeLabel to use canShowThumbnailAbove
  • Change PlaySliderCell.awakeFromNib to set slider control size to small
    for macOS 11+
  • Increase bottom and top constraints around progress bar from 4.5 to 6

These changes stop the time preview from intruding into the progress bar
in the on screen controller.


Description:
Correct regression introduced by Big Sur.

The commit in the pull request will:
- Change MainWindowController methods playSliderChanges and
  updateTimeLabel to position the time preview relative to the progress
  bar
- Add method canShowThumbnailAbove to MainWindowController
- Change updateTimeLabel to use canShowThumbnailAbove
- Change PlaySliderCell.awakeFromNib to set slider control size to small
  for macOS 11+
- Increase bottom and top constraints around progress bar from 4.5 to 6

These changes stop the time preview from intruding into the progress bar
in the on screen controller.
@low-batt
Copy link
Contributor Author

See the issue for a detailed discussion of the issue and the proposed fix.

Copy link
Member

@saagarjha saagarjha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another comment I have is that it seems like the text field should just have user interaction disabled

///
/// Normally the OSC's thumbnail preview is shown above the time preview. This is the preferred location. However the
/// thumbnail preview extends beyond the frame of the OSC. If the OSC is near the top of the window this could result
/// in the thumbnail extending outside of the window resulting in clipping. This method checks if there is room for the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the long-term solution here would be to pull the thumbnail into its own window.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the text field and user interaction, in Xcode the behavior attribute, which can be selectable, editable or none, is set to none. I think user interaction is already disabled? So the mouse click goes up the responder chain and is handled by ControlBarView.

If the thumbnail was it its own window how would what work in full screen mode?

And of course I ignored the question of whether IINA should increase the size of its sliders in the spirt of Apple's Big Sur changes. For this fix I tried to make the minimum changes required to restore what I think was the intended behavior. Part of the reason for limiting the fix is due to my lack of UI experience.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, my understanding is that if the view does not have user interaction enabled it should just remove itself from hit testing, causing whatever's under it to get the event. Is that not happening?

Also, there are various window flags that allow windows to show up in fullscreen mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a UIView hitTest method. Not sure what the equivalent AppKit method is. That method does take into account the state of user interactions:

This method ignores view objects that are hidden, that have disabled user interactions, or have an alpha level less than 0.01.

However I have not found anything about the mouse event being delivered to the view underneath. The UIKit method refers to traversing the view higharchy. In the case at hand the superview is the OSC. This results in the mouseDown method of ControlBarView being called which initiates dragging of the OSC. That was as far as I traced the behavior as I realized the intention was that these OSC elements not overlap.

On converting the screenshot preview to use a NSWindow, although I am usually in favor of adding some cleanup/refactoring in this case I'd rather postpone that past the planned bug fix release. There are a lot of issues that it would be nice to fix in the bug fix release that still need PRs. For example issue #3863. I've tracked down what is going wrong. I was hoping to hear why the code is treating the OSC as a part of the title bar before I remove that. And of course I really need to get back to reviewing the plugin system as that is blocking the creation of PRs to avoid generating merge conflicts.

If you really want me to I'll see if I can switch screenshot previews to use a NSWindow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found the AppKit hitTest method. Unlike the UIKit method the documentation for the AppKit method only mentions ignoring hidden views, nothing about user interaction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll ask around but I would be very surprised if views that have user interaction disabled do anything meaningful on clicks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I used hitTest in the plugin overlay view:

override func hitTest(_ point: NSPoint) -> NSView? {

Overriding this method and returning nil should disable all interactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But no need to do that for this issue?

The root cause of the problem is the miss-alignment of UI components caused by Apple increasing the size of sliders in Big Sur. Everything works as intended once the alignment problems are corrected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be sure to look at the screenshots in the issue. They show the OSC before the changes in this commit and after.

@low-batt low-batt linked an issue Oct 19, 2022 that may be closed by this pull request
@uiryuu
Copy link
Member

uiryuu commented Oct 21, 2022

Tested on macOS 10.15, seems fine.

@uiryuu uiryuu merged commit d9c7768 into iina:develop Oct 21, 2022
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.

Top of progress bar not behaving as such
4 participants