%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/orca/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/orca/__pycache__/input_event.cpython-312.pyc

�

g
f_���r�dZdZdZdZdZdZddlZejdd	�dd
lm	Z	ddl
Z
ddlZddlmZddlm
Z
d
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZdZdZdZGd�d�Zd�ZGd�de�Z Gd �d!e�Z!Gd"�d#e�Z"Gd$�d%�Z#y)&z+Provides support for handling input events.z$Id$z
$Revision$z$Date$zQCopyright (c) 2005-2008 Sun Microsystems Inc.Copyright (c) 2011-2016 Igalia, S.L.�LGPL�N�Atspiz2.0)r)�Gdk)�GLib�)�debug)�
focus_manager)�keybindings)�keynames)�messages)�
orca_state)�script_manager)�settings)�AXObject)�AXUtilities�keyboard�braillezmouse:buttonc�$�eZdZd�Zd�Zd�Zd�Zy)�
InputEventc�R�||_tj�|_d|_y)zCCreates a new KEYBOARD_EVENT, BRAILLE_EVENT, or MOUSE_BUTTON_EVENT.rN)�type�time�_clickCount)�self�	eventTypes  �2/usr/lib/python3/dist-packages/orca/input_event.py�__init__zInputEvent.__init__8s ����	��I�I�K��	����c��|jS)z9Return the count of the number of clicks a user has made.)r�rs r�
getClickCountzInputEvent.getClickCount?s�����rc��y)�:Updates the count of the number of clicks a user has made.N�r s r�
setClickCountzInputEvent.setClickCountDs��	
rc��|j�S)�:Returns a single-line string representation of this event.)rr s r�asSingleLineStringzInputEvent.asSingleLineStringIs���)�)��rN)�__name__�
__module__�__qualname__rr!r%r(r$rrrr6s��� �

�
rrc���ddlm}	|ddg�}|jdd��jd�D]&}|j	d	�s�|jd
�cS	y#t$rYywxYw)Nr)�check_output�xkbset�q�ASCII�ignore)�errors�
zSticky-Keys = �OnF)�
subprocessr-�decode�split�
startswith�endswith�	Exception)r-�output�lines   r�_getXkbStickyKeysStater=Nsw��'�
��x��o�.���M�M�'�(�M�;�A�A�$�G�	+�D����/�0��}�}�T�*�*�	+�
���
���
�s�AA�	A�A�	A+�*A+c����eZdZe�ZdZdZdZdZdZ	dZ
dZdZdZ
dZdZdZdZd	Zd
ZdZdZd
ZdZdZgej4�ej6�ej8�ej:�ej<�ej>�ej@�ejB�ejD�ejF�ejH�ejJ�ejL�ejN�ejP�ejR�ejT�ejV�ejX�ejZ�ej\�ej^�ej`�ejb�ejd�ejf�ejh�ejj�ejl�ejn�ejp�ejr�ejt�ejv�ejx�ejz�ej|�ej~�ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ZSgej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��ej��e�j�e�j�e�j�e�j�e�j�e�j
�e�j�e�j�e�j�e�j�Z��fd�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�d�Z�d �Z�d7d!�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�d0�Z�d1�Z�d8d2�Z�d3�Z�d4�Z�d5�Z�d6�Z��xZ�S)9�
KeyboardEventrFN�unknown�	printable�modifier�locking�function�action�
navigation�diacritical�
alphabetic�numeric�punctuation�spacec�l��t�|�t�||_|r tj
j|_ntj
j|_||_	|tjjz|_
|dtjjzzr0|xjdtjjzzc_
||_tj |�|_|jdk(s|jdk(r|j |_t#j"�|_|t&j(t&j*fv|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_!d|_"d|_#|js|j |_tI|j�dkDrR|jtJjLvs|jtJjNvrtQ|j�|_|j jSd�r1|jdtjjzzrd|_#|�rtUjV�jY�|_t[jV�j]�|_|j.r�|j.j^|_t[jV�ja|j2�s�t[jV�jc�|_d|j2g}tejftdjh|d�t[jV�jk|j2�t[jV�jm�|_|j2�r�|j0tojp|j2�k7�r�tUjV�jstojp|j2��|_|j.j^|_d	|j.g}tejftdjh|d��n|ju�r}t&j*j.|_t&j*j2|_t&j*j4|_t&j*j6|_n�tUjV�jY�|_t[jV�j]�|_t[jV�jm�|_|j4|_|j,rtJxjvdz
c_;nd
tJ_;d|_<tojz|j4�}|xs|tj|j~k(}tJj�rd|j��sTtJj�sD|j��}	|	r2|	jt�j�zr|	jtJ_F|j��s=tJj�rdtJ_HdtJ_IndtJ_BdtJ_J|j��r0tJj�|_<|xrt�j�|_O�n�|j��r0tJj�|_<|xrt�j�|_O�n�|j���rtJj�|_<|xrt�j�|_O|j���r1|j,�s$t#j"�}
tJj�rS|r|
tJ_VtJj�tJj�dzkrd|_"|�s�dtJ_BdtJ_J�n�|tJ_G|rdtJ_H|
tJ_I�n�tJj�tJ_BtJj�tJ_J�nT|j��r0tJj�|_<|xrt�j�|_O�n|j��r0tJj�|_<|xrt�j�|_O�n�|j��rctJj�|_<t�j�|_O|j��t�j�|_O|j�xr||_O�na|j��rBtJj�|_<|xr"t�j�xst�j�|_O�n|j��rAtJj�|_<|xr"t�j�xst�j�|_On�|j��rAtJj�|_<|xr"t�j�xst�j�|_Onm|j��rAtJj�|_<|xr"t�j�xst�j�|_OntJj�|_<d|_O|j��s#|j�xrt�j�|_O|j��s|j��t&j�r
|rdtJ_GtJj�r#|xjt�j�zc_
tJj�rb|xjtJj�zc_
|j��r$tJxj�|jzc_Fnd
tJ_F|j��\|_|_y)ahCreates a new InputEvent of type KEYBOARD_EVENT.

        Arguments:
        - pressed: True if this is a key press, False for a release.
        - keycode: the hardware keycode.
        - keysym: the translated keysym.
        - modifiers: a bitflag giving the active modifiers.
        - text: the text that would be inserted if this key is pressed.
        r�� NF�KPTz1INPUT EVENT: Updating window and active window tozINPUT EVENT: Updated script torg�?)s�superr�KEYBOARD_EVENT�idr�	EventType�KEY_PRESSED_EVENTr�KEY_RELEASED_EVENT�hw_coder�ModifierType�
MODIFIER_MASK�	modifiers�NUMLOCK�event_string�keyval_namer�	timestampr
�lastInputEvent�lastNonModifierKeyEvent�is_duplicate�_script�_app�_window�_obj�_obj_after_consuming�_handler�	_consumer�_should_consume�_consume_reason�_did_consume�_result_reason�_bypassOrca�_is_kp_with_numlock�lenr?�GDK_PUNCTUATION_KEYS�GDK_ACCENTED_LETTER_KEYS�chrr8r�
getManager�getActiveScriptr	�get_active_window�app�can_be_active_window�find_active_windowr�printTokens�
LEVEL_INFO�set_active_window�get_locus_of_focusr�get_application�	getScript�$_isReleaseForLastNonModifierKeyEvent�duplicateCount�keyType�get_role�Role�TERMINAL�
stickyKeys�isOrcaModifier�lastOrcaModifierAlone�_getDoubleClickCandidater
�ORCA_MODIFIER_MASK�orcaStickyModifiers�orcaModifierPressed�currentOrcaModifierAlone�currentOrcaModifierAloneTime�lastOrcaModifierAloneTime�isNavigationKey�TYPE_NAVIGATIONr�enableNavigationKeys�
shouldEcho�isActionKey�TYPE_ACTION�enableActionKeys�
isModifierKey�
TYPE_MODIFIER�enableModifierKeys�secondOrcaModifierTime�
isFunctionKey�
TYPE_FUNCTION�enableFunctionKeys�isDiacriticalKey�TYPE_DIACRITICAL�enableDiacriticalKeys�isLockingKey�TYPE_LOCKING�presentLockingKeys�onlySpeakDisplayedText�isAlphabeticKey�TYPE_ALPHABETIC�enableAlphabeticKeys�enableEchoByCharacter�isNumericKey�TYPE_NUMERIC�enableNumericKeys�isPunctuationKey�TYPE_PUNCTUATION�enablePunctuationKeys�isSpace�
TYPE_SPACE�enableSpace�TYPE_UNKNOWN�
enableKeyEchor%�bypassNextCommand�
shouldConsume)r�pressed�keycode�keysymrY�text�tokens�role�_mayEcho�doubleEvent�now�	__class__s           �rrzKeyboardEvent.__init__�s����	����(��������9�9�D�I����:�:�D�I����"�S�%5�%5�%C�%C�C�����U�/�/�7�7�7�8��N�N�q�E�$6�$6�$>�$>�>�?�N� ����?�?�6�2�������#�t�'8�'8�C�'?� $� 0� 0�D�������� �Z�%>�%>�%/�%G�%G�%I�I��������	������	�$(��!���
����#���#��� ���"������#(�� �� � � $� 0� 0�D���t� � �!�A�%����=�=�=�=����=�A�A�A� #�D�G�G��D��
���&�&�t�,��~�~��e�&8�&8�&@�&@�!@�A�+/��(��)�4�4�6�F�F�H�D�L�(�3�3�5�G�G�I�D�L��|�|� �L�L�,�,��	�$�/�/�1�F�F�t�|�|�T�#0�#;�#;�#=�#P�#P�#R�D�L�Q�SW�S_�S_�`�F��%�%�e�&6�&6���E�!�,�,�.�@�@����N�&�0�0�2�E�E�G�D�I��|�|��	�	�X�-E�-E�d�l�l�-S� S�-�8�8�:�D�D��,�,�T�\�\�:� <��� �L�L�,�,��	�:�D�L�L�I���!�!�%�"2�"2�F�D�A�
�
6�
6�
8�%�=�=�E�E�D�L�%�=�=�E�E�D�L�"�:�:�?�?�D�I�(2�(J�(J�(_�(_�D�%�)�4�4�6�F�F�H�D�L�(�3�3�5�G�G�I�D�L�%�0�0�2�E�E�G�D�I�(,�	�	�D�%�����(�(�A�-�(�+,�M�(����� � ����+���9�d�e�j�j�&9�&9�9���#�#�D�,?�,?�,A� �6�6��7�7�9�K���$�$�{�'E�'E�E�5@�4I�4I�
�1��"�"�$��0�0�9>�
�6�=A�
�:�6;�
�3�:>�
�7����!�(�8�8�D�L�&�H�8�+H�+H�D�O�
�
�
�
�(�4�4�D�L�&�D�8�+D�+D�D�O�
�
�
�
!�(�6�6�D�L�&�F�8�+F�+F�D�O��"�"�$�T�->�->��i�i�k�� �6�6��?B�
�<�%�<�<�%�?�?�#�E�F�,0��(�"�>C�
�;�BG�
�?�8?�M�5��AE�
�>�EH�
�B�*�B�B�&�;�*�F�F�&�?�
�
�
�
!�(�6�6�D�L�&�F�8�+F�+F�D�O�
�
"�
"�
$�(�9�9�D�L�&�I�8�+I�+I�D�O�
�
�
�
 �(�5�5�D�L�&�9�9�D�O����&�&.�&E�&E�"E���"�o�o�9�'�D�O�
�
!�
!�
#�(�8�8�D�L�&�V��2�2�T�h�6T�6T�
�O�
�
�
�
 �(�5�5�D�L�&�S��/�/�Q�8�3Q�3Q�
�O�
�
"�
"�
$�(�9�9�D�L�&�W��3�3�U�x�7U�7U�
�O�
�\�\�^�(�3�3�D�L�&�M��)�)�K�X�-K�-K�
�O�)�5�5�D�L�#�D�O�� � �"�"�o�o�H�(�2H�2H�D�O��!�!�#���� ��'�'�G�05�M�-��,�,��N�N�k�<�<�<�N��#�#��N�N�m�?�?�?�N��!�!�#��1�1�T�^�^�C�1�56�
�1�59�5G�5G�5I�2���d�2rc���tj}t|t�rE|j|jk(r,|j
|j
z
tjkr|Sy�N)r
r_�
isinstancer?r[rr�doubleClickTimeout)r�	lastEvents  rr�z&KeyboardEvent._getDoubleClickCandidate�sO���6�6�	��i��/��%�%��):�):�:��y�y�9�>�>�)�X�-H�-H�H���rc���|j�}|sd|_y|j�|_|jry|jt
jjk(ry|jdkrv|j|jk7rGd|jd|jg}tjtj|d�d|_y|xjdz
c_yd|_y)r#rN�z>KEYBOARD EVENT: Resetting click count due to focus change from�toT)
r�rr!r`rrrSrUrdrerrxry)rr�r�s   rr%zKeyboardEvent.setClickCount�s����3�3�5��� �D���&�4�4�6��������9�9����:�:�:�����a�����;�#C�#C�C�Z�%�*�*�D�+�2R�2R�T���!�!�%�"2�"2�F�D�A�#$�� ������!�����rc��|sy|j|jk(r2|j|jk(r|j|jk(Sy�NF)rrVr]�r�others  r�__eq__zKeyboardEvent.__eq__�s=�����9�9��
�
�"�t�|�|�u�}�}�'D��>�>�U�_�_�4�4�rc��|j�r
dx}x}x}x}x}}nH|j}|j}|j}|j}|j
}|j}d|jjj��d�d|�d�zd|�d�zd|�d�zd|�d�zd	|�d�zd
|jzzdtj�d�d�zd
|�d�zd|j�d�zd|j�d�zS)N�*zKEYBOARD_EVENT:  type=r3z                 id=z                 hw_code=z                 modifiers=z                 event_string=(z)
z                 keyval_name=(z                 timestamp=%d
z                 time=�fz                 keyType=z                 clickCount=z                 shouldEcho=)�_shouldObscurerRrVrYr[r\r�r�
value_name�upperr]rrr�)r�keyidrVrYr[r\�key_types       r�__str__zKeyboardEvent.__str__�s_����� �RU�U�E�U�G�U�i�U�,�U��x��G�G�E��l�l�G����I��,�,�L��*�*�K��|�|�H�(����)=�)=�)C�)C�)E�(F�b�I�%�e�W�B�/�0�*�7�)�2�6�7�-�Y�K�r�:�;�1���c�B�	C�
0��}�C�@�A�2�D�N�N�B�
D�(��	�	��A��b�9�:�+�8�*�B�7�8�.�d�.>�.>�-?�r�B�	C�.�d�o�o�->�b�A�
B�
	Brc��|j�ryd|j�d|j�d|j�d|jj
��S)r'�
(obscured)�'z' (z) mods: rN)r�r[r\rYr�
value_nickr s rr(z KeyboardEvent.asSingleLineStringsW����� ����!�!�"�#�d�&6�&6�%7�x����?O�q��y�y�#�#�$�
&�	
rc��tj|j�sy|j�sy|jt
jzs:|jt
jzs|jt
jzryy)NFT)	r�is_password_textrd�isPrintableKeyrYr
�CTRL_MODIFIER_MASK�ALT_MODIFIER_MASKr�r s rr�zKeyboardEvent._shouldObscure
sb���+�+�D�I�I�6���"�"�$���>�>�K�:�:�:��n�n�{�<�<�<��n�n�{�=�=�=��rc��tj}|sy|j�r|j�ry|j|jk(r2|j|jk(r|j
|j
k(Syr�)r
r_�isPressedKeyrRrVrY)r�lasts  rr~z2KeyboardEvent._isReleaseForLastNonModifierKeyEventsb���1�1����� � �"�d�&7�&7�&9���7�7�d�g�g��$�,�,�$�,�,�">��>�>�T�^�^�3�3�rc��|sy|j�r|j�ry|j|jk(xr�|j|jk(xr�|j|jk(xrj|j|jk(xrO|j
|j
k(xr4|j|jk(xr|j|jk(S)z3Return True if this is the release event for other.F)r�rRrVrYr[r\r�rr�s  r�isReleaseForzKeyboardEvent.isReleaseFor(s������!�!�#�t�'8�'8�':���w�w�%�(�(�"�6�����
�
�-�6����%�/�/�1�6��!�!�U�%7�%7�7�6�� � �E�$5�$5�5�	6�
����
�
�-�6�� � �E�$5�$5�5�
	6rc�p�|jr|jtjk(S|jdvS)z(Return True if this is a navigation key.)�Left�Right�Up�Down�Home�End)r�r?r�r[r s rr�zKeyboardEvent.isNavigationKey9s6���<�<��<�<�=�#@�#@�@�@�� � �:�;�	;rc�p�|jr|jtjk(S|jdvS)z%Return True if this is an action key.)�Return�Escape�Tab�	BackSpace�Delete�Page_Up�	Page_Down)r�r?r�r[r s rr�zKeyboardEvent.isActionKeyBs8���<�<��<�<�=�#<�#<�<�<�� � �
%�%�	%rc��|jr|jtjk(St|j�dk(sy|jj�S)z)Return True if this is an alphabetic key.rF)r�r?r�rnr[�isalphar s rr�zKeyboardEvent.isAlphabeticKeyLsK���<�<��<�<�=�#@�#@�@�@��4�$�$�%��*��� � �(�(�*�*rc��|jr|jtjk(S|jj	d�S)z5Return True if this is a non-spacing diacritical key.�dead_)r�r?r�r[r8r s rr�zKeyboardEvent.isDiacriticalKeyWs7���<�<��<�<�=�#A�#A�A�A�� � �+�+�G�4�4rc�p�|jr|jtjk(S|jdvS)z&Return True if this is a function key.)�F1�F2�F3�F4�F5�F6�F7�F8�F9�F10�F11�F12)r�r?r�r[r s rr�zKeyboardEvent.isFunctionKey_s8���<�<��<�<�=�#>�#>�>�>�� � �
4�4�	4rc���|jr|jtjvSgd�}|j|vrytj
s(|js|jtjvSy)z%Return True if this is a locking key.)�	Caps_Lock�
Shift_Lock�Num_Lock�Scroll_LockFT)	r�r?r�r[r
r�rlr�orcaModifierKeys)r�lockingKeyss  rr�zKeyboardEvent.isLockingKeyisa���<�<��<�<�=�#=�#=�=�=�L�����K�/���+�+�D�4D�4D��$�$�H�,E�,E�E�E�rc��|jr|jtjk(S|j�ry|jdvS)z&Return True if this is a modifier key.T)	�Alt_L�Alt_R�	Control_L�	Control_R�Shift_L�Shift_R�Meta_L�Meta_R�ISO_Level3_Shift)r�r?r�r�r[r s rr�zKeyboardEvent.isModifierKeyxsG���<�<��<�<�=�#>�#>�>�>���� ��� � �
!�!�	!rc��|jr|jtjk(St|j�dk(sy|jj�S)z%Return True if this is a numeric key.rF)r�r?r�rnr[�	isnumericr s rr�zKeyboardEvent.isNumericKey�sK���<�<��<�<�=�#=�#=�=�=��4�$�$�%��*��� � �*�*�,�,rc���|rtjry|jtjvry|j
dk(r0dtjvr|jtjzryy)z-Return True if this is the Orca modifier key.FT�KP_0�	KP_Insert)	r
r�r[rrr\rYr
�SHIFT_MODIFIER_MASK)r�checkBypassModes  rr�zKeyboardEvent.isOrcaModifier�s]���z�;�;������ 9� 9�9�����v�%��h�7�7�7��~�~�� ?� ?�?��rc�^�tjry|jtjzS)z)Return True if this key is Orca modified.F)r
r�rYr
r�r s r�isOrcaModifiedzKeyboardEvent.isOrcaModified�s%���'�'���~�~�� >� >�>�>rc��|jS)z5Return True if this is a key pad key with numlock on.)rmr s r�isKeyPadKeyWithNumlockOnz&KeyboardEvent.isKeyPadKeyWithNumlockOn�s���'�'�'rc��|jdvryt|j�dk(sy|jj�S)z'Return True if this is a printable key.�rKrNTrF)r[rn�isprintabler s rr�zKeyboardEvent.isPrintableKey�s@������.���4�$�$�%��*��� � �,�,�.�.rc�P�|jtjjk(S)z"Returns True if the key is pressed)rrrSrTr s rr�zKeyboardEvent.isPressedKey�s���y�y�E�O�O�=�=�=�=rc�6�|jr|jtjk(St|j�dk(sy|j�s|j
�ry|jj�xr|jj�S)z)Return True if this is a punctuation key.rF)	r�r?r�rnr[r�r�r �isspacer s rr�zKeyboardEvent.isPunctuationKey�s|���<�<��<�<�=�#A�#A�A�A��4�$�$�%��*�����!�T�%6�%6�%8��� � �,�,�.�R�t�7H�7H�7P�7P�7R�3R�Rrc�p�|jr|jtjk(S|jdvS)z%Return True if this is the space key.r)r�r?r�r[r s rr�zKeyboardEvent.isSpace�s1���<�<��<�<�=�#;�#;�;�;�� � �N�2�2rc� �|j|k(S)z9Return True if this is associated with the specified app.)rb)rrus  r�isFromApplicationzKeyboardEvent.isFromApplication�s���y�y�C��rc��|j�sytj�j�}|xr|jj|�S)z�Returns True if the script will echo this event as part of
        character echo. We do this to not double-echo a given printable
        character.F)r�rrrrs�	utilities�willEchoCharacter)r�scripts  r�isCharacterEchoablez!KeyboardEvent.isCharacterEchoable�sF��
�"�"�$���*�*�,�<�<�>���B�&�*�*�<�<�T�B�Brc�H�|j�sy|jdk(rtjj}nU|jdk(rtjj
}n+|jdk(rtjj}ny|jd|zzS)z�Returns True if the event locked a locking key, False if the
        event unlocked a locking key, and None if we do not know or this
        is not a locking key.Nrrrr)r�r[rrW�	SHIFTLOCK�SHIFTrZrY)r�mods  r�getLockingStatezKeyboardEvent.getLockingState�s���
� � �"������+��$�$�.�.�C�
�
�
�,�
.��$�$�*�*�C�
�
�
�*�
,��$�$�,�,�C���>�>�Q�#�X�.�.�.rc�l�|j�}|�y|stjStjS)zmReturns the string which reflects the locking state we wish to
        include when presenting a locking key.rM)r0r�LOCKING_KEY_STATE_OFF�LOCKING_KEY_STATE_ON)r�lockeds  r�getLockingStateStringz#KeyboardEvent.getLockingStateString�s5���%�%�'���>����1�1�1��,�,�,rc�@�tj|j�S)zAReturns the string to be used for presenting the key to the user.)r�
getKeyNamer[r s rr7zKeyboardEvent.getKeyNames���"�"�4�#4�#4�5�5rc��|jS)zAReturns the object believed to be associated with this key event.)rdr s r�	getObjectzKeyboardEvent.getObject	s���y�y�rc��|jS)z3Returns the handler associated with this key event.)rfr s r�
getHandlerzKeyboardEvent.getHandlers���}�}�rc�>�	tjj|jj�}|s 	tjjd�}	|j
|�}|S#t
$rd}Y�CwxYw#t
$rd}Y�2wxYw#t
$rd}Y|SwxYw)N�default)r�keyBindingsMap�getrar*r:�getInputHandler)r�bindings�handlers   r�_getUserHandlerzKeyboardEvent._getUserHandlers���	��.�.�2�2�4�<�<�3J�3J�K�H��
 �#�2�2�6�6�y�A��	��.�.�t�4�G�����	��H�	��
�
 ���
 ��
�	��G���	�s4�3A+�A<�B
�+A9�8A9�<B
�	B
�
B�Bc��|jsy|jsy|jrytjrytj
ry|j
�xs%|jjj|�|_	|jduxr|jj�}|j�r|dfS|jjj�r&|jjj|_y|j!�r|j#�sy	y
|jsy|jj�sy|d
fS)z.Returns True if this event should be consumed.)FzNo timestamp)FzNo active script when received�FzIs duplicate�FzCapturing keys�FzBypass next commandNz)Is release for last non-modifier keyevent)Tz
In Learn Mode)Fz#Non-Orca modifier not in Learn Mode�Tz
Orca modifier)Fz
No handler)FzHandler is disabledzScript indication)r]rar`r
�
capturingKeysr�rC�keyBindingsr@rf�
is_enabledr~�learnModePresenter�	is_active�handle_eventrgr�r�)r�scriptConsumess  rr�zKeyboardEvent.shouldConsume&s���~�~�(��|�|�:����(��#�#�*��'�'�/��,�,�.�>��|�|�'�'�7�7��=�	
�
����d�2�Q�t�}�}�7O�7O�7Q���4�4�6�!�#N�N�N��<�<�*�*�4�4�6�!�\�\�<�<�I�I�D�N�(������&�&�(�C�(��}�}�&��}�}�'�'�)�/��2�2�2rc�b�|jsy|j|jjk(Sr�)rf�__func__rD)r�methods  r�isHandledByzKeyboardEvent.isHandledByQs%���}�}�����$�-�-�"8�"8�8�8rc���|j�r|jj�|jjj	�ry|jj|�Sr�)r�ra�presentationInterruptrLrM�presentKeyboardEvent)r�
inputEvents  r�_presentzKeyboardEvent._presentWsL�������L�L�.�.�0��<�<�*�*�4�4�6���|�|�0�0��6�6rc�T�tj�}|j�sd|j|jfz}nd}|jrd|t
jfz}d|jjj��d|�d�}tjtj|d�d|jg}tjtj|d	�d
|jg}tjtj|d	�d|j xs|j"g}tjtj|d	�d|j$|j&g}tjtj|d	�|j)�\|_|_d
|j*|j,g}tjtj|d	�t/j0�j3�}tjtj4k\rW|�U|j7�}|j9�D]2\}}d|�d|��}tjtj|d	��4dtj�|z
d��}tjtj|d	�d|jjj��d|�d�}tjtj|d�|j*S)�Processes this input event.�	'%s' (%d)r�z%s DUPLICATE EVENT #%iz
vvvvv PROCESS �: � vvvvvFz	HOST_APP:TzWINDOW:z	LOCATION:zCONSUME:z	CONSUMED:z
INPUT EVENT: �TOTAL PROCESSING TIME: �.4fz^^^^^ PROCESS � ^^^^^
)rr�r[rVr`r?rrr�r�r�printMessageryrbrxrcrerdrhri�_processrjrkrrrrs�
debugLevel�getTransferableAttributes�items)	r�	startTime�data�msgr�r*�
attributes�key�values	         r�processzKeyboardEvent.process`s����I�I�K�	��"�"�$��$�"3�"3�T�\�\�!B�B�D��D����+�t�]�5Q�5Q�.R�R�D� ����!5�!5�!;�!;�!=� >�b���f�M��
���5�+�+�S�%�8��t�y�y�)��
���%�*�*�F�D�9��T�\�\�*��
���%�*�*�F�D�9��t�8�8�E�D�I�I�F��
���%�*�*�F�D�9��d�2�2�D�4H�4H�I��
���%�*�*�F�D�9�15����.���4�.��t�0�0�$�2E�2E�F��
���%�*�*�F�D�9��*�*�,�<�<�>�����u�/�/�/�F�4F��9�9�;�J�(�.�.�0�
@�
��U�%�c�U�"�U�G�4���"�"�5�#3�#3�S�$�?�
@�(��	�	��i�(?��'D�E��
���5�+�+�S�$�7��t�y�y�3�3�9�9�;�<�B�t�f�H�M��
���5�+�+�S�%�8�� � � rc��|jr{|jdk(s|jdk(r\|jtjj
k(r5|j
�tj|_	|j�y|t_|j�s|t_|jsy|j ry|j�|j#�s|j$dfStj&ry|j)�rytj*r7|j�s&d	t_|jj-d
�y|j$sy|j.s
|j0sy
|j.s|j0j2r!t5j6d|j8�yy)rZrr)FzBypassed orca modifier)FzNo active scriptrEzConsumed based on handlerrFrHFzbypassed next commandrG)FzShould not consume)FzNo consumer or handlerr)TzWill be consumed)FzUnaddressed case)rlr[rrrSrT�	_lock_modr?r�r�rXr
r^r�r_rar`r�rhrIr�r��addKeyGrabsrgrfrDr�timeout_add�_consumer s rrbzKeyboardEvent._process�sR������!�!�[�0��$�$��4��9�9���� A� A�A��N�N�$�#0�#=�#=�D�L��M�M�O�2�$(�
�!��!�!�#�15�J�.��|�|�,����(��
�
��� � �"��'�'�)D�D�D��#�#�*���� �(��'�'��%�%�'�/4�
�,����(�(�)@�A�/��#�#�.����$�-�-�2��>�>�T�]�]�3�3����Q��
�
�.�+�(rc��d�}|jdk(rdtjjz}na|jdk(rdtjjz}n4d|jg}tjt
j|d�ytjt
jdd�tjd||j|��y)Nc������fd�}|S)Nc����	��zr@tjj}tjtj
dd�n?tjj}tjtj
dd�tj�d|�tjtj
dd�y#t$r(tjtj
dd�YywxYw)NzUnlocking capslockTzLocking capslockrMzDone with capslockzRCould not trigger capslock, at-spi2-core >= 2.32 is needed for triggering capslock)	r�KeySynthType�UNLOCKMODIFIERSrrary�
LOCKMODIFIERS�generate_keyboard_eventr:)�lockrBrYs ��r�lockitz9KeyboardEvent._lock_mod.<locals>.lock_mod.<locals>.lockit�s����� �8�+�$�1�1�A�A���*�*�5�+;�+;�=Q�SW�X�$�1�1�?�?���*�*�5�+;�+;�=O�QU�V��1�1�(�B��E��&�&�u�'7�'7�9M�t�T�� ���&�&�u�'7�'7�:Q�RV�X���s�CC�.C5�4C5r$)rYrBrzs`` r�lock_modz)KeyboardEvent._lock_mod.<locals>.lock_mod�s���

��MrrrrzUnknown locking keyTzScheduling capslock)
r[rrWr-r.rrx�
LEVEL_WARNINGraryrrprY)rr{rBr�s    rrnzKeyboardEvent._lock_mod�s���	� ����+��E�.�.�8�8�8�H�
�
�
�,�
.��E�.�.�4�4�4�H�+�T�->�->�?�F����e�1�1�6�4�@��
���5�+�+�-B�D�I�����H�T�^�^�X�>�?rc��tj�}d|j|jfz}d|jjj��d|�d�}t
jtj|d�|jrPd|jj��}t
jtj|d�|j|�n�|jjr[d|j��}t
jtj|d�|jj|j|�n'd	}t
jtj|d�tj�j!�|_|j$|j"k7r?d
|j$d|j"g}t
j&tj|d�dtj�|z
d
��}t
jtj|d�d|jjj��d|�d�}t
jtj|d�y)Nr[z
vvvvv CONSUME r\r]FzKEYBOARD EVENT: Consumer is TzKEYBOARD EVENT: Handler is z&KEYBOARD EVENT: No handler or consumerz+KEYBOARD EVENT: Consumer changed focus fromr�r^r_z^^^^^ CONSUME r`)rr[rVrr�r�rraryrgr)rfrDrar	rrr{rerdrx)rrfrgrhr�s     rrqzKeyboardEvent._consume�s����I�I�K�	��d�/�/����>�>�� ����!5�!5�!;�!;�!=� >�b���f�M��
���5�+�+�S�%�8��>�>�0����1H�1H�0I�J�C����u�/�/��d�;��N�N�4� �
�]�]�
#�
#�/��
�
��?�C����u�/�/��d�;��M�M�"�"�4�<�<��6�:�C����u�/�/��d�;�$1�$<�$<�$>�$Q�$Q�$S��!��I�I��2�2�2�C�T�Y�Y�PT��/�/�1�F����e�.�.���=�'��	�	��i�(?��'D�E��
���5�+�+�S�$�7��t�y�y�3�3�9�9�;�<�B�t�f�H�M��
���5�+�+�S�%�8�r)Tr�)�r)r*r+r=r�rr�r�r�r�r�r�r�r��TYPE_PRINTABLEr�r�r�r�r�r�r�r�r�r�r�	KEY_acute�
KEY_ampersand�KEY_apostrophe�KEY_asciicircum�KEY_asciitilde�KEY_asterisk�KEY_at�
KEY_backslash�KEY_bar�
KEY_braceleft�KEY_braceright�KEY_bracketleft�KEY_bracketright�
KEY_brokenbar�KEY_cedilla�KEY_cent�	KEY_colon�	KEY_comma�
KEY_copyright�KEY_currency�
KEY_degree�
KEY_diaeresis�
KEY_dollar�KEY_EuroSign�	KEY_equal�
KEY_exclam�KEY_exclamdown�	KEY_grave�KEY_greater�KEY_guillemotleft�KEY_guillemotright�
KEY_hyphen�KEY_less�
KEY_macron�	KEY_minus�KEY_notsign�KEY_numbersign�
KEY_paragraph�
KEY_parenleft�KEY_parenright�KEY_percent�
KEY_period�KEY_periodcentered�KEY_plus�
KEY_plusminus�KEY_question�KEY_questiondown�KEY_quotedbl�
KEY_quoteleft�KEY_quoteright�KEY_registered�KEY_section�
KEY_semicolon�	KEY_slash�KEY_sterling�KEY_underscore�KEY_yenro�
KEY_Aacute�
KEY_aacute�KEY_Acircumflex�KEY_acircumflex�KEY_Adiaeresis�KEY_adiaeresis�
KEY_Agrave�
KEY_agrave�	KEY_Aring�	KEY_aring�
KEY_Atilde�
KEY_atilde�KEY_Ccedilla�KEY_ccedilla�
KEY_Eacute�
KEY_eacute�KEY_Ecircumflex�KEY_ecircumflex�KEY_Ediaeresis�KEY_ediaeresis�
KEY_Egrave�
KEY_egrave�
KEY_Iacute�
KEY_iacute�KEY_Icircumflex�KEY_icircumflex�KEY_Idiaeresis�KEY_idiaeresis�
KEY_Igrave�
KEY_igrave�
KEY_Ntilde�
KEY_ntilde�
KEY_Oacute�
KEY_oacute�KEY_Ocircumflex�KEY_ocircumflex�KEY_Odiaeresis�KEY_odiaeresis�
KEY_Ograve�
KEY_ograve�KEY_Ooblique�KEY_ooblique�
KEY_Otilde�
KEY_otilde�
KEY_Uacute�
KEY_uacute�KEY_Ucircumflex�KEY_ucircumflex�KEY_Udiaeresis�KEY_udiaeresis�
KEY_Ugrave�
KEY_ugrave�
KEY_Yacute�
KEY_yacuterprr�r%r�r�r(r�r~r�r�r�r�r�r�r�r�r�r�rrr�r�r�r�r&r+r0r5r7r9r;rCr�rSrXrlrbrnrq�
__classcell__�r�s@rr?r?Zs-���'�)�J��N���"�� $��$��#'� �!����%�L�'�N�&�M�%�L�&�M�$�K�(�O�)��(�O�%�L�)��#�J�8)�C�M�M�8)��-�-�8)��.�.�8)� �/�/�8)� �.�.�	8)�
 �,�,�8)� �J�J�
