Skip to content

Commit

Permalink
fix docking on Windows (broken since bf2061a)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfillion committed Apr 14, 2024
1 parent ba1e2f0 commit 395bc22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/docker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,6 @@ void DockerHost::update()
// dropped (when a dock request is created).
m_docker->update(true);

if(!m_window)
return;

m_window->update();

// Checking m_window->isMinimized here would prevent restoring
Expand All @@ -525,6 +522,5 @@ void DockerHost::update()

void DockerHost::setIME(ImGuiPlatformImeData *data)
{
if(m_window)
m_window->setIME(data);
m_window->setIME(data);
}
12 changes: 8 additions & 4 deletions src/win32_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,14 @@ void Win32Window::show()
if(!isDocked() && !(m_viewport->Flags & ImGuiViewportFlags_NoDecoration))
AttachWindowTopmostButton(m_hwnd);

// temporarily clear the parent to prevent ShowWindow from bringing it to front
const LONG_PTR parent { SetWindowLongPtr(m_hwnd, GWLP_HWNDPARENT, 0) };
Window::show();
SetWindowLongPtr(m_hwnd, GWLP_HWNDPARENT, parent);
if(isDocked())
Window::show();
else {
// prevent ShowWindow from bringing the parent window to the front
const LONG_PTR parent { SetWindowLongPtr(m_hwnd, GWLP_HWNDPARENT, 0) };
Window::show();
SetWindowLongPtr(m_hwnd, GWLP_HWNDPARENT, parent);
}

// WS_EX_DLGMODALFRAME removes the default icon but adds a border when docked
// Unsetting it after the window is visible disables the border (+ no icon)
Expand Down

0 comments on commit 395bc22

Please sign in to comment.