[FancyZones]Don't automatically snap context menus (#28956)

* check tabstop

* revert

* check popup thickframe

* Revert "check popup thickframe"

* added HasThickFrame

* popup check

* spellcheck
This commit is contained in:
Seraphima Zykova 2023-10-02 23:31:22 +03:00 committed by GitHub
parent 59fb08cdd8
commit 11f30f9d33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include <FancyZonesLib/VirtualDesktop.h> #include <FancyZonesLib/VirtualDesktop.h>
#include <FancyZonesLib/WindowKeyboardSnap.h> #include <FancyZonesLib/WindowKeyboardSnap.h>
#include <FancyZonesLib/WindowMouseSnap.h> #include <FancyZonesLib/WindowMouseSnap.h>
#include <FancyZonesLib/WindowUtils.h>
#include <FancyZonesLib/WorkArea.h> #include <FancyZonesLib/WorkArea.h>
#include <FancyZonesLib/WorkAreaConfiguration.h> #include <FancyZonesLib/WorkAreaConfiguration.h>
@ -394,6 +395,15 @@ void FancyZones::WindowCreated(HWND window) noexcept
return; return;
} }
// Hotfix
// Avoid automatically moving popup windows, as they can be just popup menus.
bool isPopup = FancyZonesWindowUtils::IsPopupWindow(window);
bool hasThickFrame = FancyZonesWindowUtils::HasThickFrame(window);
if (isPopup && !hasThickFrame)
{
return;
}
// Avoid already stamped (zoned) windows // Avoid already stamped (zoned) windows
const bool isZoned = !FancyZonesWindowProperties::RetrieveZoneIndexProperty(window).empty(); const bool isZoned = !FancyZonesWindowProperties::RetrieveZoneIndexProperty(window).empty();
if (isZoned) if (isZoned)

View File

@ -192,6 +192,12 @@ bool FancyZonesWindowUtils::IsPopupWindow(HWND window) noexcept
return ((style & WS_POPUP) == WS_POPUP); return ((style & WS_POPUP) == WS_POPUP);
} }
bool FancyZonesWindowUtils::HasThickFrame(HWND window) noexcept
{
auto style = GetWindowLong(window, GWL_STYLE);
return ((style & WS_THICKFRAME) == WS_THICKFRAME);
}
bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept
{ {
auto style = GetWindowLong(window, GWL_STYLE); auto style = GetWindowLong(window, GWL_STYLE);

View File

@ -20,6 +20,7 @@ namespace FancyZonesWindowUtils
bool HasVisibleOwner(HWND window) noexcept; bool HasVisibleOwner(HWND window) noexcept;
bool IsStandardWindow(HWND window); bool IsStandardWindow(HWND window);
bool IsPopupWindow(HWND window) noexcept; bool IsPopupWindow(HWND window) noexcept;
bool HasThickFrame(HWND window) noexcept;
bool HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept; bool HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept;
bool IsProcessOfWindowElevated(HWND window); // If HWND is already dead, we assume it wasn't elevated bool IsProcessOfWindowElevated(HWND window); // If HWND is already dead, we assume it wasn't elevated