mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
* rename Layout -> LayoutData * simplify zone * split ZoneSet: Layout * refactoring * split ZoneSet: LayoutWindows * update trace * split ZoneSet: remove ZoneSet * fix initialization * split unit tests * remove unused * warning * nullptr check * use current rect * update work area tests * use current rect * simplify * more meaningful name * dismiss * safety checks * resolve conflicts * reassign windows after switching vd * avoid double-processing for window on switching vd * extend windows fix * check if window is on current desktop before cycling * separated extend * not reinit layout windows
45 lines
999 B
C++
45 lines
999 B
C++
#include "pch.h"
|
|
#include "Zone.h"
|
|
|
|
Zone::Zone(const RECT& zoneRect, const ZoneIndex zoneIndex) :
|
|
m_rect(zoneRect),
|
|
m_index(zoneIndex)
|
|
{
|
|
}
|
|
|
|
Zone::Zone(const Zone& other) :
|
|
m_rect(other.m_rect),
|
|
m_index(other.m_index)
|
|
{
|
|
}
|
|
|
|
ZoneIndex Zone::Id() const noexcept
|
|
{
|
|
return m_index;
|
|
}
|
|
|
|
bool Zone::IsValid() const noexcept
|
|
{
|
|
return m_index >= 0 && isValid();
|
|
}
|
|
|
|
RECT Zone::GetZoneRect() const noexcept
|
|
{
|
|
return m_rect;
|
|
}
|
|
|
|
long Zone::GetZoneArea() const noexcept
|
|
{
|
|
return max(m_rect.bottom - m_rect.top, 0) * max(m_rect.right - m_rect.left, 0);
|
|
}
|
|
|
|
bool Zone::isValid() const noexcept
|
|
{
|
|
int width = m_rect.right - m_rect.left;
|
|
int height = m_rect.bottom - m_rect.top;
|
|
return m_rect.left >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
|
m_rect.right >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
|
m_rect.top >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
|
m_rect.bottom >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
|
width >= 0 && height >= 0;
|
|
} |