Skip to content

Backends: GLFW: sync clamped viewport positions#9441

Open
KBentley57 wants to merge 1 commit into
ocornut:dockingfrom
KBentley57:fix/glfw-clamped-viewport-pos
Open

Backends: GLFW: sync clamped viewport positions#9441
KBentley57 wants to merge 1 commit into
ocornut:dockingfrom
KBentley57:fix/glfw-clamped-viewport-pos

Conversation

@KBentley57

@KBentley57 KBentley57 commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Fix a GLFW multi-viewport position sync issue on Linux/X11 when the window manager clamps a secondary viewport to a monitor edge.

Issue: #9442

Confirmed from at least Dear ImGui 1.90 through current docking HEAD, using GCC 13 and GCC 14, on Debian 13, Ubuntu 24.04, Ubuntu under WSL, Red Hat Enterprise Linux 8/9, and Rocky Linux 8/9.

The GLFW backend currently ignores window-position callbacks for one frame after calling glfwSetWindowPos(), so ordinary echo events from the backend do not set PlatformRequestMove. On X11 window managers such as Mutter, the requested position may be refused or clamped near monitor edges. In that case GLFW reports a different actual position, but the callback is still ignored and Dear ImGui keeps using the requested position internally.

This patch keeps the existing ignore behavior when GLFW reports the exact position Dear ImGui requested. If the callback reports a different position, it is treated as an actual platform move so the viewport can be synchronized back to the real platform window position.

Related Issues

Repro

Minimal repro repository:

https://github.com/KBentley57/imgui-viewport-edge-repro

Build the repro once against v1.92.8-docking and once against this branch. With the affected backend, the detached viewport can report a cached ImGui viewport position that differs from glfwGetWindowPos() after requesting/dragging near a monitor edge. With this branch, the backend no longer discards the clamped position callback.

Validation

  • Built the minimal GLFW/OpenGL repro with Dear ImGui sources compiled directly into the target.
  • Verified the patch is limited to backends/imgui_impl_glfw.cpp.

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.

2 participants