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

TitleBarRect does not contain FramePadding. This will cause the window to not move correctly after ConfigWindowsMoveFromTitleBarOnly is enabled. #7576

Open
o-3-o opened this issue May 12, 2024 · 0 comments

Comments

@o-3-o
Copy link

o-3-o commented May 12, 2024

Version/Branch of Dear ImGui:

Version 1.XX, Branch: XXX (master/docking/etc.)

Back-ends:

imgui_impl_DX11.cpp + imgui_impl_Win32.cpp

Compiler, OS:

win11+msvc2022

Full config/build information:

Dear ImGui 1.90.6 (19060)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS
define: IMGUI_DISABLE_OBSOLETE_KEYIO
define: _WIN32
define: _WIN64
define: _MSC_VER=1939
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x0000C443
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
 DpiEnableScaleViewports
 DpiEnableScaleFonts
io.ConfigViewportsNoAutoMerge
io.ConfigViewportsNoDecoration
io.ConfigViewportsNoDefaultParent
io.ConfigDockingTransparentPayload
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigWindowsMoveFromTitleBarOnly
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 3440.00,1392.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

TitleBarRect does not contain FramePadding. This will cause the window to not move correctly after ConfigWindowsMoveFromTitleBarOnly is enabled.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

//...
io.ConfigWindowsMoveFromTitleBarOnly = true;
//...

ImGui::SetNextWindowSize(ImVec2(300.0f, 500.0f), ImGuiCond_Once);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(15.0, 50.0f));
ImGui::Begin("Test");
	const ImRect titleBarRect = ImGui::GetCurrentWindow()->TitleBarRect();
	ImGui::PushClipRect(titleBarRect.Min, titleBarRect.Max, false);
	ImGui::SetCursorPos(ImVec2(80.0f, 0.0f));
	ImGui::Button("Overlapping Button");
	ImGui::PopClipRect();
ImGui::End();
ImGui::PopStyleVar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant