From ba7d1020ac0135ebc8acda4cd57ed48b331e0133 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 14 May 2011 16:31:10 -0700 Subject: [PATCH 1/7] input: Fix format string for verify_internal_event inpututils.c:577:25: warning: conversion specifies type 'unsigned short' but the argument has type 'unsigned char' [-Wformat,Format String Issue] ErrorF("%02hx ", *data); ~~~~^ ~~~~~ %02hhx 1 warning generated. Signed-off-by: Jeremy Huddleston Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- dix/inpututils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/inpututils.c b/dix/inpututils.c index aeace6ef8..49e175822 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -574,7 +574,7 @@ void verify_internal_event(const InternalEvent *ev) for (i = 0; i < sizeof(xEvent); i++, data++) { - ErrorF("%02hx ", *data); + ErrorF("%02hhx ", *data); if ((i % 8) == 7) ErrorF("\n"); From 4c4df3ac0d8162c874b85fede12ffbe42f0062c3 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 14 May 2011 16:23:59 -0700 Subject: [PATCH 2/7] input: Don't implicitly define verify_internal_event Fixes regression introduced by 56901998020b6f443cbaa5eb303100d979e81b22 mieq.c:159:5: error: implicit declaration of function 'verify_internal_event' is invalid in C99 [-Wimplicit-function-declaration,Semantic Issue] verify_internal_event(e); ^ 1 error generated. Also includes some other warning cleanups in events.c we're there. events.c:2198:24: warning: equality comparison with extraneous parentheses [-Wparentheses,Semantic Issue] else if ((type == MotionNotify)) ~~~~~^~~~~~~~~~~~~~~ events.c:2198:24: note: remove extraneous parentheses around the comparison to silence this warning [Semantic Issue] else if ((type == MotionNotify)) ~ ^ ~ events.c:2198:24: note: use '=' to turn this equality comparison into an assignment [Semantic Issue] else if ((type == MotionNotify)) ^~ = events.c:2487:5: error: implicit declaration of function 'verify_internal_event' is invalid in C99 [-Wimplicit-function-declaration,Semantic Issue] verify_internal_event(event); ^ events.c:5909:22: warning: declaration shadows a local variable [-Wshadow,Semantic Issue] DeviceIntPtr it = inputInfo.devices; ^ events.c:5893:18: note: previous declaration is here DeviceIntPtr it = inputInfo.devices; ^ 3 warnings and 1 error generated. events.c:2836:27: warning: incompatible pointer types passing 'DeviceEvent *' (aka 'struct _DeviceEvent *') to parameter of type 'const InternalEvent *' (aka 'const union _InternalEvent *') verify_internal_event(ev); ^~ ../include/inpututils.h:40:56: note: passing argument to parameter 'ev' here extern void verify_internal_event(const InternalEvent *ev); ^ 1 warning generated. Found-by: yuffie tinderbox (-Werror=implicit) Signed-off-by: Jeremy Huddleston Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- dix/events.c | 7 ++++--- mi/mieq.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dix/events.c b/dix/events.c index 14f6f909e..b60c29952 100644 --- a/dix/events.c +++ b/dix/events.c @@ -112,6 +112,7 @@ Equipment Corporation. #include #include "windowstr.h" #include "inputstr.h" +#include "inpututils.h" #include "scrnintstr.h" #include "cursorstr.h" @@ -2195,7 +2196,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent */ if (!grab && ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask)) /* grab activated */; - else if ((type == MotionNotify)) + else if (type == MotionNotify) pDev->valuator->motionHintWindow = pWin; else if (type == DeviceMotionNotify || type == DeviceButtonPress) CheckDeviceGrabAndHintWindow (pWin, type, @@ -2832,7 +2833,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) WindowPtr prevSpriteWin, newSpriteWin; SpritePtr pSprite = pDev->spriteInfo->sprite; - verify_internal_event(ev); + verify_internal_event((InternalEvent *)ev); prevSpriteWin = pSprite->win; @@ -5906,7 +5907,7 @@ PickPointer(ClientPtr client) if (!client->clientPtr) { - DeviceIntPtr it = inputInfo.devices; + it = inputInfo.devices; while (it) { if (IsMaster(it) && it->spriteInfo->spriteOwner) diff --git a/mi/mieq.c b/mi/mieq.c index 031b11ab2..fc3738a41 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. # include "windowstr.h" # include "pixmapstr.h" # include "inputstr.h" +# include "inpututils.h" # include "mi.h" # include "mipointer.h" # include "scrnintstr.h" From 53ccc54ac71c2655276678e13f0b3d879d691489 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Mon, 16 May 2011 19:31:57 +0100 Subject: [PATCH 3/7] Fix XWin compilation after updates for input API changes Fix XWin compilation after updates for input API changes in commits e7150db5 8670c46b and 20fb07f4 Also remove a no longer needed InternalEvent* variable Signed-off-by: Jon TURNEY Signed-off-by: Peter Hutterer --- hw/xwin/winkeybd.c | 6 ++---- hw/xwin/winmouse.c | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 2fa6b3f6e..a3112fffe 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -472,8 +472,6 @@ winKeybdReleaseKeys (void) void winSendKeyEvent (DWORD dwKey, Bool fDown) { - InternalEvent* events; - /* * When alt-tabing between screens we can get phantom key up messages * Here we only pass them through it we think we should! @@ -485,8 +483,8 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL); - winDebug("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n", - dwKey, fDown, nevents); + winDebug("winSendKeyEvent: dwKey: %d, fDown: %d\n", + dwKey, fDown); } BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index b1b0657cf..752334a31 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -244,8 +244,8 @@ winMouseButtonsSendEvent (int iEventType, int iButton) POINTER_RELATIVE, &mask); #if CYGDEBUG - ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d, nEvents %d\n", - iEventType, iButton, nevents); + ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d\n", + iEventType, iButton); #endif } From b387069fafbe549f2091f364e2aa92af6cc21261 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 18 May 2011 20:47:52 +0100 Subject: [PATCH 4/7] Xephyr: added dummy ephyrDeviceCursorCleanup() to avoid crashing The DeviceCursorCleanup in miPointerSpriteFuncRec can no longer be NULL it seems. Signed-off-by: Tomas Frydrych Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- hw/kdrive/ephyr/ephyrinit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 27cab3b63..2deb7b81d 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -358,13 +358,18 @@ ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) return TRUE; } +static void +ephyrDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) +{ +} + miPointerSpriteFuncRec EphyrPointerSpriteFuncs = { ephyrRealizeCursor, ephyrUnrealizeCursor, ephyrSetCursor, ephyrMoveCursor, ephyrDeviceCursorInitialize, - NULL + ephyrDeviceCursorCleanup }; From 83c059f03463f2d7f41e172afe510d1ca9bba8b0 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 18 May 2011 20:49:52 +0100 Subject: [PATCH 5/7] Xephyr: fix pointer coordinate translation when screen is rotated In the Xephyr case the position of the pointer relative toward the Xephyr window is controlled by the host server without taking into account rotation of the Xephyr screen. Consequently the pointer coords must always be translated when the fb is rotated. Signed-off-by: Tomas Frydrych Signed-off-by: Peter Hutterer --- hw/kdrive/ephyr/ephyr.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 8096a24cc..ac8e5bef9 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -52,6 +52,7 @@ Bool ephyrNoDRI=FALSE ; Bool ephyrNoXV=FALSE ; static int mouseState = 0; +static Rotation ephyrRandr = RR_Rotate_0; typedef struct _EphyrInputPrivate { Bool enabled; @@ -249,7 +250,11 @@ ephyrMapFramebuffer (KdScreenInfo *screen) EPHYR_LOG("screen->width: %d, screen->height: %d index=%d", screen->width, screen->height, screen->mynum); - KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height); + /* + * Use the rotation last applied to ourselves (in the Xephyr case the fb + * coordinate system moves independently of the pointer coordiante system). + */ + KdComputePointerMatrix (&m, ephyrRandr, screen->width, screen->height); KdSetPointerMatrix (&m); priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2; @@ -530,7 +535,15 @@ ephyrRandRSetConfig (ScreenPtr pScreen, * Set new configuration */ - scrpriv->randr = KdAddRotation (screen->randr, randr); + /* + * We need to store the rotation value for pointer coords transformation; + * though initially the pointer and fb rotation are identical, when we map + * the fb, the screen will be reinitialized and return into an unrotated + * state (presumably the HW is taking care of the rotation of the fb), but the + * pointer still needs to be transformed. + */ + ephyrRandr = KdAddRotation (screen->randr, randr); + scrpriv->randr = ephyrRandr; ephyrUnmapFramebuffer (screen); @@ -1058,6 +1071,14 @@ MouseInit (KdPointerInfo *pi) pi->nButtons = 32; free(pi->name); pi->name = strdup("Xephyr virtual mouse"); + + /* + * Must transform pointer coords since the pointer position + * relative to the Xephyr window is controlled by the host server and + * remains constant regardless of any rotation applied to the Xephyr screen. + */ + pi->transformCoordinates = TRUE; + ephyrMouse = pi; return Success; } From c05c8640f13708384e77579e7714ca846fa93f5c Mon Sep 17 00:00:00 2001 From: Oleh Nykyforchyn Date: Thu, 19 May 2011 09:39:52 +0300 Subject: [PATCH 6/7] xfree86: Allow "MatchLayout" statements in config files Usage example (tested on a dual-seat PC): Section "InputClass" Identifier "keyboard-all" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" MatchLayout "!GeForce|!Matrox" Driver "evdev" Option "XkbLayout" "us" Option "XkbOptions" "terminate:ctrl_alt_bksp" EndSection It disables auto keyboard configuration for layouts "GeForce" and "Matrox". Note that "" in patterns means "no Layout sections found", e.g. MatchLayout "GeForce|" is "in layout GeForce or without explicit layout at all". Signed-off-by: Oleh Nykyforchyn Reviewed-by: Peter Hutterer Acked-by: Dan Nicholson Signed-off-by: Peter Hutterer --- hw/xfree86/common/xf86Xinput.c | 21 +++++++++++++++++++++ hw/xfree86/man/xorg.conf.man | 10 ++++++++++ hw/xfree86/parser/InputClass.c | 21 +++++++++++++++++++++ hw/xfree86/parser/xf86Parser.h | 1 + hw/xfree86/parser/xf86tokens.h | 1 + 5 files changed, 54 insertions(+) diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index e7e1ce1f0..26051ad7f 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -469,6 +469,20 @@ match_path_pattern(const char *attr, const char *pattern) #define match_path_pattern match_substring #endif +/* + * If no Layout section is found, xf86ServerLayout.id becomes "(implicit)" + * It is convenient that "" in patterns means "no explicit layout" + */ +static int +match_string_implicit(const char *attr, const char *pattern) +{ + if (strlen(pattern)) { + return strcmp(attr, pattern); + } else { + return strcmp(attr,"(implicit)"); + } +} + /* * Match an attribute against a list of NULL terminated arrays of patterns. * If a pattern in each list entry is matched, return TRUE. @@ -564,6 +578,13 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev, return FALSE; } + /* MatchLayout string */ + if (!list_is_empty(&iclass->match_layout)) { + if (!MatchAttrToken(xf86ConfigLayout.id, + &iclass->match_layout, match_string_implicit)) + return FALSE; + } + /* MatchIs* booleans */ if (iclass->is_keyboard.set && iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD)) diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man index 4bec31695..f406f82bb 100644 --- a/hw/xfree86/man/xorg.conf.man +++ b/hw/xfree86/man/xorg.conf.man @@ -1140,6 +1140,16 @@ matches the pattern. A match is found if at least one of the tags given in .RI \*q matchtag \*q matches at least one of the tags assigned by the backend. +.TP 7 +.BI "MatchLayout \*q" matchlayout \*q +Check the case-sensitive string +.RI \*q matchlayout \*q +against the currently active +.B ServerLayout +section. The empty string "" matches an implicit layout which appears +if no named +.B ServerLayout +sections have been found. .PP The second type of entry is used to match device types. These entries take a boolean argument similar to diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c index 9f88e7ee4..3f801700e 100644 --- a/hw/xfree86/parser/InputClass.c +++ b/hw/xfree86/parser/InputClass.c @@ -52,6 +52,7 @@ xf86ConfigSymTabRec InputClassTab[] = {MATCH_USBID, "matchusbid"}, {MATCH_DRIVER, "matchdriver"}, {MATCH_TAG, "matchtag"}, + {MATCH_LAYOUT, "matchlayout"}, {MATCH_IS_KEYBOARD, "matchiskeyboard"}, {MATCH_IS_POINTER, "matchispointer"}, {MATCH_IS_JOYSTICK, "matchisjoystick"}, @@ -94,6 +95,7 @@ xf86parseInputClassSection(void) list_init(&ptr->match_usbid); list_init(&ptr->match_driver); list_init(&ptr->match_tag); + list_init(&ptr->match_layout); while ((token = xf86getToken(InputClassTab)) != ENDSECTION) { switch (token) { @@ -169,6 +171,12 @@ xf86parseInputClassSection(void) add_group_entry(&ptr->match_tag, xstrtokenize(val.str, TOKEN_SEP)); break; + case MATCH_LAYOUT: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchLayout"); + add_group_entry(&ptr->match_layout, + xstrtokenize(val.str, TOKEN_SEP)); + break; case MATCH_IS_KEYBOARD: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsKeyboard"); @@ -307,6 +315,13 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr) *cur); fprintf(cf, "\"\n"); } + list_for_each_entry(group, &ptr->match_layout, entry) { + fprintf(cf, "\tMatchLayout \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } if (ptr->is_keyboard.set) fprintf(cf, "\tIsKeyboard \"%s\"\n", @@ -392,6 +407,12 @@ xf86freeInputClassList (XF86ConfInputClassPtr ptr) free(*list); free(group); } + list_for_each_entry_safe(group, next, &ptr->match_layout, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } TestFree(ptr->comment); xf86optionListFree(ptr->option_lst); diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h index 4f279f18d..a8785c5fa 100644 --- a/hw/xfree86/parser/xf86Parser.h +++ b/hw/xfree86/parser/xf86Parser.h @@ -358,6 +358,7 @@ typedef struct struct list match_usbid; struct list match_driver; struct list match_tag; + struct list match_layout; xf86TriState is_keyboard; xf86TriState is_pointer; xf86TriState is_joystick; diff --git a/hw/xfree86/parser/xf86tokens.h b/hw/xfree86/parser/xf86tokens.h index 468a2ffa2..abcafcf8e 100644 --- a/hw/xfree86/parser/xf86tokens.h +++ b/hw/xfree86/parser/xf86tokens.h @@ -282,6 +282,7 @@ typedef enum { MATCH_USBID, MATCH_DRIVER, MATCH_TAG, + MATCH_LAYOUT, MATCH_IS_KEYBOARD, MATCH_IS_POINTER, MATCH_IS_JOYSTICK, From b5d828789c092c994722a896c252212e2b3614ab Mon Sep 17 00:00:00 2001 From: Simon Thum Date: Thu, 10 Mar 2011 21:03:40 +0100 Subject: [PATCH 7/7] xserver: remove AbsoluteClass, breaking the A(P|B)I This struct was unused and has been effectively removed in commit 633b81e8ba09cc6a1ea8b43f323874fda2cf0bde Refs: xorg-server-1.10.0-133-g633b81e Remove the remainder, with an ABI bump to 13.0. Signed-off-by: Simon Thum Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- dix/devices.c | 9 --------- hw/xfree86/common/xf86Module.h | 2 +- include/input.h | 6 ------ include/inputstr.h | 2 -- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index 9a4498b9f..0ccf25277 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1360,15 +1360,6 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, return TRUE; } -Bool -InitAbsoluteClassDeviceStruct(DeviceIntPtr dev) -{ - /* This is an API-preserving noop. Instructions: Kill when no more drivers - * call it. The infrastructure behind hasn't really been used, so any calls - * are likely just a declaration that the device is absolute. */ - return FALSE; -} - Bool InitFocusClassDeviceStruct(DeviceIntPtr dev) { diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 94f17e980..2a5c805c4 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -83,7 +83,7 @@ typedef enum { */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(11, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(12, 2) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(13, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(5, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/include/input.h b/include/input.h index 4de4ff52c..56847ed8d 100644 --- a/include/input.h +++ b/include/input.h @@ -305,12 +305,6 @@ extern _X_EXPORT Bool InitPointerAccelerationScheme( DeviceIntPtr /*dev*/, int /*scheme*/); -/** - * This is not implemented and just returns FALSE. - */ -extern _X_EXPORT _X_DEPRECATED Bool InitAbsoluteClassDeviceStruct( - DeviceIntPtr /*device*/); - extern _X_EXPORT Bool InitFocusClassDeviceStruct( DeviceIntPtr /*device*/); diff --git a/include/inputstr.h b/include/inputstr.h index bc0accc87..00f72c260 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -371,7 +371,6 @@ typedef struct _ClassesRec { ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; - void* _pad0; /* keep ABI during AbsoluteClass removal */ KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed; @@ -496,7 +495,6 @@ typedef struct _DeviceIntRec { ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; - void* _pad0; /* keep ABI, was pointer to abs class */ KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed;