(self)
Get positions of monitors. It will populate self._monitors.
Get positions of monitors. It will populate self._monitors.
Get positions of monitors . It will populate self . _monitors .
def _monitors_impl(self):
        # type: () -> None
        """ Get positions of monitors. It will populate self._monitors. """

        int_ = int
        core = self.core

        # All monitors
        # We need to update the value with every single monitor found
        # using CGRectUnion.  Else we will end with infinite values.
        all_monitors = CGRect()
        self._monitors.append({})

        # Each monitor
        display_count = c_uint32(0)
        active_displays = (c_uint32 * self.max_displays)()
        core.CGGetActiveDisplayList(
            self.max_displays, active_displays, ctypes.byref(display_count)
        )
        rotations = {0.0: "normal", 90.0: "right", -90.0: "left"}
        for idx in range(display_count.value):
            display = active_displays[idx]
            rect = core.CGDisplayBounds(display)
            rect = core.CGRectStandardize(rect)
            width, height = rect.size.width, rect.size.height
            rot = core.CGDisplayRotation(display)
            if rotations[rot] in ["left", "right"]:
                width, height = height, width
            self._monitors.append(
                {
                    "left": int_(rect.origin.x),
                    "top": int_(rect.origin.y),
                    "width": int_(width),
                    "height": int_(height),
                }
            )

            # Update AiO monitor's values
            all_monitors = core.CGRectUnion(all_monitors, rect)

        # Set the AiO monitor's values
        self._monitors[0] = {
            "left": int_(all_monitors.origin.x),
            "top": int_(all_monitors.origin.y),
            "width": int_(all_monitors.size.width),
            "height": int_(all_monitors.size.height),
        }
def _monitors_impl ( self ) : # type: () -> None int_ = int core = self . core # All monitors # We need to update the value with every single monitor found # using CGRectUnion.  Else we will end with infinite values. all_monitors = CGRect ( ) self . _monitors . append ( { } ) # Each monitor display_count = c_uint32 ( 0 ) active_displays = ( c_uint32 * self . max_displays ) ( ) core . CGGetActiveDisplayList ( self . max_displays , active_displays , ctypes . byref ( display_count ) ) rotations = { 0.0 : "normal" , 90.0 : "right" , - 90.0 : "left" } for idx in range ( display_count . value ) : display = active_displays [ idx ] rect = core . CGDisplayBounds ( display ) rect = core . CGRectStandardize ( rect ) width , height = rect . size . width , rect . size . height rot = core . CGDisplayRotation ( display ) if rotations [ rot ] in [ "left" , "right" ] : width , height = height , width self . _monitors . append ( { "left" : int_ ( rect . origin . x ) , "top" : int_ ( rect . origin . y ) , "width" : int_ ( width ) , "height" : int_ ( height ) , } ) # Update AiO monitor's values all_monitors = core . CGRectUnion ( all_monitors , rect ) # Set the AiO monitor's values self . _monitors [ 0 ] = { "left" : int_ ( all_monitors . origin . x ) , "top" : int_ ( all_monitors . origin . y ) , "width" : int_ ( all_monitors . size . width ) , "height" : int_ ( all_monitors . size . height ) , }