From 5dc2a9aae46352f1f35d3ba122da04727789a15d Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 4 Jun 2015 13:23:19 -0500 Subject: [PATCH 1/4] xace: Add XaceHookIsSet helper function Signed-off-by: Andrew Eikum Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xext/xace.c | 15 +++++++++++++++ Xext/xace.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/Xext/xace.c b/Xext/xace.c index d77b3126a..b3c67f632 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -213,6 +213,21 @@ XaceHook(int hook, ...) return prv ? *prv : Success; } +/* XaceHookIsSet + * + * Utility function to determine whether there are any callbacks listening on a + * particular XACE hook. + * + * Returns non-zero if there is a callback, zero otherwise. + */ +int +XaceHookIsSet(int hook) +{ + if (hook < 0 || hook >= XACE_NUM_HOOKS) + return 0; + return XaceHooks[hook] != NULL; +} + /* XaceCensorImage * * Called after pScreen->GetImage to prevent pieces or trusted windows from diff --git a/Xext/xace.h b/Xext/xace.h index 5e6cb0437..3303f76bc 100644 --- a/Xext/xace.h +++ b/Xext/xace.h @@ -65,6 +65,9 @@ extern _X_EXPORT int XaceHook(int /*hook */ , ... /*appropriate args for hook */ ); +/* determine whether any callbacks are present for the XACE hook */ +extern _X_EXPORT int XaceHookIsSet(int hook); + /* Special-cased hook functions */ extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major); From 990cf5b2828f73dc7a07f1e38f608af39acfd81d Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 4 Jun 2015 13:24:53 -0500 Subject: [PATCH 2/4] dix: Send KeyPress and KeyRelease events to the XACE_KEY_AVAIL hook While it's documented in the XACE spec, the XACE_KEY_AVAIL hook is currently never actually invoked by the xserver. This hook was added in 13c6713c82 (25 Aug 2006), but as the keyboard processing was moved into XKB, the hook was forgotten and silently dropped. The code calling this hook was removed by 7af53799c (4 Jan 2009), but it was probably already unused before that. This patch re-adds support for this hook. The "count" hook parameter is unused. Signed-off-by: Andrew Eikum Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xi/exevents.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Xi/exevents.c b/Xi/exevents.c index 1c586d051..cd33f94fc 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1730,6 +1730,18 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) break; } + /* send KeyPress and KeyRelease events to XACE plugins */ + if (XaceHookIsSet(XACE_KEY_AVAIL) && + (event->type == ET_KeyPress || event->type == ET_KeyRelease)) { + xEvent *core; + int count; + + if (EventToCore(ev, &core, &count) == Success && count > 0) { + XaceHook(XACE_KEY_AVAIL, core, device, 0); + free(core); + } + } + if (DeviceEventCallback && !syncEvents.playingEvents) { DeviceEventInfoRec eventinfo; SpritePtr pSprite = device->spriteInfo->sprite; From f4c3cac010cff0980905eeedd8e8d7baf0aff91b Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 17 Jun 2015 12:41:35 +0300 Subject: [PATCH 3/4] Xi: call UpdateDeviceState() even when the client is missing The client window can be closed in the middle of a touch sequence, e.g. Qt 4 closes popup windows on MousePress and Qt 5.5 will do it on TouchBegin. In this case the state of mouse buttons will not be updated on TouchEnd because ProcessTouchEvent() calls UpdateDeviceState() only when the event has been sent to the client. It results in a stuck left mouse button. This patch leads to calling UpdateDeviceState() in case the client can't be found. Signed-off-by: Alexander Volkov Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xi/exevents.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index cd33f94fc..e728310f8 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1590,7 +1590,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev) if (!ti) { DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n", dev->name, type, touchid); - return; + goto out; } /* if emulate_pointer is set, emulate the motion event right @@ -1624,6 +1624,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev) if (ev->any.type == ET_TouchEnd) TouchEndTouch(dev, ti); + out: if (emulate_pointer) UpdateDeviceState(dev, &ev->device_event); } From 8c86dd51606486f4794c503b9c05c6875bdc693a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= Date: Tue, 23 Jun 2015 08:41:57 -0300 Subject: [PATCH 4/4] configure.ac: fix code misplacing for KDRIVE_{KBD, MOUSE, EVDEV} auto-detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KDrive input drivers "kbd", "mouse", and "evdev" should be automatically built for linux systems. However, due to a code misplacing in configure.ac, the auto-detection test is being performed AFTER the corresponding AC_DEFINEs' calls, so that the drivers are NOT being built, regardless the test result. This bug should be affecting previous xorg-server releases. Please consider backporting this patch to all maintained ones! Signed-off-by: LaƩrcio de Sousa Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- configure.ac | 53 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index f760730c3..f187a1357 100644 --- a/configure.ac +++ b/configure.ac @@ -2337,6 +2337,33 @@ if test "$KDRIVE" = yes; then fi fi + case $host_os in + *linux*) + KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la' + KDRIVELINUX=yes + if test "x$KDRIVE_EVDEV" = xauto; then + KDRIVE_EVDEV=yes + fi + if test "x$KDRIVE_KBD" = xauto; then + KDRIVE_KBD=yes + fi + if test "x$KDRIVE_MOUSE" = xauto; then + KDRIVE_MOUSE=yes + fi + ;; + *) + if test "x$KDRIVE_EVDEV" = xauto; then + KDRIVE_EVDEV=no + fi + if test "x$KDRIVE_KBD" = xauto; then + KDRIVE_KBD=no + fi + if test "x$KDRIVE_MOUSE" = xauto; then + KDRIVE_MOUSE=no + fi + ;; + esac + if test "x$KDRIVE_KBD" = xyes; then AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver]) fi @@ -2378,32 +2405,6 @@ if test "$KDRIVE" = yes; then KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB" KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la' - case $host_os in - *linux*) - KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la' - KDRIVELINUX=yes - if test "x$KDRIVE_EVDEV" = xauto; then - KDRIVE_EVDEV=yes - fi - if test "x$KDRIVE_KBD" = xauto; then - KDRIVE_KBD=yes - fi - if test "x$KDRIVE_MOUSE" = xauto; then - KDRIVE_MOUSE=yes - fi - ;; - *) - if test "x$KDRIVE_EVDEV" = xauto; then - KDRIVE_EVDEV=no - fi - if test "x$KDRIVE_KBD" = xauto; then - KDRIVE_KBD=no - fi - if test "x$KDRIVE_MOUSE" = xauto; then - KDRIVE_MOUSE=no - fi - ;; - esac KDRIVE_MAIN_LIB="$MAIN_LIB" KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"