-
Notifications
You must be signed in to change notification settings - Fork 54
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
Blank page when minimizing a maximized frameless window with multi-monitor setup #2549
Comments
This appears to be an issue with the code snippet, not WebView2. When I swap the WebView2 out for other HWND controls (like buttons), they also disappear when using the provided code snippet. From my debugging through Visual Studio, MonitorFromWindow is returning the wrong monitor when restoring the app to a maximized state. MonitorFromWindow actually can't find the monitor for the HWND, so it is using the MONITOR_DEFAULTTONEAREST default option (if I change the default option to MONITOR_DEFAULTTONULL then MonitorFromWindow returns null in the repro case). In the repro case, this doesn't match the monitor the HWND is on. I noticed MonitorFromWIndow also returns the wrong monitor when the window is maximized and you move the window to another monitor using Win + Shift + Arrow. To fix this, you should use MonitorFromRect and use the provided RECT in the NCCALCSIZE_PARAMS to get the monitor that the HWND will be on. Then you can update the NCCALCSIZE_PARAMS rect with the correct monitor's rcWork.
|
Never thought that |
`MonitorFromWindow` is unreliable with maximized Window, it either can't find a monitor for the window and will default to nearest monitor or it will find a wrong monitor, see MicrosoftEdge/WebView2Feedback#2549 (comment).
* fix(windows): get correct monitor in `WM_NCCALCSIZE`, closes #471 `MonitorFromWindow` is unreliable with maximized Window, it either can't find a monitor for the window and will default to nearest monitor or it will find a wrong monitor, see MicrosoftEdge/WebView2Feedback#2549 (comment). * changefile
MonitorFromWindow is unreliable during a maximize, it might return the wrong monitor for the window or can't find one. MicrosoftEdge/WebView2Feedback#2549
MonitorFromWindow is unreliable during a maximize, it might return the wrong monitor for the window or can't find one. MicrosoftEdge/WebView2Feedback#2549
Description
In a multi-monitor setup, minimizing a maximized frameless Window (created by returning
0
toWM_NCCALCSIZE
) will result in a blank window.Version
SDK: 1.0.902.49
Runtime: 102.0.1245.44
Framework: win32
OS: noticed on win10 and win11
Repro Steps
Screenshots
WebView2_frameless_maximized_window_bug.mp4
Additional context
This was observed by multiple tauri users in tauri-apps/tao#471
The text was updated successfully, but these errors were encountered: