mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 05:06:36 +02:00
activate zones for windows with custom titlebar
fixes https://github.com/microsoft/PowerToys/issues/209
This commit is contained in:
@@ -594,19 +594,17 @@ void FancyZones::OnSnapHotkey(DWORD vkCode) noexcept
|
|||||||
|
|
||||||
void FancyZones::MoveSizeStartInternal(HWND window, HMONITOR monitor, POINT const& ptScreen, require_write_lock writeLock) noexcept
|
void FancyZones::MoveSizeStartInternal(HWND window, HMONITOR monitor, POINT const& ptScreen, require_write_lock writeLock) noexcept
|
||||||
{
|
{
|
||||||
// Only enter move/size if the cursor is in the titlebar.
|
// Only enter move/size if the cursor is inside the window rect by a certain padding.
|
||||||
// This prevents resize from triggering zones.
|
// This prevents resize from triggering zones.
|
||||||
RECT windowRect{};
|
RECT windowRect{};
|
||||||
::GetWindowRect(window, &windowRect);
|
::GetWindowRect(window, &windowRect);
|
||||||
|
|
||||||
TITLEBARINFO titlebarInfo{ sizeof(titlebarInfo) };
|
windowRect.top += 6;
|
||||||
::GetTitleBarInfo(window, &titlebarInfo);
|
windowRect.left += 8;
|
||||||
|
windowRect.right -= 8;
|
||||||
|
windowRect.bottom -= 6;
|
||||||
|
|
||||||
// Titlebar height is weird and apps can do custom drag areas.
|
if (PtInRect(&windowRect, ptScreen))
|
||||||
// Give it half of the height of the window to make sure.
|
|
||||||
titlebarInfo.rcTitleBar.bottom += ((windowRect.bottom - windowRect.top) / 2);
|
|
||||||
|
|
||||||
if (PtInRect(&titlebarInfo.rcTitleBar, ptScreen))
|
|
||||||
{
|
{
|
||||||
m_inMoveSize = true;
|
m_inMoveSize = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user