8)� �-�-�8)� �K�K�8)� �-�-�8)� �.�.�8)� �/�/�8)� �0�0�8)� �-�-�8)� �O�O�8)� �L�L�8)�  �M�M�!8)�" �M�M�#8)�$ �-�-�%8)�& �,�,�'8)�( �N�N�)8)�* �-�-�+8)�, �N�N�-8)�. �,�,�/8)�0 �M�M�18)�2 �N�N�38)�4 �.�.�58)�6 �M�M�78)�8 �O�O�98)�: �1�1�;8)�< �2�2�=8)�> �N�N�?8)�@ �L�L�A8)�B �N�N�C8)�D �M�M�E8)�F �O�O�G8)�H �.�.�I8)�J �-�-�K8)�L �-�-�M8)�N �.�.�O8)�P �O�O�Q8)�R �N�N�S8)�T �2�2�U8)�V �L�L�W8)�X �-�-�Y8)�Z �,�,�[8)�\ �0�0�]8)�^ �,�,�_8)�` �-�-�a8)�b �.�.�c8)�d �.�.�e8)�f �O�O�g8)�h �-�-�i8)�j �M�M�k8)�l �,�,�m8)�n �.�.�o8)�p �K�K�q8)��t5 0����5 0� #���5 0� #� 3� 3�5 0�!$� 3� 3�5 0�!$� 2� 2�	5 0�
!$� 2� 2�5 0�!$���
5 0�!$���5 0�!$�
�
�5 0�!$�
�
�5 0�!$���5 0�!$���5 0�!$� 0� 0�5 0�!$� 0� 0�5 0�!$���5 0�!$���5 0� !$� 3� 3�!5 0�"!$� 3� 3�#5 0�$!$� 2� 2�%5 0�&!$� 2� 2�'5 0�(!$���)5 0�*!$���+5 0�,!$���-5 0�.!$���/5 0�0!$� 3� 3�15 0�2!$� 3� 3�35 0�4!$� 2� 2�55 0�6!$� 2� 2�75 0�8!$���95 0�:!$���;5 0�<!$���=5 0�>!$���?5 0�@!$���A5 0�B!$���C5 0�D!$� 3� 3�E5 0�F!$� 3� 3�G5 0�H!$� 2� 2�I5 0�J!$� 2� 2�K5 0�L!$���M5 0�N!$���O5 0�P!$� 0� 0�Q5 0�R!$� 0� 0�S5 0�T!$���U5 0�V!$���W5 0�X!$���Y5 0�Z!$���[5 0�\!$� 3� 3�]5 0�^!$� 3� 3�_5 0�`!$� 2� 2�a5 0�b!$� 2� 2�c5 0�d!$���e5 0�f!$���g5 0�h!$���i5 0�j!$���k5 0��nSJ�j��6�B�.	
���6�";�%�	+�5�4�
�!�	-�� ?�(�
	/�>�
S�3� �
	C�/�&-�6�
�
�
�&)3�V9�7�,!�\1)�f@�8rr?c�6��eZdZ�fd�Zd�Zd�Zd�Zd�Z�xZS)�BrailleEventc���t�|�t�||_t	j
�j
�|_y)z�Creates a new InputEvent of type BRAILLE_EVENT.

        Arguments:
        - event: the integer BrlTTY command for this event.
        N)rPr�
BRAILLE_EVENT�eventrrrrsra�rr�r�s  �rrzBrailleEvent.__init__�s2���	����'���
�%�0�0�2�B�B�D��rc�T�|jj��d|j��S)NrN)rr�r�r s rr�zBrailleEvent.__str__	s#���)�)�/�/�#�$�A�d�j�j�\�2�2rc���|jd}d}tj}|jj|vr||jj}n	d|vr|d}|r8||vr4||}d|�d�|g}tjt
j|d�|S|jjj|�}d|�d�|g}tjt
j|d�|S)z/Returns the handler associated with this event.�commandNr=z(BRAILLE EVENT: User handler for command z isTz#BRAILLE EVENT: Handler for command )
r�r�brailleBindingsMapra�namerrxry�brailleBindingsr?)rr��
user_bindings�user_bindings_maprBr�s      rr;zBrailleEvent.getHandlers����*�*�Y�'���
�$�7�7���<�<��� 1�1�-�d�l�l�.?�.?�@�M�
�+�
+�-�i�8�M��W�
�5�#�G�,�G�@��	��M�w�W�F����e�.�.���=��N��,�,�.�.�2�2�7�;��7��y��D�g�N��
���%�*�*�F�D�9��rc�v�d|dg}tjtj|d�tj�}|j	�}dtj�|z
d��}tj
tj|d�d|dg}tjtj|d�|S)Nz
vvvvv PROCESS�vvvvvFr^r_z
^^^^^ PROCESSz^^^^^)rrxryrrbra)rr��
start_time�resultrhs     rrlzBrailleEvent.process"s���#�T�7�3��
���%�*�*�F�E�:��Y�Y�[�
������'��	�	��j�(@��'E�F��
���5�+�+�S�%�8�!�4��1��
���%�*�*�F�E�:��
rc���|j�}|sx|jjj�r*d|g}t	j
tj|d�yd|g}t	j
tj|d�y	|j|j|�y#t$r7}d|d|��g}t	j
tj|d�Yd}~yd}~wwxYw)Nz+BRAILLE EVENT: Learn mode presenter handlesTz#BRAILLE EVENT: No handler found forFz$BRAILLE EVENT: Exception processing:r\)
r;rarLrMrrxry�processInputEventr:r|)rrBr��errors    rrbzBrailleEvent._process/s����/�/�#����|�|�.�.�8�8�:�G��N���!�!�%�"2�"2�F�D�A��;�T�B�F����e�.�.���=��	A��%�%�d�l�l�D�9�
��	�	A�<�d�b���L�Q�F����e�1�1�6�4�@�@���		A�s�B)�)	C)�2-C$�$C))	r)r*r+rr�r;rlrbr�r�s@rr�r��s���E�3��,�rr�c����eZdZ	ejj�Zejje�Zej�Z
�fd�Zd�Z
d�Z�xZS#e$rdZ
Y�wxYw)�MouseButtonEventNc����t�|�t�|j|_|j
|_|jjd�|_	|jtd�d|_tj�j�|_t!j�j#�|_d|_|jr|j)�|jsyt!j�j+|j$�s't!j�j-�|_|j$syt/j0|j$�|_y)z4Creates a new InputEvent of type MOUSE_BUTTON_EVENT.�pz
mouse:button:���N)rPr�MOUSE_BUTTON_EVENT�detail1�x�detail2�yrr9r�rn�buttonrrrrsrar	rt�windowru�_validateCoordinatesrvrwrr|r�s  �rrzMouseButtonEvent.__init__Ls���	���+�,������������z�z�*�*�3�/����j�j��_�!5�b�9���%�0�0�2�B�B�D���#�.�.�0�B�B�D�������<�<��%�%�'��|�|���'�'�)�>�>�t�{�{�K�'�2�2�4�G�G�I�D�K��{�{���+�+�D�K�K�8��rc	��|jsy|jj�\}}}tj|j|z
dz|j
|z
dzz�dkryd|j�d|j
�d|�d|�d�	}t
jtj|d�||c|_|_y)N��zWARNING: Event coordinates (z, z) may be bogus. Updating to (�)T)	�_pointer�get_position�math�sqrtrrrrary)r�screenrrrhs     rrz%MouseButtonEvent._validateCoordinatesfs����}�}���}�}�1�1�3����1��9�9�d�f�f�q�j�1�_�����
�Q��6�7�"�<��+�4�6�6�(�"�T�V�V�H�=��3�b���1�
&�	�	���5�+�+�S�$�7��A�����rc�L�|jsytj}t|t�sd|_y|j|jz
tjkr>|j|jk(r%|j
dkr|xj
dz
c_yd|_y)r#Nrr)
r�r
r^r�rrrrr�r)rr^s  rr%zMouseButtonEvent.setClickCountus����|�|��#�2�2���.�*:�;� �D����9�9�~�*�*�*�X�-H�-H�H��%�%����4����!�#�� � �A�%� ����r)r)r*r+r�Display�get_default�display�get_default_seat�seat�get_pointerrr:rrr%r�r�s@rrrCsb�����+�+�)�)�+���{�{�+�+�G�4���#�#�%��9�4
���Y�����s�AA�A%�$A%rc�2�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zy)	�InputEventHandlerc�<�||_||_||_||_y)azCreates a new InputEventHandler instance.  All bindings
        (e.g., key bindings and braille bindings) will be handled
        by an instance of an InputEventHandler.

        Arguments:
        - function: the function to call with an InputEvent instance as its
                    sole argument.  The function is expected to return True
                    if it consumes the event; otherwise it should return
                    False
        - description: a localized string describing what this InputEvent
                       does
        - learnModeEnabled: if True, the description will be spoken and
                            brailled if learn mode is enabled.  If False,
                            the function will be called no matter what.
        - enabled: Whether this hander can be used, i.e. based on mode, the
          feature being enabled/active, etc.
        N)rD�description�learnModeEnabled�_enabled)rrDr%r&�enableds     rrzInputEventHandler.__init__�s"��&!��
�&��� 0�����
rc�:�|sy|j|jk(S)z&Compares one input handler to another.F)rDr�s  rr�zInputEventHandler.__eq__�s�����
�
����/�0rc�:�|j�d|j�d�S)Nz (enabled: r)r%r'r s rr�zInputEventHandler.__str__�s ���"�"�#�;�t�}�}�o�Q�?�?rc��d|j�d|j��}tjtj|d�|jS)z(Returns True if this handler is enabled.zINPUT EVENT HANDLER: z
 is enabled: T)r%r'rrary)rrhs  rrKzInputEventHandler.is_enabled�sC��&�d�&6�&6�%7�}�T�]�]�O�T��
���5�+�+�S�$�7��}�}�rc��||_y)z"Sets this handler's enabled state.N)r')rr(s  r�set_enabledzInputEventHandler.set_enabled�s�� ��
rc��|jsyd}	|j||�}|S#t$r'tjtj
�Y|SwxYw)awProcesses an input event.

        This function is expected to return True if it consumes the
        event; otherwise it is expected to return False.

        Arguments:
        - script:     the script (if any) associated with this event
        - inputEvent: the input event to pass to the function bound
                      to this InputEventHandler instance.
        F)r'rDr:r�printException�LEVEL_SEVERE)rr*rW�consumeds    rrz#InputEventHandler.processInputEvent�sY���}�}����	5��}�}�V�Z�8�H�����	5�� � ��!3�!3�4���	5�s�%�,A�AN)TT)	r)r*r+rr�r�rKr-rr$rrr#r#�s!�� �01�@�� �
rr#)$�__doc__�__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrrrrrrMrr	r
rrr
rr�	ax_objectr�ax_utilitiesrrQr�r
rr=r?r�rr#r$rr�<module>r=s���*2�������7�
���	�����7�E�"���������������%����
�#����0
�a�J�a�FD�:�D�LC�z�C�LF�Fr

Zerion Mini Shell 1.0