Skip to content

Commit

Permalink
Fixed drag/drop snapping not being available
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemony committed Mar 19, 2024
1 parent dd80442 commit 5219e0b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/imgui/imgui_impl_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,9 @@ static void ImGui_ImplWin32_GetWin32StyleFromViewportFlags(ImGuiViewportFlags fl
if (flags & ImGuiViewportFlags_NoDecoration)
*out_style = WS_POPUP; // Popups / Tooltips (alternate look: WS_POPUPWINDOW, or WS_POPUP | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX)
else {
*out_style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_THICKFRAME; // Main Window (WS_OVERLAPPEDWINDOW)
*out_style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_THICKFRAME | WS_MAXIMIZEBOX; // Main Window (WS_OVERLAPPEDWINDOW)

// Only enable the maximized box if DragFromMaximize is available in Windows
if (_registry.bMaximizeOnDoubleClick && SKIF_Util_GetDragFromMaximized ( ))
*out_style |= WS_MAXIMIZEBOX;
// WS_MAXIMIZEBOX is necessary for drag/drop snapping to the edges of the monitor to function as expected
}

// WS_OVERLAPPEDWINDOW == WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
Expand All @@ -1120,7 +1118,7 @@ static void ImGui_ImplWin32_GetWin32StyleFromViewportFlags(ImGuiViewportFlags fl
// - WS_SYSMENU - Window menu (WndMenu -> Move // alt+space, right click window on taskbar
// - WS_THICKFRAME - Resize grip on window (WndMenu -> Size) // enables WinKey+Left/Right snapping
// - WS_MINIMIZEBOX - Minimize button (WndMenu -> Minimize) // enables WinKey+Down minimize shortcut
// - WS_MAXIMIZEBOX - Maximize button (WndMenu -> Maximize) // enables WinKey+Up maximize shortcut
// - WS_MAXIMIZEBOX - Maximize button (WndMenu -> Maximize) // enables WinKey+Up maximize shortcut + drag/drop snapping

if (flags & ImGuiViewportFlags_NoTaskBarIcon)
*out_ex_style = WS_EX_TOOLWINDOW; // Popups / Tooltips
Expand Down Expand Up @@ -1960,7 +1958,7 @@ static LRESULT CALLBACK ImGui_ImplWin32_WndProcHandler_PlatformWindow(HWND hWnd,
{
// Only convert "non-client" double clicks to single clicks
// if dragging windows from a maximized state is disabled
if (! _registry.bMaximizeOnDoubleClick && ! SKIF_Util_GetDragFromMaximized ( ))
if (! _registry.bMaximizeOnDoubleClick || ! SKIF_Util_GetDragFromMaximized ( ))
msg = WM_NCLBUTTONDOWN;
break;
}
Expand Down

0 comments on commit 5219e0b

Please sign in to comment.