Compare commits

...

8 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
d34109ba61 Move registry margin adjustment to root Layout::Init method for better performance and code organization
Co-authored-by: yeelam-gordon <73506701+yeelam-gordon@users.noreply.github.com>
2025-09-05 17:50:38 +08:00
Clint Rutkas
ad9de0b54b fix casting thanks to Dustin 2025-09-05 17:50:37 +08:00
Clint Rutkas
1a2b4e2f3e Update LayoutDefaults.h 2025-09-05 17:50:36 +08:00
copilot-swe-agent[bot]
5feab1c9f1 Use Windows DWM ColorPrevalence registry key for margin adjustment
Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
2025-09-05 17:50:36 +08:00
copilot-swe-agent[bot]
7b413375aa Implement registry key for FancyZones margin adjustment
Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
2025-09-05 17:50:33 +08:00
copilot-swe-agent[bot]
abc574d486 Update isLayoutDefault to use DefaultValues constants instead of hardcoded values
Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
2025-09-05 17:50:30 +08:00
copilot-swe-agent[bot]
f97d680fb1 Change FancyZones default spacing from 16px to 0px to remove tiling gaps by default
Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
2025-09-05 17:50:29 +08:00
copilot-swe-agent[bot]
94887b0ebb Initial plan for issue 2025-09-05 17:50:27 +08:00
3 changed files with 31 additions and 5 deletions

View File

@@ -20,10 +20,10 @@ namespace
bool isLayoutDefault(const LayoutData& layout)
{
return layout.type == FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid &&
layout.zoneCount == 3 &&
layout.spacing == 16 &&
layout.showSpacing == true &&
layout.sensitivityRadius == 20;
layout.zoneCount == DefaultValues::ZoneCount &&
layout.spacing == DefaultValues::Spacing &&
layout.showSpacing == DefaultValues::ShowSpacing &&
layout.sensitivityRadius == DefaultValues::SensitivityRadius;
}
}

View File

@@ -4,6 +4,6 @@ namespace DefaultValues
{
const int ZoneCount = 3;
const bool ShowSpacing = true;
const int Spacing = 16;
const int Spacing = 4;
const int SensitivityRadius = 20;
}

View File

@@ -9,6 +9,31 @@
#include <common/logger/logger.h>
namespace
{
int AdjustSpacingForRegistry(int originalSpacing)
{
// Check Windows DWM ColorPrevalence setting
// When ColorPrevalence = 0 (accent color not shown), subtract 1 from spacing
HKEY hKey;
DWORD dwValue = 1; // Default to 1 (accent color shown)
DWORD dwSize = sizeof(DWORD);
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\DWM", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
RegQueryValueExW(hKey, L"ColorPrevalence", nullptr, nullptr, reinterpret_cast<LPBYTE>(&dwValue), &dwSize);
RegCloseKey(hKey);
}
// Apply -1 margin when ColorPrevalence = 0 (accent color not shown)
if (dwValue == 0)
{
return originalSpacing - 1;
}
return originalSpacing;
}
}
namespace ZoneSelectionAlgorithms
{
constexpr int OVERLAPPING_CENTERS_SENSITIVITY = 75;
@@ -128,6 +153,7 @@ bool Layout::Init(const FancyZonesUtils::Rect& workArea, HMONITOR monitor) noexc
}
auto spacing = m_data.showSpacing ? m_data.spacing : 0;
spacing = AdjustSpacingForRegistry(spacing);
switch (m_data.type)
{