Improve ImGui fractional scaling support - #2614
Open
jaredh wants to merge 2 commits into
Open
Conversation
Author
|
@dotnet-policy-service agree |
jaredh
marked this pull request as draft
September 4, 2026 23:06
jaredh
commented
Sep 5, 2026
Comment on lines
+242
to
+244
| // Update here since Resize isn't raised on all platforms | ||
| _windowWidth = size.X; | ||
| _windowHeight = size.Y; |
Author
There was a problem hiding this comment.
When going fullscreen Resize is fired and the updated window size is correctly reflected, but when returning to windowed mode on Wayland, GLFX does not end up invoking the resize callback so we never end up receiving the updated window dimensions.
jaredh
marked this pull request as ready for review
September 5, 2026 13:59
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.
Summary of the PR
Looking at improving support for Wayland fractional scaling in BlackLabelHQ/RecompOne (issue[1]) has led me to a couple fixes here. Looks like a lot of this is improving in 3.0 with windowing API improvements, but not sure when to expect that to hit GA.
These fixes are reproducible in the ImGui sample app, and seem to stem from deviation from the original C++ port[2][3][4]. The tl;dr is integer division was being performed, truncating fractional values, and never updating the viewport with the framebuffer size. This was resulting in the UI rendering seemingly correct, but mouse input not lining up. Note the cursor position and the selected Configuration row in this screenshot 👇
I've also exposed
GetWindowContentScale, which GLFW added at the same time as the monitor scale API; this is required downstream so we can access the fractional scale value from Wayland/mutter.A platform guard has been added to Silk.NET.Input so I can build this on Linux without the iOS target.
Related issues
[1] BlackLabelHQ/SymphonyRecomp#46
[2] https://github.com/ocornut/imgui/blob/v1.82/backends/imgui_impl_glfw.cpp#L360-L362
[3] https://github.com/ocornut/imgui/blob/v1.82/backends/imgui_impl_opengl3.cpp#L272-L274
[4] https://github.com/ocornut/imgui/blob/v1.82/backends/imgui_impl_opengl3.cpp#L449-L450
Further Comments
I've fixed and tested this against the OpenGL implementation only. I'm not familiar with the status of Vulkan or if it's required there.