Win32: Refactor, split off and fix resize logic and DPI changes handling#178
Open
prokopyl wants to merge 2 commits intoRustAudio:masterfrom
Open
Win32: Refactor, split off and fix resize logic and DPI changes handling#178prokopyl wants to merge 2 commits intoRustAudio:masterfrom
prokopyl wants to merge 2 commits intoRustAudio:masterfrom
Conversation
25e486d to
0188f83
Compare
0188f83 to
f512d2a
Compare
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.
This PR refactors and splits off the logic that handles re-sizing and discovering/updating the window's DPI.
Some of that logic is split off into a new, low-level
Win32Windowtype, which only handles translating baseview types and assumptions intoWin32calls, separately from managing events or the window handler.This is part of the effort to split up #174 into smaller pieces.
This PR actually changes the logic, mainly by also splitting the internal
window_infointo two separate components,current_size(physical) andcurrent_scale_factor, which are instead updated independently during their respective events.Incidentally, this PR also fixes a few bugs:
WM_DPICHANGEevent triggering a window resize but not triggering a resize event in the window handler. This supersedes the work done in Fix WM_DPICHANGED not triggering Resized event #140.WM_DPICHANGEevent to use the OS-provided window dimensions and position, instead of computing our own dimensions and leaving the position as-is. This avoids a DPI-change loop due to the window constantly switching between two monitors as it's being dragged across them using the mouse.This has all been tested on my Windows 10 machine and works as expected.