Win32: Handle arbitrary DPI awareness context types - #335
Merged
Merged
Conversation
shakey-ltd
added a commit
to shakey-ltd/baseview
that referenced
this pull request
Sep 14, 2026
RustAudio#107's fix (this fork's whole reason for existing) replaced a process-wide SetProcessDpiAwarenessContext call with a thread-scoped one entered right before CreateWindowExW. That's correct for the host-corruption bug it targets, but some AMD/NVIDIA Windows GPU drivers misbehave specifically when SetThreadDpiAwarenessContext is called immediately before creating a window that will get an OpenGL context -- the rendered output comes out corrupted/mis-scaled. This is RustAudio#321 upstream, fixed there via RustAudio#335 (merged into baseview 0.3.4) by having OpenGL windows skip explicit thread/process DPI-awareness calls entirely and just inherit whatever the host process already declared for itself. Upstream's fix lives in a much larger DpiScalingStrategy abstraction introduced by a full platform-code refactor that doesn't exist on this pre-refactor 0.1.0 line, so it's not directly portable. This ports the same conceptual fix onto our simpler ThreadDpiAwarenessScope: skip entering the scope when the window being created wants an OpenGL context (options.gl_config.is_some()), leaving non-GL windows unaffected. Verified: cargo check --target x86_64-pc-windows-gnu, both with --features opengl and --no-default-features. Not yet verified against real Windows GPU hardware (the actual bug only reproduces on real AMD/ NVIDIA drivers, not CI/virtual GPUs, per upstream's own findings). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZNfuUKgDJnCV5wXU1xoAx
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.
Fixes #307, and possibly even #321