
    qV]                     Z    d dl Z d dlZd Zd Zd Zd Zd Zd Zd Z G d	 d
          Z	dS )    Nc                      t          j        t           j        t           j        z  t           j                  } d | D             S )zHReturns a list of strings of window titles for all visible windows.
    c                 x    g | ]7}|t           j                 d |                    t           j        d          8S )  )QuartzkCGWindowOwnerNamegetkCGWindowName).0wins     a/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/pygetwindow/_pygetwindow_macos.py
<listcomp>z getAllTitles.<locals>.<listcomp>   sA    mmm^as64555swwv?SUW7X7X7XYmmm    )r   CGWindowListCopyWindowInfo#kCGWindowListExcludeDesktopElementskCGWindowListOptionOnScreenOnlykCGNullWindowID)windowss    r   getAllTitlesr      sP    
 /0Z]c  ^D  1D  FL  F\  ]  ]Gmmelmmmmr   c                     t          j        t           j        t           j        z  t           j                  } | D ]E}|d         dk    r7|t           j                 d|                    t           j        d          c S Ft          d          )z7Returns a Window object of the currently active Window.kCGWindowLayerr   r   r   z Could not find an active window.)	r   r   r   r   r   r   r	   r
   	Exception)r   r   s     r   getActiveWindowr      s     /0Z]c  ^D  1D  FL  F\  ]  ]G a a A%%!&";<<<cggfFZ\^>_>_>_```` &
6
7
77r   c           
         t          j        t           j        t           j        z  t           j                  }g }|D ]}|d         }t          j        | ||d         |d         |d         |d                   rH|                    |t           j                 d|	                    t           j
        d                     |S )NkCGWindowBoundsXYWidthHeightr   r   )r   r   r   r   r   pygetwindowpointInRectappendr   r	   r
   )xyr   matchesr   ws         r   getWindowsAtr'      s    /0Z]c  ^D  1D  FL  F\  ]  ]GG j j!""1a337Qx[QQ 	jNNc&*C&D&D&DcggfNbdfFgFgFghiiiNr   c                      d S N r*   r   r   activater+   $   s	    
 	Dr   c                 :   t          j        t           j        t           j        z  t           j                  }|D ]a}| |t           j                 d|                    t           j        d          v r(|d         }|d         |d         |d         |d         fc S bd S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r	   r
   )titler   r   r&   s       r   getWindowGeometryr/   ,   s    /0Z]c  ^D  1D  FL  F\  ]  ]G = =s6#<===swwvG[]_?`?`?`aaa%&AcFAcFAgJ(<<<< b= =r   c                    t          j        t           j        t           j        z  t           j                  }|D ]G}| |t           j                 d|                    t           j        d          v r|d         dk    c S Hd S )Nr   r   kCGWindowAlphag        r-   )r.   r   r   s      r   	isVisibler2   5   s    /0Z]c  ^D  1D  FL  F\  ]  ]G 0 0s6#<===swwvG[]_?`?`?`aaa'(C//// b0 0r   c                      d S r)   r*   r*   r   r   isMinimizedr4   <   s	     	Dr   c                       e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zed             Zed             Zed             Zed             Zed             ZdS )MacOSWindowc                      | _          fd} fd}                     t                     }t                              |j        |j        |j        |j        z
  |j        |j        z
  ||           _        d S )Nc                                          t                    }|j        j        _        |j        j        _        |j        |j        z
  j        _        |j	        |j        z
  j        _
        d S r)   )_getWindowRect_hWndleft_rect_lefttop_topright_widthbottom_height)attrNamerselfs     r   _onReadz%MacOSWindow.__init__.<locals>._onReadJ   sY    ##E**A vDJeDJO !!& 0DJ!"AE!1DJr   c                                          |j        |j                                       |j        |j                   d S r)   )moveTor;   r>   resizeTowidthheight)oldBoxnewBoxrF   s     r   	_onChangez'MacOSWindow.__init__.<locals>._onChangeQ   s9    KKVZ000MM&,66666r   )onChangeonRead)	r:   r9   pyrectRectr;   r>   r@   rB   r<   )rF   hWndrG   rO   rE   s   `    r   __init__zMacOSWindow.__init__G   s    
	2 	2 	2 	2 	2	7 	7 	7 	7 	7 &&[[!&0@!(QUBR]fov[ww


r   c                     |                      t                    }|j        |j        z
  }|j        |j        z
  }d| j        j        d|j        d|j        d|d|d| j        dS )N<z left="z", top="z
