+
    KiZ  c                   s   R t ^ RIHt ^ RIt^ RIHtHt ^ RIHt ]! RR4      t	 ! R R4      t
 ! R R	4      t ! R
 R4      t ! R R]4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      tR# )z)DBus backed display management for Mutter)
namedtupleN)DEFAULT_RESOLUTION_HEIGHTDEFAULT_RESOLUTION_WIDTH)loggerDisplayConfigc                   s   a  ] tR t^t o RtR tR t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       tRtV tR# )Outputz+Representation of a physical display outputc                    Wn         R # N_output)selfZoutput_info   &&G/usr/lib/python3.14/site-packages/lutris/util/graphics/displayconfig.py__init__ZOutput.__init__   s    "    c                \    R V P                   : RV P                  : RV P                  : R2# )z	<Output:  z (z)>)vendorproductdisplay_namer
      &r   __repr__ZOutput.__repr__   s    )-dllDDUDUVVr   c                (    V P                   ^ ,          # )zID of the outputr   r   r   r   	output_idZOutput.output_id        ||Ar   c                (    V P                   ^,          # )z3The low-level ID of this output (XID or KMS handle)r   r   r   r   	winsys_idZOutput.winsys_id   r   r   c                (    V P                   ^,          # )zPThe CRTC that is currently driving this output,
or -1 if the output is disabled
r   r   r   r   current_crtcZOutput.current_crtc        
 ||Ar   c                (    V P                   ^,          # )z&All CRTCs that can control this outputr   r   r   r   crtcsZOutput.crtcs'   r   r   c                (    V P                   ^,          # )zMThe name of the connector to which the output is attached (like VGA1 or HDMI)r   r   r   r   nameZOutput.name,   r   r   c                sd    V P                   ^,           Uu. uF  p\        V4      NK  	  up# u upi )zValid modes for this output)r	   int)r
   Zmode_id   & r   modesZOutput.modes1   s(     -1LLO<OGO<<<   -c                (    V P                   ^,          # )zValid clones for this output, ie other outputs that can be assigned
the same CRTC as this one; if you want to mirror two outputs that don't
have each other in the clone list, you must configure two different
CRTCs for the same geometry.
r   r   r   r   clonesZOutput.clones6   s     ||Ar   c                s(    V P                   ^,          # )ziOther high-level properties that affect this output; they are not
necessarily reflected in the hardware.
r   r   r   r   
propertiesZOutput.properties?   r   r   c                H    \        V P                  ^,          R,          4      # )zVendor name of the outputr   strr	   r   r   r   r   ZOutput.vendorF   s     4<<?8,--r   c                r*   )zProduct name of the outputr   r+   r   r   r   r   ZOutput.productK   s     4<<?9-..r   c                r*   )z;A human readable name of this output, to be shown in the UIdisplay-namer+   r   r   r   r   ZOutput.display_nameP   s     4<<?>233r   c                r*   )z%True if the output is the primary oneprimary)boolr	   r   r   r   
is_primaryZOutput.is_primaryU   s     DLLOI.//r   r   N)__name__
__module____qualname____firstlineno____doc__r   r   propertyr   r   r   r    r"   r%   r(   r)   r   r   r   r0   __static_attributes____classdictcell__Z__classdict__   @r   r   r      s    5#W           = =     . . / / 4 4 0 0r   r   c                   s   a  ] tR t^[t o RtR tR tR t]R 4       t	]R 4       t
]R 4       t]R 4       t]R	 4       t]R
 4       tRtV tR# )DisplayModez:Representation of a screen mode (resolution, refresh rate)c                r   r   	mode_info)r
   r=   r   r   r   ZDisplayMode.__init__^       "r   c                sX    V P                   : R V P                  : RV P                  : 2# )x@widthheight	frequencyr   r   r   __str__ZDisplayMode.__str__a   s    !ZZdnnEEr   c                r   )z<DisplayMode: r?   r@   Z>rA   r   r   r   r   ZDisplayMode.__repr__d   s    ,0JJT^^TTr   c                :    \        V P                  ^ ,          4      # )zID of the moder,   r=   r   r   r   idZDisplayMode.idg        4>>!$%%r   c                :    \        V P                  ^,          4      # )zthe low-level ID of this moderG   r   r   r   r   ZDisplayMode.winsys_idl   rI   r   c                :    \        V P                  ^,          4      # zwidth in physical pixelsr#   r=   r   r   r   rB   ZDisplayMode.widthq   rI   r   c                :    \        V P                  ^,          4      # zheight in physical pixelsrM   r   r   r   rC   ZDisplayMode.heightv   rI   r   c                :    \        V P                  ^,          4      # zrefresh raterG   r   r   r   rD   ZDisplayMode.frequency{   rI   r   c                (    V P                   ^,          # )z2mode flags as defined in xf86drmMode.h and randr.hr<   r   r   r   flagsZDisplayMode.flags        ~~a  r   r<   N)r1   r2   r3   r4   r5   r   rE   r   r6   rH   r   rB   rC   rD   rS   r7   r8   r9   r:   r   r;   r;   [   s     D#FU & & & & & & & & & & ! !r   r;   c                   s   a  ] tR t^t o RtR tR t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       t]R	 4       t]R
 4       t]R 4       tRtV tR# )CRTCa
  A CRTC (CRT controller) is a logical monitor, ie a portion of the
compositor coordinate space. It might correspond to multiple monitors, when
in clone mode, but not that it is possible to implement clone mode also by
setting different CRTCs to the same coordinates.
c                r   r   	crtc_info)r
   rW   r   r   r   ZCRTC.__init__   r>   r   c                sX    V P                   : R V P                  : R V P                  : 2# )r   )rH   geometry_strcurrent_moder   r   r   r   ZCRTC.__repr__   s    !WWd&7&79J9JKKr   c                rF   )zThe ID in the API of this CRTCr,   rW   r   r   r   rH   ZCRTC.id   rI   r   c                r   )zbthe low-level ID of this CRTC
(which might be a XID, a KMS handle or something entirely different)rV   r   r   r   r   ZCRTC.winsys_id   s     ~~a  r   c                s   RV P                   ^ ,          V P                   ^,          V P                   ^,          ^ 8  d   RMRV P                   ^,          V P                   ^,          ^ 8  d   RMRV P                   ^,          3,          # )z6Return a human readable representation of the geometryz%dx%d%s%d%s%dZ Z+)geometryr   r   r   rX   ZCRTC.geometry_str   sp     MM!MM!--"Q&BCMM!--"Q&BCMM!"
 
 	
r   c                s    \        V P                  ^,          4      \        V P                  ^,          4      \        V P                  ^,          4      \        V P                  ^,          4      3# )zGThe geometry of this CRTC
(might be invalid if the CRTC is not in use)
r#   rW   r   r   r   r[   ZCRTC.geometry   sQ    
 DNN1%&DNN1,=(>DNNSTDU@VX[\`\j\jkl\mXnoor   c                s:    \        V P                  ^,          4      # )zThe current mode of the CRTC, or -1 if this CRTC is not used
Note: the size of the mode will always correspond to the width
and height of the CRTCr\   r   r   r   rY   ZCRTC.current_mode   s    
 4>>!$%%r   c                s:    \        V P                  ^,          4      # )zCThe current transform (espressed according to the wayland protocol)rZ   r   r   r   current_transformZCRTC.current_transform   rI   r   c                s:    \        V P                  ^,          4      # )zAll possible transformsrZ   r   r   r   
transformsZCRTC.transforms   rI   r   c                s:    \        V P                  ^	,          4      # )zOther high-level properties that affect this CRTC;
they are not necessarily reflected in the hardware.
No property is specified in this version of the API.
rZ   r   r   r   r)   ZCRTC.properties   s     4>>!$%%r   rV   N)r1   r2   r3   r4   r5   r   r   r6   rH   r   rX   r[   rY   r]   r^   r)   r7   r8   r9   r:   r   rU   rU      s     #L & & ! !
 	
 	
 p p & & & & & & & &r   rU   c                   s   a  ] tR t^t o Rt]R 4       t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       tR	tV tR
# )MonitorModezRepresents a mode given by a Monitor instance
In addition to DisplayMode objects, this gives acces to the current scaling
used and some additional properties like is_current.
c                rJ   rL   rM   r   r   r   rB   ZMonitorMode.width   rI   r   c                rK   rO   rM   r   r   r   rC   ZMonitorMode.height   rI   r   c                rN   rQ   rG   r   r   r   rD   ZMonitorMode.frequency   rI   r   c                rP   )z#scale preferred as per calculations)Zfloatr=   r   r   r   scaleZMonitorMode.scale   s     T^^A&''r   c                rR   )zscales supported by this moder<   r   r   r   supported_scaleZMonitorMode.supported_scale   rT   r   c                r'   )zAdditional propertiesr<   r   r   r   r)   ZMonitorMode.properties   rT   r   c                s     RV P                   9   # )z*Return True if the mode is the current onez
is-current)r)   r   r   r   
is_currentZMonitorMode.is_current   s     t..r    N)r1   r2   r3   r4   r5   r6   rB   rC   rD   r`   ra   r)   rb   r7   r8   r9   r:   r   r_   r_      s     
 & & & & & & ( ( ! ! ! ! / /r   r_   c                   s   a  ] tR t^t o RtR tR tR tR t]	R 4       t
]	R 4       t]	R 4       t]	R	 4       t]	R
 4       t]	R 4       t]	R 4       tRtV tR# )MonitorzA physical monitorc                r   r   _monitorr
   monitorr   r   r   ZMonitor.__init__   s    r   c                s`    V P                  4        F  pVP                  '       g   K  Vu # 	  R# )Return the current modeN)	get_modesrb   r
   moder$   r   get_current_modeZMonitor.get_current_mode   s&    NN$D % 	r   c                d    V P                   ^,           Uu. uF  p\        V4      NK  	  up# u upi )zReturn available modes)rf   r_   rk   r$   r   rj   ZMonitor.get_modes  s*    .2mmA.>?.>dD!.>???r&   c                s    VP                  R4       Uu. uF  p\        V4      NK  	  upw  r4V P                  4        F+  pVP                  V8X  g   K  VP                  V8X  g   K)  Vu # 	  R# u upi z1Return an appropriate mode for a given resolutionr?   N)splitr#   rj   rB   rC   r
   
resolutionZirB   rC   rl      &&    r   get_mode_for_resolutionZMonitor.get_mode_for_resolution  sa    )3)9)9#)>?)>AQ)>?NN$DzzU"t{{f'< % 		 @s   A.c                sH    \        V P                  ^ ,          ^ ,          4      # )zName of the connectorr,   rf   r   r   r   r"   ZMonitor.name       4==#A&''r   c                sH    \        V P                  ^ ,          ^,          4      # )zManufacturer of the monitorru   r   r   r   r   ZMonitor.vendor  rv   r   c                sH    \        V P                  ^ ,          ^,          4      # )zModel name of the monitorru   r   r   r   modelZMonitor.model  rv   r   c                sH    \        V P                  ^ ,          ^,          4      # )zSerial numberru   r   r   r   serial_numberZMonitor.serial_number  rv   r   c                H    \        V P                  ^,          R,          4      # )z+Return true if the monitor is underscanningzis-underscanningr/   rf   r   r   r   is_underscanningZMonitor.is_underscanning"  s     DMM!$%7899r   c                ry   )zHReturn true if the display is builtin the machine (a laptop or a tablet)z
is-builtinrz   r   r   r   
is_builtinZMonitor.is_builtin'  s     DMM!$\233r   c                ry   )z"Human readable name of the displayr-   ru   r   r   r   r   ZMonitor.display_name,  s     4==#N344r   re   N)r1   r2   r3   r4   r5   r   rm   rj   rt   r6   r"   r   rw   rx   r{   r|   r   r7   r8   r9   r:   r   rd   rd      s      @ ( ( ( ( ( ( ( ( : : 4 4 5 5r   rd   c                   s   a  ] tR tRt o RtR t]R 4       t]R 4       t]R 4       t	]R 4       t
R t]R	 4       t]R
 4       tR tRtV tR# )LogicalMonitori2  z[A logical monitor. Similar to CRTCs but logical monitors also contain
scaling information.
c                s    Wn         W n        R # r   _lm	_monitors)r
   Zlm_infomonitorss   &&&r   r   ZLogicalMonitor.__init__7  s    !r   c                sr    \        V P                  ^ ,          4      \        V P                  ^,          4      3# )z"Return the position of the monitor)r#   r   r   r   r   positionZLogicalMonitor.position;  s)     488A;TXXa[!111r   c                r   )ZScaler   r   r   r   r`   ZLogicalMonitor.scale@       xx{r   c                r   )u   Transforms

Possible transform values:
0: normal
1: 90°
2: 180°
3: 270°
4: flipped
5: 90° flipped
6: 180° flipped
7: 270° flipped
r   r   r   r   	transformZLogicalMonitor.transformE  s     xx{r   c                rP   )z+True if this is the primary logical monitor)r/   r   r   r   r   r.   ZLogicalMonitor.primaryU  s     DHHQK  r   c                sh    V P                    F!  pVP                  \        V4      8X  g   K  Vu # 	  R# )z1Return a Monitor instance from its connector nameN)r   r"   r,   )r
   Z	connectorrh   s   && r   _get_monitor_for_connectorZ)LogicalMonitor._get_monitor_for_connectorZ  s*    ~~G||s9~- & 	r   c                s|    V P                   ^,           Uu. uF  qP                  V^ ,          4      NK  	  up# u upi )z(Monitors displaying that logical monitor)r   r   )r
   Zmr$   r   r   ZLogicalMonitor.monitorsa  s3     @Dxx{K{!//!5{KKKs    9c                r'   )zPossibly other propertiesr   r   r   r   r)   ZLogicalMonitor.propertiesf  r   r   c                s,   V P                    Uu. uF(  qP                  VP                  4       P                  3NK*  	  pp\	        W P                   ^ ,          P                  V P
                  V P                  V P                  V P                  4      # u upi )zIExport the current configuration so it can be stored then reapplied later)	r   r"   rm   rH   r   r   r   r.   r`   )r
   rh   r      &  r   
get_configZLogicalMonitor.get_configk  sr    QUQ^Q^_Q^g\\7#;#;#=#@#@AQ^_X}}Q'7'<'<dmmT^^]a]i]ikokukuvv `s   .Br~   N)r1   r2   r3   r4   r5   r   r6   r   r`   r   r.   r   r   r)   r   r7   r8   r9   r:   r   r}   r}   2  s     " 2 2     ! ! L L  w wr   r}   c                   s   a  ] tR tRt o RtR tR t]R 4       t]R 4       t	]R 4       t
]R 4       tR	 tR
 tR tRtV tR# )DisplayStateiq  z3Snapshot of a display configuration at a given timec                s<    Wn         V P                  4       V n        R # r   )	interface
load_state_state)r
   r   r   r   r   ZDisplayState.__init__t  s    "oo'r   c                6    V P                   P                  4       # )z(Return current state from dbus interface)r   ZGetCurrentStater   r   r   r   ZDisplayState.load_statex  s    ~~--//r   c                r   )zConfiguration serialr   r   r   r   serialZDisplayState.serial|       {{1~r   c                rn   )zAvailable monitors)r   rd   rg   r$   r   r   ZDisplayState.monitors  s)     15A?W ???r&   c                sx    V P                   ^,           Uu. uF  p\        WP                  4      NK  	  up# u upi )z%Current logical monitor configuration)r   r}   r   )r
   Zl_mr$   r   logical_monitorsZDisplayState.logical_monitors  s.     ?Ckk!nMnssMM2nMMMs   7c                r   )z Display configuration propertiesr   r   r   r   r)   ZDisplayState.properties  r   r   c                sX    V P                    F  pVP                  '       g   K  Vu # 	  R# )"Return the primary logical monitorN)r   r.   r
   Zlmr$   r   get_primary_logical_monitorZ(DisplayState.get_primary_logical_monitor  s%    ''Bzzz	 ( r   c                s~    V P                  4       pV'       d   VP                  ^ ,          # V P                  ^ ,          # zBReturns the first physical monitor on the primary logical monitor.)r   r   r   r$   r   get_primary_monitorZ DisplayState.get_primary_monitor  s0    --/;;q>!}}Qr   c                s>    V P                  4       P                  4       # )ri   )r   rm   r   r   r   rm   ZDisplayState.get_current_mode  s    '')::<<r   )r   r   N)r1   r2   r3   r4   r5   r   r   r6   r   r   r   r)   r   r   rm   r7   r8   r9   r:   r   r   r   q  sz     =(0   @ @ N N   = =r   r   c                   s   a  ] tR tRt o RtRtRt^ t^t^t	R t
]R 4       t]R 4       t]R 4       t]R	 4       t]R
 4       t]R 4       tR tR tR tR tRtV tR# )MutterDisplayConfigi  z7Class to interact with the Mutter.DisplayConfig servicezorg.gnome.Mutter.DisplayConfigz/org/gnome/Mutter/DisplayConfigc                s:   \         P                  ! 4       pVP                  V P                  V P                  4      p\         P
                  ! W P                  R 7      V n        V P                  P                  4       V n        \        V P                  4      V n
        R# ))Zdbus_interfaceN)dbusZ
SessionBusZ
get_object	namespace	dbus_pathZ	Interfacer   GetResources	resourcesr   current_state)r
   Zsession_busZ	proxy_objr   r   r   ZMutterDisplayConfig.__init__  sa    oo'**4>>4>>J		..Q446)$..9r   c                r   )a   
@serial is an unique identifier representing the current state
of the screen. It must be passed back to ApplyConfiguration()
and will be increased for every configuration change (so that
mutter can detect that the new configuration is based on old
state)
r   r   r   r   r   ZMutterDisplayConfig.serial  s     ~~a  r   c                rn   )a  
A CRTC (CRT controller) is a logical monitor, ie a portion
of the compositor coordinate space. It might correspond
to multiple monitors, when in clone mode, but not that
it is possible to implement clone mode also by setting different
CRTCs to the same coordinates.

The number of CRTCs represent the maximum number of monitors
that can be set to expand and it is a HW constraint; if more
monitors are connected, then necessarily some will clone. This
is complementary to the concept of the encoder (not exposed in
the API), which groups outputs that necessarily will show the
same image (again a HW constraint).

A CRTC is represented by a DBus structure with the following
layout:
* u ID: the ID in the API of this CRTC
* x winsys_id: the low-level ID of this CRTC (which might
            be a XID, a KMS handle or something entirely
            different)
* i x, y, width, height: the geometry of this CRTC
                        (might be invalid if the CRTC is not in
                        use)
* i current_mode: the current mode of the CRTC, or -1 if this
                CRTC is not used
                Note: the size of the mode will always correspond
                to the width and height of the CRTC
* u current_transform: the current transform (espressed according
                    to the wayland protocol)
* au transforms: all possible transforms
* a{sv} properties: other high-level properties that affect this
                    CRTC; they are not necessarily reflected in
                    the hardware.
                    No property is specified in this version of the API.

Note: all geometry information refers to the untransformed
display.
)r   rU   )r
   Zcrtcr$   r   r    ZMutterDisplayConfig.crtcs  s,    P (,~~a'89'8tT
'8999r&   c                sd    V P                   ^,           Uu. uF  p\        V4      NK  	  up# u upi )a4	  
An output represents a physical screen, connected somewhere to
the computer. Floating connectors are not exposed in the API.
An output is a DBus struct with the following fields:
* u ID: the ID in the API
* x winsys_id: the low-level ID of this output (XID or KMS handle)
* i current_crtc: the CRTC that is currently driving this output,
                  or -1 if the output is disabled
* au possible_crtcs: all CRTCs that can control this output
* s name: the name of the connector to which the output is attached
          (like VGA1 or HDMI)
* au modes: valid modes for this output
* au clones: valid clones for this output, ie other outputs that
             can be assigned the same CRTC as this one; if you
             want to mirror two outputs that don't have each other
             in the clone list, you must configure two different
             CRTCs for the same geometry
* a{sv} properties: other high-level properties that affect this
                    output; they are not necessarily reflected in
                    the hardware.
                    Known properties:
                    - "vendor" (s): (readonly) the human readable name
                                    of the manufacturer
                    - "product" (s): (readonly) the human readable name
                                     of the display model
                    - "serial" (s): (readonly) the serial number of this
                                    particular hardware part
                    - "display-name" (s): (readonly) a human readable name
                                          of this output, to be shown in the UI
                    - "backlight" (i): (readonly, use the specific interface)
                                       the backlight value as a percentage
                                       (-1 if not supported)
                    - "primary" (b): whether this output is primary
                                     or not
                    - "presentation" (b): whether this output is
                                          for presentation only
                    Note: properties might be ignored if not consistenly
                    applied to all outputs in the same clone group. In
                    general, it's expected that presentation or primary
                    outputs will not be cloned.
)r   r   r
   Zoutputr$   r   outputsZMutterDisplayConfig.outputs  s,    V .2^^A->?->6v->???r&   c                sd    V P                   ^,           Uu. uF  p\        V4      NK  	  up# u upi )ab  
