diff options
author | Alexandr Shadchin <shadchin@cvs.openbsd.org> | 2015-01-25 18:49:47 +0000 |
---|---|---|
committer | Alexandr Shadchin <shadchin@cvs.openbsd.org> | 2015-01-25 18:49:47 +0000 |
commit | 724f01294237f1d9b89676be916defbc2cea33c4 (patch) | |
tree | 15a2fe022bbeb1c30433f30157d52e2356d29626 /driver/xf86-input-mouse/src | |
parent | 84afbed31af052396588bed8d5a2c59258dc3613 (diff) |
Update to xf86-input-mouse 1.9.1.
ok matthieu@
Diffstat (limited to 'driver/xf86-input-mouse/src')
-rw-r--r-- | driver/xf86-input-mouse/src/Makefile.in | 2 | ||||
-rw-r--r-- | driver/xf86-input-mouse/src/bsd_mouse.c | 26 | ||||
-rw-r--r-- | driver/xf86-input-mouse/src/mouse.c | 122 | ||||
-rw-r--r-- | driver/xf86-input-mouse/src/sun_mouse.c | 42 |
4 files changed, 144 insertions, 48 deletions
diff --git a/driver/xf86-input-mouse/src/Makefile.in b/driver/xf86-input-mouse/src/Makefile.in index 8bb1c6a30..61f3ba6f7 100644 --- a/driver/xf86-input-mouse/src/Makefile.in +++ b/driver/xf86-input-mouse/src/Makefile.in @@ -244,6 +244,8 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff --git a/driver/xf86-input-mouse/src/bsd_mouse.c b/driver/xf86-input-mouse/src/bsd_mouse.c index b600808f3..fe32d0790 100644 --- a/driver/xf86-input-mouse/src/bsd_mouse.c +++ b/driver/xf86-input-mouse/src/bsd_mouse.c @@ -101,9 +101,7 @@ static const char *mouseDevs[] = { static int SupportedInterfaces(void) { -#if defined(__NetBSD__) - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__NetBSD__) return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; #else return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO | MSE_MISC; @@ -421,7 +419,7 @@ wsconsReadInput(InputInfoPtr pInfo) n /= sizeof(struct wscons_event); while( n-- ) { int buttons = pMse->lastButtons; - int dx = 0, dy = 0, dz = 0, dw = 0; + int dx = 0, dy = 0, dz = 0, dw = 0, x, y; switch (event->type) { case WSCONS_EVENT_MOUSE_UP: #define BUTBIT (1 << (event->value <= 2 ? 2 - event->value : event->value)) @@ -446,6 +444,26 @@ wsconsReadInput(InputInfoPtr pInfo) dw = event->value; break; #endif + case WSCONS_EVENT_MOUSE_ABSOLUTE_X: + x = event->value; + xf86PostMotionEvent(pInfo->dev, TRUE, 0, 1, x); + ++event; + continue; + case WSCONS_EVENT_MOUSE_ABSOLUTE_Y: + y = event->value; + xf86PostMotionEvent(pInfo->dev, TRUE, 1, 1, y); + ++event; + continue; +#ifdef WSCONS_EVENT_MOUSE_ABSOLUTE_Z + case WSCONS_EVENT_MOUSE_ABSOLUTE_Z: + ++event; + continue; +#endif +#ifdef WSCONS_EVENT_MOUSE_ABSOLUTE_W + case WSCONS_EVENT_MOUSE_ABSOLUTE_W: + ++event; + continue; +#endif default: LogMessageVerbSigSafe(X_WARNING, -1, "%s: bad wsmouse event type=%d\n", pInfo->name, diff --git a/driver/xf86-input-mouse/src/mouse.c b/driver/xf86-input-mouse/src/mouse.c index 048706771..f9f874b31 100644 --- a/driver/xf86-input-mouse/src/mouse.c +++ b/driver/xf86-input-mouse/src/mouse.c @@ -67,6 +67,12 @@ #include "xserver-properties.h" #include "xf86-mouse-properties.h" +#ifdef __NetBSD__ +#include <time.h> +#include <dev/wscons/wsconsio.h> +#include <sys/ioctl.h> +#endif + #include "compiler.h" #include "xisb.h" @@ -74,6 +80,13 @@ #include "mousePriv.h" #include "mipointer.h" +/* Xorg >= 1.10 provides an asprintf() implementation even if libc doesn't */ +#include "xorgVersion.h" +#if defined(HAVE_ASPRINTF) || \ + (XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,10,0,0,0)) +# define USE_ASPRINTF +#endif + enum { /* number of bits in mapped nibble */ NIB_BITS=4, @@ -441,20 +454,27 @@ MouseCommonOptions(InputInfoPtr pInfo) } else if (sscanf(s, "%d %d %d %d", &b1, &b2, &b3, &b4) >= 2 && b1 > 0 && b1 <= MSE_MAXBUTTONS && b2 > 0 && b2 <= MSE_MAXBUTTONS) { - msg = xstrdup("buttons XX and YY"); - if (msg) - sprintf(msg, "buttons %d and %d", b1, b2); pMse->negativeZ = 1 << (b1-1); pMse->positiveZ = 1 << (b2-1); if (b3 > 0 && b3 <= MSE_MAXBUTTONS && b4 > 0 && b4 <= MSE_MAXBUTTONS) { - if (msg) - free(msg); - msg = xstrdup("buttons XX, YY, ZZ and WW"); - if (msg) - sprintf(msg, "buttons %d, %d, %d and %d", b1, b2, b3, b4); pMse->negativeW = 1 << (b3-1); pMse->positiveW = 1 << (b4-1); +#ifdef USE_ASPRINTF + if (asprintf(&msg, "buttons %d, %d, %d and %d", + b1, b2, b3, b4) == -1) + msg = NULL; +#else + msg = Xprintf("buttons %d, %d, %d and %d", b1, b2, b3, b4); +#endif + } + else { +#ifdef USE_ASPRINTF + if (asprintf(&msg, "buttons %d and %d", b1, b2) == -1) + msg = NULL; +#else + msg = Xprintf("buttons %d and %d", b1, b2); +#endif } if (b1 > pMse->buttons) pMse->buttons = b1; if (b2 > pMse->buttons) pMse->buttons = b2; @@ -509,9 +529,12 @@ MouseCommonOptions(InputInfoPtr pInfo) if ((sscanf(s, "%d %d", &b1, &b2) == 2) && b1 > 0 && b1 <= MSE_MAXBUTTONS && b2 > 0 && b2 <= MSE_MAXBUTTONS) { - msg = xstrdup("buttons XX and YY"); - if (msg) - sprintf(msg, "buttons %d and %d", b1, b2); +#ifdef USE_ASPRINTF + if (asprintf(&msg, "buttons %d and %d", b1, b2) == -1) + msg = NULL; +#else + msg = Xprintf("buttons %d and %d", b1, b2); +#endif pMse->negativeX = b1; pMse->positiveX = b2; if (b1 > pMse->buttons) pMse->buttons = b1; @@ -534,9 +557,12 @@ MouseCommonOptions(InputInfoPtr pInfo) if ((sscanf(s, "%d %d", &b1, &b2) == 2) && b1 > 0 && b1 <= MSE_MAXBUTTONS && b2 > 0 && b2 <= MSE_MAXBUTTONS) { - msg = xstrdup("buttons XX and YY"); - if (msg) - sprintf(msg, "buttons %d and %d", b1, b2); +#ifdef USE_ASPRINTF + if (asprintf(&msg, "buttons %d and %d", b1, b2) == -1) + msg = NULL; +#else + msg = Xprintf("buttons %d and %d", b1, b2); +#endif pMse->negativeY = b1; pMse->positiveY = b2; if (b1 > pMse->buttons) pMse->buttons = b1; @@ -604,10 +630,14 @@ MouseCommonOptions(InputInfoPtr pInfo) char *msg = NULL; if ((sscanf(s, "%d %d", &b1, &b2) == 2) && - (b1 > 0) && (b1 <= MSE_MAXBUTTONS) && (b2 > 0) && (b2 <= MSE_MAXBUTTONS)) { - msg = xstrdup("buttons XX and YY"); - if (msg) - sprintf(msg, "buttons %d and %d", b1, b2); + (b1 > 0) && (b1 <= MSE_MAXBUTTONS) && + (b2 > 0) && (b2 <= MSE_MAXBUTTONS)) { +#ifdef USE_ASPRINTF + if (asprintf(&msg, "buttons %d and %d", b1, b2) == -1) + msg = NULL; +#else + msg = Xprintf("buttons %d and %d", b1, b2); +#endif pMse->doubleClickTargetButton = b1; pMse->doubleClickTargetButtonMask = 1 << (b1 - 1); pMse->doubleClickSourceButtonMask = 1 << (b2 - 1); @@ -819,11 +849,8 @@ MousePickProtocol(InputInfoPtr pInfo, const char* device, { const char *osProt; if (osInfo->SetupAuto && (osProt = osInfo->SetupAuto(pInfo,NULL))) { - MouseProtocolID id = ProtocolNameToID(osProt); - if (id == PROT_UNKNOWN || id == PROT_UNSUP) { - protocolID = id; - protocol = osProt; - } + protocolID = ProtocolNameToID(osProt); + protocol = osProt; } } @@ -1733,6 +1760,11 @@ MouseProc(DeviceIntPtr device, int what) if (pInfo->fd == -1) xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); else { +#if defined(__NetBSD__) && defined(WSCONS_SUPPORT) && defined(WSMOUSEIO_SETVERSION) + int version = WSMOUSE_EVENT_VERSION; + if (ioctl(pInfo->fd, WSMOUSEIO_SETVERSION, &version) == -1) + xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name); +#endif if (pMse->xisbscale) pMse->buffer = XisbNew(pInfo->fd, pMse->xisbscale * 4); else @@ -2005,7 +2037,8 @@ buttonTimer(InputInfoPtr pInfo) xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); pMse->emulateState = stateTab[pMse->emulateState][4][2]; } else { - LogMessageVerbSigSafe(X_WARNING, -1, "Got unexpected buttonTimer in state %d\n", pMse->emulateState); + LogMessageVerbSigSafe(X_WARNING, -1, + "Got unexpected buttonTimer in state %d\n", pMse->emulateState); } xf86UnblockSIGIO (sigstate); @@ -2046,11 +2079,23 @@ Emulate3ButtonsSoft(InputInfoPtr pInfo) if (!pMse->emulate3ButtonsSoft) return TRUE; - LogMessageVerbSigSafe(X_INFO, 4, "mouse: 3rd Button detected: disabling emulate3Button\n"); +#if defined(__NetBSD__) && defined(WSCONS_SUPPORT) + /* + * On NetBSD a wsmouse is a multiplexed device. Imagine a notebook + * with two-button mousepad, and an external USB mouse plugged in + * temporarily. After using button 3 on the external mouse and + * unplugging it again, the mousepad will still need to emulate + * 3 buttons. + */ + return TRUE; +#else + LogMessageVerbSigSafe(X_INFO, 4, + "mouse: 3rd Button detected: disabling emulate3Button\n"); Emulate3ButtonsSetEnabled(pInfo, FALSE); return FALSE; +#endif } static void MouseBlockHandler(pointer data, @@ -2111,8 +2156,8 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) if (pMse->doubleClickSourceButtonMask) { if (buttons & pMse->doubleClickSourceButtonMask) { if (!(pMse->doubleClickOldSourceState)) { - /* double-click button has just been pressed. Ignore it if target button - * is already down. + /* double-click button has just been pressed. + * Ignore it if target button is already down. */ if (!(buttons & pMse->doubleClickTargetButtonMask)) { /* Target button isn't down, so send a double-click */ @@ -2154,8 +2199,10 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) * If the button is released early enough emit the button * press/release events */ - xf86PostButtonEvent(pInfo->dev, 0, pMse->wheelButton, 1, 0, 0); - xf86PostButtonEvent(pInfo->dev, 0, pMse->wheelButton, 0, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, pMse->wheelButton, + 1, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, pMse->wheelButton, + 0, 0, 0); } } } else @@ -2187,8 +2234,10 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) */ if (!(emuWheelButtonMask & buttons) || (emuWheelButtonMask & wheelButtonMask)) { - xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 1, 0, 0); - xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 0, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, + 1, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, + 0, 0, 0); } } } @@ -2215,8 +2264,10 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) */ if (!(emuWheelButtonMask & buttons) || (emuWheelButtonMask & wheelButtonMask)) { - xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 1, 0, 0); - xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 0, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, + 1, 0, 0); + xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, + 0, 0, 0); } } } @@ -2327,7 +2378,8 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) stateTab[pMse->emulateState][emulateButtons][2]; if (stateTab[pMse->emulateState][4][0] != 0) { - pMse->emulate3Expires = GetTimeInMillis () + pMse->emulate3Timeout; + pMse->emulate3Expires = + GetTimeInMillis() + pMse->emulate3Timeout; pMse->emulate3Pending = TRUE; } else { pMse->emulate3Pending = FALSE; @@ -2608,7 +2660,7 @@ SetupMouse(InputInfoPtr pInfo) ** ** NOTE: There are different versions of both MouseMan and TrackMan! ** Hence I add another protocol PROT_LOGIMAN, which the user can -** specify as MouseMan in his XF86Config file. This entry was +** specify as MouseMan in an xorg.conf file. This entry was ** formerly handled as a special case of PROT_MS. However, people ** who don't have the middle button problem, can still specify ** Microsoft and use PROT_MS. diff --git a/driver/xf86-input-mouse/src/sun_mouse.c b/driver/xf86-input-mouse/src/sun_mouse.c index 16434e677..b092374ee 100644 --- a/driver/xf86-input-mouse/src/sun_mouse.c +++ b/driver/xf86-input-mouse/src/sun_mouse.c @@ -57,6 +57,7 @@ #include "mouse.h" #include "xisb.h" #include "mipointer.h" +#include "xf86Crtc.h" #include <sys/stropts.h> #include <sys/vuid_event.h> #include <sys/msio.h> @@ -405,14 +406,11 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse) ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); int result; - if (!pScr->currentMode) - return; - - if ((pVuidMse->absres.width != pScr->currentMode->HDisplay) || - (pVuidMse->absres.height != pScr->currentMode->VDisplay)) + if ((pVuidMse->absres.width != pScr->virtualX) || + (pVuidMse->absres.height != pScr->virtualY)) { - pVuidMse->absres.width = pScr->currentMode->HDisplay; - pVuidMse->absres.height = pScr->currentMode->VDisplay; + pVuidMse->absres.width = pScr->virtualX; + pVuidMse->absres.height = pScr->virtualY; do { result = ioctl(pInfo->fd, MSIOSRESOLUTION, &(pVuidMse->absres)); @@ -457,6 +455,24 @@ static void vuidMouseAdjustFrame(ADJUST_FRAME_ARGS_DECL) } } } + +static void vuidMouseCrtcNotify(ScreenPtr pScreen) +{ + xf86_crtc_notify_proc_ptr wrappedCrtcNotify + = (xf86_crtc_notify_proc_ptr) vuidMouseGetScreenPrivate(pScreen); + VuidMsePtr m; + ScreenPtr ptrCurScreen; + + if (wrappedCrtcNotify) + wrappedCrtcNotify(pScreen); + + for (m = vuidMouseList; m != NULL ; m = m->next) { + ptrCurScreen = miPointerGetScreen(m->pInfo->dev); + if (ptrCurScreen == pScreen) { + vuidMouseSendScreenSize(pScreen, m); + } + } +} #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */ @@ -492,8 +508,16 @@ vuidMouseProc(DeviceIntPtr pPointer, int what) for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); - vuidMouseSetScreenPrivate(pScreen, pScrn->AdjustFrame); - pScrn->AdjustFrame = vuidMouseAdjustFrame; + if (xf86CrtcConfigPrivateIndex != -1) { + xf86_crtc_notify_proc_ptr pCrtcNotify + = xf86_wrap_crtc_notify(pScreen, + vuidMouseCrtcNotify); + vuidMouseSetScreenPrivate(pScreen, pCrtcNotify); + } else { + vuidMouseSetScreenPrivate(pScreen, + pScrn->AdjustFrame); + pScrn->AdjustFrame = vuidMouseAdjustFrame; + } } vuidMouseGeneration = serverGeneration; } |