Skip to content

Commit 11f30f9

Browse files
[FancyZones]Don't automatically snap context menus (#28956)
* check tabstop * revert * check popup thickframe * Revert "check popup thickframe" * added HasThickFrame * popup check * spellcheck
1 parent 59fb08c commit 11f30f9

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/modules/fancyzones/FancyZonesLib/FancyZones.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <FancyZonesLib/VirtualDesktop.h>
3030
#include <FancyZonesLib/WindowKeyboardSnap.h>
3131
#include <FancyZonesLib/WindowMouseSnap.h>
32+
#include <FancyZonesLib/WindowUtils.h>
3233
#include <FancyZonesLib/WorkArea.h>
3334
#include <FancyZonesLib/WorkAreaConfiguration.h>
3435

@@ -394,6 +395,15 @@ void FancyZones::WindowCreated(HWND window) noexcept
394395
return;
395396
}
396397

398+
// Hotfix
399+
// Avoid automatically moving popup windows, as they can be just popup menus.
400+
bool isPopup = FancyZonesWindowUtils::IsPopupWindow(window);
401+
bool hasThickFrame = FancyZonesWindowUtils::HasThickFrame(window);
402+
if (isPopup && !hasThickFrame)
403+
{
404+
return;
405+
}
406+
397407
// Avoid already stamped (zoned) windows
398408
const bool isZoned = !FancyZonesWindowProperties::RetrieveZoneIndexProperty(window).empty();
399409
if (isZoned)

src/modules/fancyzones/FancyZonesLib/WindowUtils.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ bool FancyZonesWindowUtils::IsPopupWindow(HWND window) noexcept
192192
return ((style & WS_POPUP) == WS_POPUP);
193193
}
194194

195+
bool FancyZonesWindowUtils::HasThickFrame(HWND window) noexcept
196+
{
197+
auto style = GetWindowLong(window, GWL_STYLE);
198+
return ((style & WS_THICKFRAME) == WS_THICKFRAME);
199+
}
200+
195201
bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept
196202
{
197203
auto style = GetWindowLong(window, GWL_STYLE);

src/modules/fancyzones/FancyZonesLib/WindowUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace FancyZonesWindowUtils
2020
bool HasVisibleOwner(HWND window) noexcept;
2121
bool IsStandardWindow(HWND window);
2222
bool IsPopupWindow(HWND window) noexcept;
23+
bool HasThickFrame(HWND window) noexcept;
2324
bool HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept;
2425
bool IsProcessOfWindowElevated(HWND window); // If HWND is already dead, we assume it wasn't elevated
2526

0 commit comments

Comments
 (0)