-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Don't resize on opening media and switching modes #5054
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulled PR, built IINA, tested. Looks good to me.
Looks like some much needed refactoring. Although I for one began to enjoy the zoom animation 😂 |
Known issues: when opening online resources, the window will still resize after the buffering is done. We need a UI to reflect the buffering process. |
Try this:
Expected: The main window appears with the album art. |
@svobs I actually feel nostalgic about the animation. Maybe I'm going to implement a more sleek opening animation and make it an option. |
iina/MainWindowController.swift
Outdated
if player.disableWindowAnimation || Preference.bool(for: .disableAnimations) { | ||
if !player.mainWindow.window!.isVisible && !player.isInMiniPlayer { | ||
window.setFrame(rect, display: false, animate: false) | ||
showWindow(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why put it here in adjustFrameByVideoSize()
? This can be called whenever the video's size is changed.
Consider the following case: I open an IINA window and hide it using Cmd+H. Then it automatically continues to the next video (or some plugin/mpv script changed the video/window size), and this line will show the window unexpectedly.
This commit: - Removed `windowWillOpen()` and moved contents to newly added `override showWindow(_:)` - Removed `windowDidOpen()` and moved contents to the end of `windowDidLoad()` - `PlayerWindowController.windowDidOpen()` also got removed. - Removed code which explicitly shows the main window when opening media and creating the main window - Calls `showWindow(_:)` after the final window geometry is calcuated and set as the window frame Handle entering music mode correctly + cleared up the code
a1ea146
to
9a05b02
Compare
- Changed the method for detecting no album art in mini player - Renamed `notifyMainWindowVideoSizeChanged()` to `notifyWindowVideoSizeChanged()` - Don't try to update video size on tracklistchange, instead, wait for videoreconfig
9a05b02
to
e43510e
Compare
resulting black screen
- Merge `adjustFrameByVideoSize` and `updateVideoSize` into `handleVideoSizeChange` - Move `pendingShow` into `PlayerWindowController` - Set `pendingShow` for both player to true when loading files
Description:
Thanks to #5029, now initiating rendering doesn't require a forced draw to the main window. Previously, IINA first draw the video in a small window, then resize to the desired window size. This PR change the behavior to show the main window after the geometry is calculated, therefore no resizing animation is required, the window will show directly to the final size.
Specifically, this PR:
windowWillOpen()
and moved contents to newly addedoverride showWindow(_:)
windowDidOpen()
and moved contents to the end ofwindowDidLoad()
PlayerWindowController.windowDidOpen()
also got removed.showWindow(_:)
after the final window geometry is calculated and set as the window framewindowWillOpen()
andwindowDidOpen()
are not standard NSWindow functions, and they are easy to be confused with other NSWindow lifecycle functions, so I moved them and move the code into override functions.The current implementation is far from clean, but in order to not refactor too much code, I only made changes to necessary parts. Also I feel the animation for changing modes (music -> normal and reverse) bit clunky and not consistent, but that's not in the scope of this PR.
Demo:
Before:
https://github.com/iina/iina/assets/20237141/241eca90-66b5-47e9-92c1-551316fc1e36
After:
https://github.com/iina/iina/assets/20237141/3ea7629e-38b2-47ba-ba5c-9c36c9707990