LINUX.ORG.RU

История изменений

Исправление Zubok, (текущая версия) :

Я просто хочу предупредить, что передача от клиента к клиенту event, эмулирующего указатель, кнопку указателя, клавиатуру, может не заработать, потому что некоторые приложения отрабатывают сообщения только от сервера, а клиентские игнорируют.

Вот, например, поясняющий текст из man xdotool:

SENDEVENT NOTES
       If you are trying to send key input to a specific window, and it does
       not appear to be working, then it's likely your application is ignoring
       the events xdotool is generating. This is fairly common.

       Sending keystrokes to a specific window uses a different API than
       simply typing to the active window. If you specify 'xdotool type
       --window 12345 hello' xdotool will generate key events and send them
       directly to window 12345.  However, X11 servers will set a special flag
       on all events generated in this way (see XEvent.xany.send_event in
       X11's manual). Many programs observe this flag and reject these events.

       It is important to note that for key and mouse events, we only use
       XSendEvent when a specific window is targeted. Otherwise, we use XTEST.

       Some programs can be configured to accept events even if they are
       generated by xdotool. Seek the documentation of your application for
       help.

       Specific application notes (from the author's testing): * Firefox 3
       seems to ignore all input when it does not have focus.  * xterm can be
       configured while running with ctrl+leftclick, 'Allow SendEvents' *
       gnome-terminal appears to accept generated input by default.

То есть это недостаток XSendEvent. Этот метод (как и твой) используется xdotool в случае, если явно указывается xid окна в коммандной строке. Но, как видишь. это может не заработать в некоторых приложениях, потому что они фильтруют по флагу. UPD в этом месте: но с событиями мыши дело может обстоять лучше. С событиями клавиатуры хуже.

А XTEST обладает тем недостатком, что нельзя послать событие конкретному окну. Чтобы конкертному, надо его отыскать, где оно находится, поднять его (передать фокус), отыскать, куда именно клацнуть.

Исправление Zubok, :

Я просто хочу предупредить, что передача от клиента к клиенту event, эмулирующего указатель, кнопку указателя, клавиатуру, может не заработать, потому что некоторые приложения отрабатывают сообщения только от сервера, а клиентские игнорируют.

Вот, например, поясняющий текст из man xdotool:

SENDEVENT NOTES
       If you are trying to send key input to a specific window, and it does
       not appear to be working, then it's likely your application is ignoring
       the events xdotool is generating. This is fairly common.

       Sending keystrokes to a specific window uses a different API than
       simply typing to the active window. If you specify 'xdotool type
       --window 12345 hello' xdotool will generate key events and send them
       directly to window 12345.  However, X11 servers will set a special flag
       on all events generated in this way (see XEvent.xany.send_event in
       X11's manual). Many programs observe this flag and reject these events.

       It is important to note that for key and mouse events, we only use
       XSendEvent when a specific window is targeted. Otherwise, we use XTEST.

       Some programs can be configured to accept events even if they are
       generated by xdotool. Seek the documentation of your application for
       help.

       Specific application notes (from the author's testing): * Firefox 3
       seems to ignore all input when it does not have focus.  * xterm can be
       configured while running with ctrl+leftclick, 'Allow SendEvents' *
       gnome-terminal appears to accept generated input by default.

То есть это недостаток XSendEvent. Этот метод (как и твой) используется xdotool в случае, если явно указывается xid окна в коммандной строке. Но, как видишь. это может не заработать в некоторых приложениях, потому что они фильтруют по флагу.

А XTEST обладает тем недостатком, что нельзя послать событие конкретному окну. Чтобы конкертному, надо его отыскать, где оно находится, поднять его (передать фокус), отыскать, куда именно клацнуть.

Исходная версия Zubok, :

Я просто хочу предупредить, что передача от клиента к клиенту event, эмулирующего указатель, кнопку указателя, клавиатуру, может не заработать, потому что некоторые приложения отрабатывают сообщения только от сервера, а клиентские игнорируют.

Вот, например, поясняющий текст из man xdotool:

SENDEVENT NOTES
       If you are trying to send key input to a specific window, and it does
       not appear to be working, then it's likely your application is ignoring
       the events xdotool is generating. This is fairly common.

       Sending keystrokes to a specific window uses a different API than
       simply typing to the active window. If you specify 'xdotool type
       --window 12345 hello' xdotool will generate key events and send them
       directly to window 12345.  However, X11 servers will set a special flag
       on all events generated in this way (see XEvent.xany.send_event in
       X11's manual). Many programs observe this flag and reject these events.

       It is important to note that for key and mouse events, we only use
       XSendEvent when a specific window is targeted. Otherwise, we use XTEST.

       Some programs can be configured to accept events even if they are
       generated by xdotool. Seek the documentation of your application for
       help.

       Specific application notes (from the author's testing): * Firefox 3
       seems to ignore all input when it does not have focus.  * xterm can be
       configured while running with ctrl+leftclick, 'Allow SendEvents' *
       gnome-terminal appears to accept generated input by default.

То есть это недостаток XSendEvent. Этот метод (как и твой) используется xdotool в случае, если указывает xid окна. Но, как видишь. это может не заработать в некоторых приложениях.

А XTEST обладает тем недостатком, что нельзя послать событие конкретному окну. Чтобы конкертному, надо его отыскать, где оно находится, поднять его (передать фокус), отыскать, куда именно клацнуть.