xserver/hw/xwayland/xwayland-xtest.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.4 KiB
C
Raw Permalink Normal View History

xwayland: Add XTEST support using EIS This adds support for XTEST in Xwayland using EIS, the emulated input library [1]. To differentiate between X11 clients using XTEST, initiate a EI context for each client and use the actual client name, from its command line. When an X11 client first tries to use XTEST to generate emulated input events, a new connection to libEI is initiated by Xwayland on behalf of the X11 client. During that connection phase, the EI server will not be accepting events until the emulated device is actually created, meaning that any XTEST request from the X11 client will be discarded until the EI server is willing to accept events. To avoid that issue, add an event queue in Xwayland per X11 client that will keep those requests, and dequeue them as soon as the EI server is ready, i.e. once the EI device is added. If the X11 client disconnects from the Xserver before the EI server is ready, or if the connection is closed by the EI server, those events are discarded and the queue cleared from any pending events. For 10 minutes after the client disconnects, keep the internal struct alive. If a client with the same commandline arguments connects again, re-use the same struct. This means we are faster with the events the second time around but it also allows the EIS server to pause individual clients that keep sending intermittent events and disconnect immediately (e.g. it'd be possible to pause xdtotool while an authentication prompt is active). [1] https://gitlab.freedesktop.org/libinput/libei Thanks to Jan Beich <jbeich@FreeBSD.org> for fixing the build on BSD. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Co-authored-by: Olivier Fourdan <ofourdan@redhat.com> Co-authored-by: David Redondo <kde@david-redondo.de> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-09-04 12:44:15 +10:00
/*
* Copyright © 2020 Red Hat
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of the
* copyright holders not be used in advertising or publicity
* pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef XWAYLAND_XTEST_H
#define XWAYLAND_XTEST_H
#include <xwayland-config.h>
Bool xwayland_ei_init(void);
void xwayland_override_xtest(void);
void xwayland_restore_xtest(void);
xwayland: Add XTEST support using EIS This adds support for XTEST in Xwayland using EIS, the emulated input library [1]. To differentiate between X11 clients using XTEST, initiate a EI context for each client and use the actual client name, from its command line. When an X11 client first tries to use XTEST to generate emulated input events, a new connection to libEI is initiated by Xwayland on behalf of the X11 client. During that connection phase, the EI server will not be accepting events until the emulated device is actually created, meaning that any XTEST request from the X11 client will be discarded until the EI server is willing to accept events. To avoid that issue, add an event queue in Xwayland per X11 client that will keep those requests, and dequeue them as soon as the EI server is ready, i.e. once the EI device is added. If the X11 client disconnects from the Xserver before the EI server is ready, or if the connection is closed by the EI server, those events are discarded and the queue cleared from any pending events. For 10 minutes after the client disconnects, keep the internal struct alive. If a client with the same commandline arguments connects again, re-use the same struct. This means we are faster with the events the second time around but it also allows the EIS server to pause individual clients that keep sending intermittent events and disconnect immediately (e.g. it'd be possible to pause xdtotool while an authentication prompt is active). [1] https://gitlab.freedesktop.org/libinput/libei Thanks to Jan Beich <jbeich@FreeBSD.org> for fixing the build on BSD. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Co-authored-by: Olivier Fourdan <ofourdan@redhat.com> Co-authored-by: David Redondo <kde@david-redondo.de> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-09-04 12:44:15 +10:00
#endif