On X11, window managers may asynchronously constrain or reject secondary viewport geometry. Dear ImGui suppresses callbacks near its own setters and caches the requested geometry as accepted. GLFW also filters unchanged synthetic ConfigureNotify events. This leaves the OS window geometry out of sync with Dear ImGui rendering, input hit testing, and docking state.
This is my first attempt at solving this problem for Linux X11 users. Here is what I did:
- Preserve adjusted GLFW position and size callbacks instead of suppressing every callback shortly after a setter.
- Observe X11 synthetic
ConfigureNotifyevents so fully rejected geometry requests, which GLFW filters from its public callbacks, still synchronize. - Keep requested and observed viewport geometry distinct in the core and rebase active viewport dragging when the window manager constrains movement.
- Disable multi-viewports on native Wayland with legacy GLFW versions, matching the existing backend limitation.
What I did (so far) to test this:
- Manually exercise secondary viewports under native X11 and XWayland.
- imgui_test_engine mock viewport regression suite passed (12/12).
Companion test branch: https://github.com/Daedie-git/imgui_test_engine/tree/agent/add-viewport-geometry-sync-tests
Important note: The X11 observer dynamically loads optional libX11 symbols and falls back to the existing GLFW callback behavior when unavailable. It is compile-gated from non-X11 builds. The shared core changes also preserve synchronous geometry callbacks used by GLFW on Windows.