Skip to content
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

Fix rendering errors caused by dragging the window across monitors with different DPI scaling. #7757

Open
wants to merge 1 commit into
base: docking
Choose a base branch
from

Conversation

the-loki
Copy link

When I create a window using the docking branch and enable the following settings, some rendering issues occur when dragging between monitors with different DPI scaling.

io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;

io.ConfigViewportsNoAutoMerge = true;
io.ConfigViewportsNoTaskBarIcon = false;
io.ConfigViewportsNoDefaultParent = true;
io.ConfigViewportsNoDecoration = true;

I found that dragging in NoDecoration mode relies on using glfwSetWindowPos, and the window triggers a resize when crossing monitors. However, the resize triggered by glfwSetWindowPos occurs immediately in the current frame, which means some operations depending on PlatformRequestResize might have already completed. Additionally, the PlatformRequestResize flag is cleared at the end of the frame. Therefore, we need to consider delaying the resize triggered by glfwSetWindowPos to the next frame to ensure that operations related to PlatformRequestResize are fully executed.

I only handled the related issue in GLFW, but other backends might have similar problems. Perhaps other window events could also have similar issues (triggered in the current frame but not fully processed before being cleared).

The related issues:

#7689 #6444

@the-loki the-loki marked this pull request as draft June 30, 2024 06:51
@the-loki the-loki marked this pull request as ready for review June 30, 2024 06:56
@the-loki
Copy link
Author

@ocornut
Is there anything else I need to do to move forward with this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants