Skip to content

Commit 780976d

Browse files
authored
Mac: tiny improvement in monitors finding (#254)
1 parent ec1ebe9 commit 780976d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ See Git checking messages for full history.
44

55
## 8.0.4 (2023/xx/xx)
66
- Linux: add failure handling to `XOpenDisplay()` call (fixes #246)
7+
- Mac: tiny improvement in moniors finding
78
- Windows: refactored how internal handles are stored (fixes #198)
89
- Windows: removed side effects when leaving the context manager, resources are all freed
910
- CI: run tests via xvfb-run on GitHub Actions (#248)

src/mss/darwin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,13 @@ def _monitors_impl(self) -> None:
133133
display_count = c_uint32(0)
134134
active_displays = (c_uint32 * self.max_displays)()
135135
core.CGGetActiveDisplayList(self.max_displays, active_displays, ctypes.byref(display_count))
136-
rotations = {0.0: "normal", 90.0: "right", -90.0: "left"}
137136
for idx in range(display_count.value):
138137
display = active_displays[idx]
139138
rect = core.CGDisplayBounds(display)
140139
rect = core.CGRectStandardize(rect)
141140
width, height = rect.size.width, rect.size.height
142-
rot = core.CGDisplayRotation(display)
143-
if rotations[rot] in ["left", "right"]:
141+
if core.CGDisplayRotation(display) in {90.0, -90.0}:
142+
# {0.0: "normal", 90.0: "right", -90.0: "left"}
144143
width, height = height, width
145144
self._monitors.append(
146145
{

0 commit comments

Comments
 (0)