Merge branch 'main' into dev/seraphima/tests/29246-fancyzones-tests-initial-step

This commit is contained in:
seraphima
2023-11-21 12:28:42 +01:00
395 changed files with 8903 additions and 3803 deletions

View File

@@ -394,6 +394,15 @@ void FancyZones::WindowCreated(HWND window) noexcept
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
const bool isZoned = !FancyZonesWindowProperties::RetrieveZoneIndexProperty(window).empty();
if (isZoned)

View File

@@ -27,9 +27,8 @@ bool FancyZonesWindowProcessing::IsProcessable(HWND window) noexcept
// popup could be the window we don't want to snap: start menu, notification popup, tray window, etc.
// also, popup could be the windows we want to snap disregarding the "allowSnapPopupWindows" setting, e.g. Telegram
bool isPopup = FancyZonesWindowUtils::IsPopupWindow(window);
bool hasThickFrame = FancyZonesWindowUtils::HasThickFrame(window);
if (isPopup && (!hasThickFrame || !FancyZonesSettings::settings().allowSnapPopupWindows))
bool isPopup = FancyZonesWindowUtils::IsPopupWindow(window) && !FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(window);
if (isPopup && !FancyZonesSettings::settings().allowSnapPopupWindows)
{
return false;
}

View File

@@ -238,7 +238,7 @@ void FancyZonesSettings::LoadSettings()
if (auto val = values.get_int_value(NonLocalizable::OverlappingZonesAlgorithmID))
{
// Avoid undefined behavior
if (*val >= 0 || *val < static_cast<int>(OverlappingZonesAlgorithm::EnumElements))
if (*val >= 0 && *val < static_cast<int>(OverlappingZonesAlgorithm::EnumElements))
{
auto algorithm = (OverlappingZonesAlgorithm)*val;
if (m_settings.overlappingZonesAlgorithm != algorithm)

View File

@@ -306,26 +306,23 @@ void FancyZonesWindowUtils::SizeWindowToRect(HWND window, RECT rect) noexcept
::GetWindowPlacement(window, &placement);
}
if (!IsWindowVisible(window))
{
placement.showCmd = SW_HIDE;
}
else
if (IsWindowVisible(window))
{
// Do not restore minimized windows. We change their placement though so they restore to the correct zone.
if ((placement.showCmd != SW_SHOWMINIMIZED) &&
(placement.showCmd != SW_MINIMIZE))
{
placement.showCmd = SW_RESTORE;
}
// Remove maximized show command to make sure window is moved to the correct zone.
if (placement.showCmd == SW_SHOWMAXIMIZED)
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
// Remove maximized show command to make sure window is moved to the correct zone.
if (placement.showCmd == SW_SHOWMAXIMIZED)
{
placement.showCmd = SW_RESTORE;
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
}
}
else
{
placement.showCmd = SW_HIDE;
}
ScreenToWorkAreaCoords(window, rect);