-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
ViewPort scaling messed up on secondary screen with different scaling #7689
Comments
I have seen #6444 but It don't see what I need to do? |
What I understand is: for each view port I need to check the scale and then switch the fontsize. |
Reason: I discovered the root cause of this issue, as you mentioned, is due to different monitors' DPI scaling. When using GLFW with the docking version of ImGui and disabling the system window decoration, this issue arises. The reason is that in this setting, window movement uses glfwSetWindowPos (this is also the case when the number of viewports is greater than one). When the window crosses monitors with different DPI scaling, GLFW triggers a DPI change event and updates the window size. The new size triggers a GLFW resize event. The problem is that the resize event triggered by glfwSetWindowPos happens in the same frame, and the viewport's PlatformRequestResize is cleared without being used after being set, causing the issue. However, when enabling the system window decoration, the window size is also updated, but the new size recommended by the system does not trigger a GLFW resize event, so the issue does not occur with system window decoration enabled. Temporary workaround: Suggested fix: |
Hey @the-loki, thanks for helping me. I can also see that you made a merge request to @ocornut. The diff look doesn't look too complicated. Do you think it is save to just apply that to my project backend? Did @ocornut say anything to it. But to apply the workaround u suggested I would need a little more specific help. |
Since I have only recently started using ImGui, to minimize the impact, I have only made modifications to GLFW. However, I still cannot guarantee whether there are other impacts; this depends on @ocornut 's perspective. Additionally, if you want to address this issue without modifying the GLFW backend, you can consider handling it in your application by actively monitoring changes in DPI scaling and triggering window size adjustments accordingly. You need two variables to save window size and dpi scale: and use window like this: This is a provisional code that has not yet been tested, but it may help you solve the problem without updating ImGui. |
Version/Branch of Dear ImGui:
V1.90.8 Branch Docking
Back-ends:
glfw glad
Compiler, OS:
Windows 10 + CLion + Bundled MinGW
Full config/build information:
No response
Details:
I am using ImGui (Branch: Docking) and attempting to use it to dock and with multiple viewports.
I did not used the example project as guide but only took the parts that worked with by libs.
I was able to get it running pretty smoothly, but once I drag an ImGui Winodw on its own onto another screen, the scalling breaks, [image 1]
This does not happen with a Windows window or if the ImGui window is in a Windows window.
But I am still able to change the size of the ImGui window and once I do that all Widgets jump back to where they belong to. [image 2]
But once I drag the window back onto the MainScreen this happens. [image 3]
My mouse is not highlighting the widget when it is on top of them. in the image imagine the top red circle being my cursor and the bottom circle indicating the higlighted widget.
However if I now drop the imgui window (including black padding) into the Windows window it snaps back and the black padding disapears and my mouse highlights the correct widgets again.
I also think that the font size in the imgui window differs between the 2 screen.
In the Windows setting I see:
main screen: 150% scale and 3840 * 2160
secondary screen: 100% scale and 1080 * 1920
And I just tested setting the scaling of the secondary screen to 150%
and it fixed it. any Tips how I can adjust my window to the scale?
Thank you for your support
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: