
    Eg	                     <    d dl mZ d dlZd dlmZ dZ G d d      Zy)    )GdkN)KeyBindingsd   c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)EventHandlera_  
    The EventHandler receives all user key, button and motion events
    for the application.  At various points it can be receiving them
    from the Stage window, an offscreen window, or the root GdkWindow.

    All events are stopped from passing beyond this point, to prevent
    any unintended events from propagating to Cinnamon or Muffin.
    c                 N    || _         t        |      | _        d| _        d| _        y )N)managerr   keybindings_handlerlast_xlast_y)selfr
   s     4/usr/share/cinnamon-screensaver/util/eventHandler.py__init__zEventHandler.__init__   s$    #.w#7     c                 8    | j                   j                          y)z
        Any user event is a 'wake' event, and is propagated to the stage
        in order to reset our unlock cancellation timer.
        N)r
   simulate_user_activity)r   s    r   on_user_activityzEventHandler.on_user_activity   s    
 	++-r   c                    t         j                  r | j                          t        j                  S | j
                  dk(  s| j                  dk(  r2|j                  | _        |j                  | _        t        j                  S t        t        | j
                  |j                  z
        t        | j                  |j                  z
              }|t        kD  r| j                          t        j                  S )z
        Any mouse movement is sent here - there is a threshold to reach when
        asleep, so that inadvertent motion doesn't wake the system unintentionally.
        r	   )statusAwaker   r   EVENT_PROPAGATEr   r   xymaxabsMOTION_THRESHOLD)r   eventdistances      r   on_motion_eventzEventHandler.on_motion_event"   s    
 <<!!#&&&;;"r 1''DK''DK&&&s4;;013t{{UWW7L3MN&&!!#"""r   c                 B    | j                          t        j                  S )z
        Any button presses are swallowed after interacting
        with their receiving widgets (in the case of buttons, entry, etc...)
        )r   r   
EVENT_STOPr   r   s     r   on_button_press_eventz"EventHandler.on_button_press_event7   s    
 	~~r   c                    | j                   j                  |      rt        j                  S t        j
                  r+t        j                  r| j                  j                  |       | j                          t        j                  S )z
        Any key events are checked with the KeybindingHandler in case
        a media shortcut is being used, or it's a special keystroke such
        as Escape or tab.

        Any other presses are sent to the password entry or swallowed.
        )
r   maybe_handle_eventr   r"   r   ActiveLockedr
   queue_dialog_key_eventr   r#   s     r   on_key_press_eventzEventHandler.on_key_press_event@   sX     ##66u=>>!==}}33E:~~r   N)	__name__
__module____qualname____doc__r   r   r    r$   r*    r   r   r   r   
   s     .#*r   r   )gi.repositoryr   r   util.keybindingsr   r   r   r/   r   r   <module>r2      s"      ( G Gr   