A mode represents a set of parameters that are applied to
each output, such as resolution and refresh rate. It is a separate
object so that it can be referenced by CRTCs and outputs.
Multiple outputs in the same CRTCs must all have the same mode.
A mode is exposed as:
* u ID: the ID in the API
* x winsys_id: the low-level ID of this mode
* u width, height: the resolution
* d frequency: refresh rate
* u flags: mode flags as defined in xf86drmMode.h and randr.h

Output and modes are read-only objects (except for output properties),
they can change only in accordance to HW changes (such as hotplugging
a monitor), while CRTCs can be changed with ApplyConfiguration().

XXX: actually, if you insist enough, you can add new modes
through xrandr command line or the KMS API, overriding what the
kernel driver and the EDID say.
Usually, it only matters with old cards with broken drivers, or
old monitors with broken EDIDs, but it happens more often with
projectors (if for example the kernel driver doesn't add the
640x480 - 800x600 - 1024x768 default modes). Probably something
that we need to handle in mutter anyway.
)r   r;   rk   r$   r   r%   ZMutterDisplayConfig.modes  s,    6 /3nnQ.?@.?dD!.?@@@r&   c                r!   )zMaximum width supportedr   r   r   r   max_screen_widthZ$MutterDisplayConfig.max_screen_width4  rT   r   c                rR   )zMaximum height supportedr   r   r   r   max_screen_heightZ%MutterDisplayConfig.max_screen_height9  rT   r   c                s    VP                  R4       Uu. uF  p\        V4      NK  	  upw  r4V P                   F+  pVP                  V8X  g   K  VP                  V8X  g   K)  Vu # 	  R# u upi ro   )rp   r#   r%   rB   rC   rq   rs   r   rt   Z+MutterDisplayConfig.get_mode_for_resolution>  s^    )3)9)9#)>?)>AQ)>?JJDzzU"t{{f'<  		 @s   A*c                r   )r   )r   r   r   r   r   r   Z/MutterDisplayConfig.get_primary_logical_monitorF  s    !!==??r   c                r   r   )r   r   r   r   r   r   Z'MutterDisplayConfig.get_primary_monitorJ  s    !!5577r   c                s   V'       g   \         P                  ! R4       R# V P                  P                  4       V n        \        V P                  4      V n        V UUUu. uF  pVP                  ^ ,          VP                  ^,          \        P                  ! VP                  4      \        P                  ! VP                  4      VP                  VP                   UUu. uFD  w  r4\        P                  ! \!        V4      4      \        P                  ! \!        V4      4      / .NKF  	  upp.NK  	  ppppV P                  P#                  V P                  P$                  V P&                  V/ 4       R# u uppi u upppi )z2Set the selected display to the desired resolutionz.No display config given, not applying anythingN)r   errorr   r   r   r   r   r   r   ZDoubler`   ZUInt32r   r.   r   ZStringr,   ZApplyMonitorsConfigr   TEMPORARY_METHOD)r
   Zdisplay_configsconfigr   rl   Zmonitors_configrs   r   apply_monitors_configZ)MutterDisplayConfig.apply_monitors_configN  s#    LLIJ446)$..9 *
 * ""FLL)F,,- /5oo.=* [[\!23T[[T5KRP.=
 * 	 
 	**4+=+=+D+DdF[F[]lnpq
s    BE<!A
E6+	E<6E<)r   r   r   N)r1   r2   r3   r4   r5   r   r   ZVERIFY_METHODr   ZPERSISTENT_METHODr   r6   r   r    r   r%   r   r   rt   r   r   r   r7   r8   r9   r:   r   r   r     s     A0I1I M: ! ! ': ':R *@ *@X A A8 ! ! ! !@8r rr   r   c                   sH   a  ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )MutterDisplayManagerig  z/Manage displays using the DBus Mutter interfacec                s$    \        4       V n        R # r   )r   display_configr   r   r   r   ZMutterDisplayManager.__init__j  s    13r   c                s    V P                   P                  P                   Uu. uF  qP                  4       NK  	  up# u upi )z9Return the current configuration for each logical monitor)r   r   r   r   )r
   Zlogical_monitorr$   r   r   ZMutterDisplayManager.get_configm  s5    DHDWDWDeDeDvDvwDv**,Dvwwws   >c                sj    V P                   P                   Uu. uF  qP                  NK  	  up# u upi )z*Return display names of connected displays)r   r   r   r   r$   r   get_display_namesZ&MutterDisplayManager.get_display_namesq  s,    262E2E2M2MN2M##2MNNNs   0c                s   V P                   P                   Uu. uF  qP                  : RVP                  : 2NK!  	  ppV'       g)   \        P
                  ! R4       \        : R\        : 2.# \        \        V4      R RR7      # u upi )zReturn available resolutionsr?   z"Could not generate resolution listc                 sD    \        V P                  R 4      ^ ,          4      # r?   )r#   rp   r   r   r   Z<lambda>Z6MutterDisplayManager.get_resolutions.<locals>.<lambda>{  s    c!''#,q/6Jr   T)ZkeyZreverse)
r   r%   rB   rC   r   r   r   r   ZsortedZset)r
   rl   Zresolutionsr   r   get_resolutionsZ$MutterDisplayManager.get_resolutionsu  sj    GKGZGZG`G`aG`t**dkk:G`aLL=>79RSTTc+&,JTXYY	 bs   %Bc                sB   \         P                  ! R4       V P                  P                  P	                  4       pV'       g5   \         P
                  ! R4       \        \        4      \        \        4      3# \        VP                  4      \        VP                  4      3# )z5Return the current resolution for the primary displayzRetrieving current resolutionz+Could not retrieve the current display mode)r   Zdebugr   r   rm   r   r,   r   r   rB   rC   )r
   rY   r$   r   get_current_resolutionZ+MutterDisplayManager.get_current_resolution}  sq    45**88IIKLLFG/0#6O2PPP<%%&L,?,?(@@@r   c                s   \        V\        4      '       d   V P                  P                  4       pVP	                  V4      pV'       g   \
        P                  ! RV4       R# \        VP                  VP                  3.VP                  R^ RR4      .pV P                  P                  V4       M&V'       d   V P                  P                  V4       MR# \        4       V n        R# )zChange the current resolutionz!Could not find  valid mode for %sNTg      ?)    r   )Z
isinstancer,   r   r   rt   r   r   r   r"   rH   r   r   )r
   rr   rh   rl   r   s   &&   r   set_resolutionZ#MutterDisplayManager.set_resolution  s    j#&&))==?G22:>D@*M#gllDGG%<$=w||VUVX\^abcF55f=55jA 23r   )r   N)r1   r2   r3   r4   r5   r   r   r   r   r   r   r7   r8   r9   r:   r   r   r   g  s/     94xOZA4 4r   r   )r   r"   r   r   r.   r`   )r5   Zcollectionsr    r   Zlutris.settingsr   r   Zlutris.util.logr   r   r   r;   rU   r_   rd   r}   r   r   r   rc   r   r   <module>r      s    / "  O "?,mnK0 K0\(! (!VB& B&J'/+ '/T:5 :5z<w <w~/= /=dAr ArH/4 /4r   