-
-
Notifications
You must be signed in to change notification settings - Fork 686
Implement fullscreen fade control. #292
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
…deTime user default.
// Prefer to get the fade time from preferences, but default to the original time | ||
// if the key doesn't exist yet. | ||
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults]; | ||
if ([[[defaults dictionaryRepresentation] allKeys] containsObject:MMFullScreenFadeTimeKey]) { |
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.
I think we can set default value in https://github.com/macvim-dev/macvim/blob/master/src/MacVim/MMAppController.m#L185-L219?
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.
Yes, that would be way better.
// Each fade goes in and then out, so the fade hardware must be reserved accordingly and the | ||
// actual fade time can't exceed half the allowable reservation time... plus some slack to | ||
// prevent visual artifacts caused by defaulting on the fade hardware lease. | ||
if (fadeTime > 0.45 * kCGMaxDisplayReservationInterval) { |
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.
fadeTime = MAX(fadeTime, 0.45 * kCGMaxDisplayReservationInterval);
like https://github.com/macvim-dev/macvim/blob/master/src/gui_gtk_x11.c#L5083? It might need extra include though.
👍 |
Thank you! |
For native fullscreen, simply remove the custom animation as it doesn't look good and doesn't look native. This was added back when resizing the window rapidly would result in artifacts, but they should have all been fixed. As such, no need to hide everything under a black fade. TODO: - Closing windows while in native fullscreen doesn't work - Investigate if I can give a "no-animation" option. - Test / TODO: - Border-less -> full screen (success and fail) - Look into fuopts - Clean up misc cleanups like didFailTOExit has a lot of junk there - Decide on orderOut vs close. - Look into the whole maximizeWindow commented out shit - Cmd-N while in full screen already doesn't work. For custom fullscreen, make it so that if `MMFullScreenFadeTime` is set to 0 (which is now the default), the fading animation will simply not be drawn as it simply flickers. Since it now defaults to 0, the user will have to manually set this back to 0.25 to get the old functionality, which is ok as it's somewhat a legacy feature anyway and there shouldn't be any flickering now during the transition. Also, update documentation on full-screen to provide more info on native vs custom, and clean up old outdated texts. Misc driveby fixes related to full screen: - Robustify the Touch Bar full screen button to listen to `OptionSet` event which is more robust than relying on `VimResized`, which also didn't work when 'fuoptions' is set to nothing. - Make MacVim handle the DidFailToEnter/ExitFullScreen events better. These events could fire when using native full screen while the user is e.g. switching space. We need to make sure to properly update the states when these two events happen and let Vim know what the current `'fullscreen'` state is so both sides are synced. - Fix up the preferences pane's full screen buttons to not trigger fontPropertiesChanged which was a mistake due to copy-and-paste in Interface Builder. See: - macvim-dev#292 / macvim-dev#289 which implemented the fade effect.
For native fullscreen, simply remove the custom animation as it doesn't look good and doesn't look native. This was added back when resizing the window rapidly would result in artifacts, but they should have all been fixed. As such, no need to hide everything under a black fade. For custom fullscreen, make it so that if `MMFullScreenFadeTime` is set to 0 (which is now the default), the fading animation will simply not be drawn as it simply flickers. Since it now defaults to 0, the user will have to manually set this back to 0.25 to get the old functionality, which is ok as it's somewhat a legacy feature anyway and there shouldn't be any flickering now during the transition. Also, update documentation on full-screen to provide more info on native vs custom, and clean up old outdated texts. Misc driveby fixes related to full screen: - Robustify the Touch Bar full screen button to listen to `OptionSet` event which is more robust than relying on `VimResized`, which also didn't work when 'fuoptions' is set to nothing. - Make MacVim handle the DidFailToEnter/ExitFullScreen events better. These events could fire when using native full screen while the user is e.g. switching space. We need to make sure to properly update the states when these two events happen and let Vim know what the current `'fullscreen'` state is so both sides are synced. - Fix up the preferences pane's full screen buttons to not trigger fontPropertiesChanged which was a mistake due to copy-and-paste in Interface Builder. See: - macvim-dev#292 / macvim-dev#289 which implemented the fade effect.
This change will let you control the duration of the fullscreen fade in and out used by the non-native fullscreen mode (as requested by #289).
Test with
defaults write org.vim.MacVim MMFullScreenFadeTime 2.0
(or some other floating point value). Valid values are from 0 to approximately 6.75 and are in seconds. The upper limit is determined primarily by the maximum amount of time the OS will let MacVim reserve the display. Values less than 0.2 do work, but tend to not be long enough to hide the window shenanigans MacVim is doing to enable fullscreen and thus "flicker" a little.If
MMFullScreenFadeTime
is not present in defaults, the original default of 0.25 seconds will be used.