RustAudio / baseview

low-level window system interface for audio plugin UIs
Apache License 2.0
259 stars 54 forks source link

Win32: Refactor, split off and fix resize logic and DPI changes handling #178

Open prokopyl opened 3 months ago

prokopyl commented 3 months ago

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 Win32Window type, which only handles translating baseview types and assumptions into Win32 calls, 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_info into two separate components, current_size (physical) and current_scale_factor, which are instead updated independently during their respective events.

Incidentally, this PR also fixes a few bugs:

This has all been tested on my Windows 10 machine and works as expected.