", width="z", height="z
", title="z">)	r9   r:   r@   r;   rB   r>   	__class____name__r.   )rF   rE   rK   rL   s       r   __str__zMacOSWindow.__str__X   s    &&!& AE!RVR`RiRiRiklkqkqkqstsxsxsxzzz  BH  BH  BH  JN  JT  JT  JT  U  	Ur   c                 0    | j         j        d| j        dS )Nz(hWnd=))rX   rY   r:   rF   s    r   __repr__zMacOSWindow.__repr___   s     $ 7 7 7DDr   c                 L    t          |t                    o| j        |j        k    S r)   )
isinstancer6   r:   )rF   others     r   __eq__zMacOSWindow.__eq__c   s     %--K$*2KKr   c                     t           )zCloses this window. This may trigger "Are you sure you want to
        quit?" dialogs or other actions that prevent the window from
        actually closing. This is identical to clicking the X button on the
        window.NotImplementedErrorr]   s    r   closezMacOSWindow.closeg   s
    
 "!r   c                     t           )zMinimizes this window.rd   r]   s    r   minimizezMacOSWindow.minimizen       !!r   c                     t           )zMaximizes this window.rd   r]   s    r   maximizezMacOSWindow.maximizes   ri   r   c                     t           )zCIf maximized or minimized, restores the window to it's normal size.rd   r]   s    r   restorezMacOSWindow.restorex   ri   r   c                     t           )z7Activate this window and make it the foreground window.rd   r]   s    r   r+   zMacOSWindow.activate}   ri   r   c                     t           )z0Resizes the window relative to its current size.rd   )rF   widthOffsetheightOffsets      r   	resizeRelzMacOSWindow.resizeRel   ri   r   c                     t           )z-Resizes the window to a new width and height.rd   )rF   newWidth	newHeights      r   rJ   zMacOSWindow.resizeTo   ri   r   c                     t           )z2Moves the window relative to its current position.rd   )rF   xOffsetyOffsets      r   moveRelzMacOSWindow.moveRel   ri   r   c                     t           )z2Moves the window to new coordinates on the screen.rd   )rF   newLeftnewTops      r   rI   zMacOSWindow.moveTo   ri   r   c                     t           )z2Returns True if the window is currently minimized.rd   r]   s    r   r4   zMacOSWindow.isMinimized   
     "!r   c                     t           )z2Returns True if the window is currently maximized.rd   r]   s    r   isMaximizedzMacOSWindow.isMaximized   r~   r   c                     t           )zFReturns True if the window is currently the active, foreground window.rd   r]   s    r   isActivezMacOSWindow.isActive   r~   r   c                     t           )z%Returns the window title as a string.rd   r]   s    r   r.   zMacOSWindow.title   r~   r   c                     t           r)   rd   r]   s    r   visiblezMacOSWindow.visible   ri   r   N)rY   
__module____qualname__rU   rZ   r^   rb   rf   rh   rk   rm   r+   rr   rJ   ry   rI   propertyr4   r   r   r.   r   r*   r   r   r6   r6   F   sj       x x x"U U UE E EL L L" " "" " "
" " "
" " "
" " "
" " "
" " "
" " "
" " "
 " " X" " " X" " " X" " " X" " " X" " "r   r6   )
r   r    r   r   r'   r+   r/   r2   r4   r6   r*   r   r   <module>r      s        n n n8 8 8  	 	 	= = =0 0 0	 	 	f" f" f" f" f" f" f" f" f" f"r   