fix(windows): changing WebView visibility on hide/show/minimize - #9246
Merged
Conversation
amrbashir
requested changes
Mar 28, 2024
| window: &Window, | ||
| webviews: &[WebviewWrapper], | ||
| ) -> windows::core::Result<()> { | ||
| let is_visible = window.is_visible() && !window.is_minimized(); |
Member
There was a problem hiding this comment.
I think this should be passed is_visible as an argument, because in the case of when calling window.hide() we already know that it is not visible and so we don't need to call window.is_visible()
Contributor
Author
There was a problem hiding this comment.
Ok, but I feel like that will put the responsibility of calculating is_visible to the caller, which is more error prone
amrbashir
approved these changes
Mar 28, 2024
amrbashir
added a commit
that referenced
this pull request
Apr 9, 2024
This fixes a regression introduced in #9246 where previously users would wait for `DOMContentLoaded` before showing the window to avoid having a white flash, also introduce a regression for apps that is hidden by default and is shown on global shortcuts or some other action. Also accoding to the MSDN docs for webview2's `IsVisible` they only recommend to change the webview visibility on when un/minimizing. closes #9393 ref: https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2controller?view=webview2-winrt-1.0.2365.46#isvisible
Legend-Master
added a commit
to Legend-Master/tauri
that referenced
this pull request
Apr 15, 2024
…ze (tauri-apps#9246)" This reverts commit 5bd47b4.
amrbashir
pushed a commit
that referenced
this pull request
Apr 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference: #6864
We need to call
SetIsVisiblemanually according to https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2controller?view=webview2-winrt-1.0.2365.46#isvisibleThis is a quick dirty fix to make it work at least for minimize / restore / show / hide (no fully covered by other windows support yet) (
Resizedfires on minimized and restored, and since we don't have an is visible event yet, the best we can do is to hook onto those methods for now), we probably want to separate this event in https://github.com/tauri-apps/tao (issue tauri-apps/tao#892) in the future