[FancyZones] Fix: 'Space around zones' toggle does not turn off spacing (#21658)

This commit is contained in:
Seraphima Zykova 2022-11-04 16:21:05 +02:00 коммит произвёл GitHub
Родитель d234536cf7
Коммит 420a24e607
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -122,29 +122,31 @@ bool Layout::Init(const FancyZonesUtils::Rect& workArea, HMONITOR monitor) noexc
return false;
}
auto spacing = m_data.showSpacing ? m_data.spacing : 0;
switch (m_data.type)
{
case FancyZonesDataTypes::ZoneSetLayoutType::Focus:
m_zones = LayoutConfigurator::Focus(workArea, m_data.zoneCount);
break;
case FancyZonesDataTypes::ZoneSetLayoutType::Columns:
m_zones = LayoutConfigurator::Columns(workArea, m_data.zoneCount, m_data.spacing);
m_zones = LayoutConfigurator::Columns(workArea, m_data.zoneCount, spacing);
break;
case FancyZonesDataTypes::ZoneSetLayoutType::Rows:
m_zones = LayoutConfigurator::Rows(workArea, m_data.zoneCount, m_data.spacing);
m_zones = LayoutConfigurator::Rows(workArea, m_data.zoneCount, spacing);
break;
case FancyZonesDataTypes::ZoneSetLayoutType::Grid:
m_zones = LayoutConfigurator::Grid(workArea, m_data.zoneCount, m_data.spacing);
m_zones = LayoutConfigurator::Grid(workArea, m_data.zoneCount, spacing);
break;
case FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid:
m_zones = LayoutConfigurator::PriorityGrid(workArea, m_data.zoneCount, m_data.spacing);
m_zones = LayoutConfigurator::PriorityGrid(workArea, m_data.zoneCount, spacing);
break;
case FancyZonesDataTypes::ZoneSetLayoutType::Custom:
{
const auto customLayoutData = CustomLayouts::instance().GetCustomLayoutData(m_data.uuid);
if (customLayoutData.has_value())
{
m_zones = LayoutConfigurator::Custom(workArea, monitor, customLayoutData.value(), m_data.spacing);
m_zones = LayoutConfigurator::Custom(workArea, monitor, customLayoutData.value(), spacing);
}
else
{

Просмотреть файл

@ -21,7 +21,7 @@ namespace FancyZonesUnitTests
{
.uuid = FancyZonesUtils::GuidFromString(L"{F762BAD6-DAA1-4997-9497-E11DFEB72F21}").value(),
.type = ZoneSetLayoutType::Grid,
.showSpacing = false,
.showSpacing = true,
.spacing = 17,
.zoneCount = 4,
.sensitivityRadius = 33
@ -192,7 +192,7 @@ namespace FancyZonesUnitTests
const LayoutData m_data{
.uuid = FancyZonesUtils::GuidFromString(L"{33A2B101-06E0-437B-A61E-CDBECF502906}").value(),
.type = ZoneSetLayoutType::Grid,
.showSpacing = false,
.showSpacing = true,
.spacing = 17,
.zoneCount = 4,
.sensitivityRadius = 33