-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FancyZones] Zone indexes type change (#12724)
- Loading branch information
1 parent
7278d62
commit 7ea1f26
Showing
24 changed files
with
239 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/modules/fancyzones/FancyZonesLib/FancyZonesWindowProperties.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
|
||
#include <FancyZonesLib/Zone.h> | ||
|
||
// Zoned window properties are not localized. | ||
namespace ZonedWindowProperties | ||
{ | ||
const wchar_t PropertyMultipleZoneID[] = L"FancyZones_zones"; | ||
const wchar_t PropertyRestoreSizeID[] = L"FancyZones_RestoreSize"; | ||
const wchar_t PropertyRestoreOriginID[] = L"FancyZones_RestoreOrigin"; | ||
|
||
const wchar_t MultiMonitorDeviceID[] = L"FancyZones#MultiMonitorDevice"; | ||
} | ||
|
||
inline ZoneIndexSet GetZoneIndexSet(HWND window) | ||
{ | ||
HANDLE handle = ::GetProp(window, ZonedWindowProperties::PropertyMultipleZoneID); | ||
ZoneIndexSet zoneIndexSet; | ||
|
||
std::array<int, 2> data; | ||
memcpy(data.data(), &handle, sizeof data); | ||
uint64_t bitmask = ((uint64_t)data[0] << 32) + data[1]; | ||
|
||
if (bitmask != 0) | ||
{ | ||
for (int i = 0; i < std::numeric_limits<ZoneIndex>::digits; i++) | ||
{ | ||
if ((1ull << i) & bitmask) | ||
{ | ||
zoneIndexSet.push_back(i); | ||
} | ||
} | ||
} | ||
|
||
return zoneIndexSet; | ||
} | ||
|
||
inline void StampWindow(HWND window, Bitmask bitmask) noexcept | ||
{ | ||
std::array<int, 2> data = { (bitmask >> 32), static_cast<int>(bitmask) }; | ||
HANDLE rawData; | ||
memcpy(&rawData, data.data(), sizeof data); | ||
SetProp(window, ZonedWindowProperties::PropertyMultipleZoneID, rawData); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.