@@ -126,6 +126,9 @@ def monitors(self):
126126 """ Get positions of monitors (see parent class). """
127127
128128 if not self ._monitors :
129+ int_ = int
130+ core = self .core
131+
129132 # All monitors
130133 # We need to update the value with every single monitor found
131134 # using CGRectUnion. Else we will end with infinite values.
@@ -135,36 +138,36 @@ def monitors(self):
135138 # Each monitors
136139 display_count = ctypes .c_uint32 (0 )
137140 active_displays = (ctypes .c_uint32 * self .max_displays )()
138- self . core .CGGetActiveDisplayList (
141+ core .CGGetActiveDisplayList (
139142 self .max_displays , active_displays , ctypes .byref (display_count )
140143 )
141144 rotations = {0.0 : "normal" , 90.0 : "right" , - 90.0 : "left" }
142145 for idx in range (display_count .value ):
143146 display = active_displays [idx ]
144- rect = self . core .CGDisplayBounds (display )
145- rect = self . core .CGRectStandardize (rect )
147+ rect = core .CGDisplayBounds (display )
148+ rect = core .CGRectStandardize (rect )
146149 width , height = rect .size .width , rect .size .height
147- rot = self . core .CGDisplayRotation (display )
150+ rot = core .CGDisplayRotation (display )
148151 if rotations [rot ] in ["left" , "right" ]:
149152 width , height = height , width
150153 self ._monitors .append (
151154 {
152- "left" : int (rect .origin .x ),
153- "top" : int (rect .origin .y ),
154- "width" : int (width ),
155- "height" : int (height ),
155+ "left" : int_ (rect .origin .x ),
156+ "top" : int_ (rect .origin .y ),
157+ "width" : int_ (width ),
158+ "height" : int_ (height ),
156159 }
157160 )
158161
159162 # Update AiO monitor's values
160- all_monitors = self . core .CGRectUnion (all_monitors , rect )
163+ all_monitors = core .CGRectUnion (all_monitors , rect )
161164
162165 # Set the AiO monitor's values
163166 self ._monitors [0 ] = {
164- "left" : int (all_monitors .origin .x ),
165- "top" : int (all_monitors .origin .y ),
166- "width" : int (all_monitors .size .width ),
167- "height" : int (all_monitors .size .height ),
167+ "left" : int_ (all_monitors .origin .x ),
168+ "top" : int_ (all_monitors .origin .y ),
169+ "width" : int_ (all_monitors .size .width ),
170+ "height" : int_ (all_monitors .size .height ),
168171 }
169172
170173 return self ._monitors
0 commit comments