Skip to content

Commit

Permalink
The region grab size 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
CTPaHHuK-HEbA committed Nov 8, 2023
1 parent 0e5808d commit 5c8888f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mss/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, /, **kwargs: Any) -> None:

# Available thread-specific variables
self._handles = local()
self._handles.region_width_height = (0, 0)
self._handles.region_width_height = None
self._handles.bmp = None
self._handles.srcdc = self.user32.GetWindowDC(0)
self._handles.memdc = self.gdi32.CreateCompatibleDC(self._handles.srcdc)
Expand Down
7 changes: 7 additions & 0 deletions src/tests/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,10 @@ def test_thread_safety_regions():
thread2.start()
thread1.join()
thread2.join()


def test_region_zero():
"""The region grab size 0."""
with mss.mss() as sct:
region0 = {"top": 0, "left": 0, "width": 0, "height": 0}
sct.grab(region0)

0 comments on commit 5c8888f

Please sign in to comment.