Skip to content

Commit 0e3b484

Browse files
committed
Windows: smarter memory allocation (fixes BoboTiG#53)
1 parent 79a59bf commit 0e3b484

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mss/windows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class BITMAPINFO(ctypes.Structure):
4848
class MSS(MSSBase):
4949
""" Multiple ScreenShots implementation for Microsoft Windows. """
5050

51-
_bbox = None
51+
_bbox = {'height': 0, 'width': 0}
5252
_bmp = None
5353
_data = None
5454
_memdc = None
@@ -207,7 +207,7 @@ def grab(self, monitor):
207207
gdi = ctypes.windll.gdi32
208208
width, height = monitor['width'], monitor['height']
209209

210-
if self._bbox != monitor:
210+
if (self._bbox['height'], self._bbox['width']) != (height, width):
211211
self._bbox = monitor
212212
self._bmi.bmiHeader.biWidth = width
213213
self._bmi.bmiHeader.biHeight = -height # Why minus? [1]

0 commit comments

Comments
 (0)