diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-02-14 11:18:43 +1030 |
---|---|---|
committer | Peter Hutterer <whot@hyena.localdomain> | 2007-02-14 11:18:43 +1030 |
commit | 33ef546b942977bb2573156eaba5269350d16f99 (patch) | |
tree | ef32117dc9456bb819b88b1bf91866ed9cbb5192 | |
parent | 7cd73b00a29469d37a7f526cc9b35cc927a13ae2 (diff) |
dix: Clean up GetPointerEvents. If pDev == inputInfo.pointer, assume that
we do not want Xi events.
mi: Remove POINTER_CORE_ONLY flag.
-rw-r--r-- | dix/getevents.c | 42 | ||||
-rw-r--r-- | include/input.h | 1 | ||||
-rw-r--r-- | mi/mipointer.c | 10 |
3 files changed, 22 insertions, 31 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index f9e6962c2..ccaa232d9 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -482,8 +482,6 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type, * The DDX is responsible for allocating the event structure in the first * place via GetMaximumEventsNum(), and for freeing it. * - * If flag has POINTER_CORE_ONLY set, no XI or valuator event will be - * generated. */ _X_EXPORT int GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, @@ -497,7 +495,8 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE); DeviceIntPtr pointer = NULL; int x = 0, y = 0; - Bool coreOnly = (flags & POINTER_CORE_ONLY); + /* The core pointer must not send Xi events. */ + Bool coreOnly = (pDev == inputInfo.pointer); /* Sanity checks. */ if (type != MotionNotify && type != ButtonPress && type != ButtonRelease) @@ -530,10 +529,6 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, ms = GetTimeInMillis(); - kbp = (deviceKeyButtonPointer *) events; - kbp->time = ms; - kbp->deviceid = pDev->id; - if (!pDev->coreEvents || pDev->isMPDev) pointer = pDev; else @@ -598,22 +593,27 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, pDev->valuator->lastx = x; pDev->valuator->lasty = y; - if (type == MotionNotify) { - kbp->type = DeviceMotionNotify; - } - else { - if (type == ButtonPress) - kbp->type = DeviceButtonPress; - else if (type == ButtonRelease) - kbp->type = DeviceButtonRelease; - kbp->detail = pDev->button->map[buttons]; - } - - kbp->root_x = x; - kbp->root_y = y; - + /* create Xi event */ if (!coreOnly) { + kbp = (deviceKeyButtonPointer *) events; + kbp->time = ms; + kbp->deviceid = pDev->id; + + if (type == MotionNotify) { + kbp->type = DeviceMotionNotify; + } + else { + if (type == ButtonPress) + kbp->type = DeviceButtonPress; + else if (type == ButtonRelease) + kbp->type = DeviceButtonRelease; + kbp->detail = pDev->button->map[buttons]; + } + + kbp->root_x = x; + kbp->root_y = y; + events++; if (sendValuators) { kbp->deviceid |= MORE_EVENTS; diff --git a/include/input.h b/include/input.h index f7d12cb5c..96a28a5a1 100644 --- a/include/input.h +++ b/include/input.h @@ -62,7 +62,6 @@ SOFTWARE. #define POINTER_RELATIVE (1 << 1) #define POINTER_ABSOLUTE (1 << 2) #define POINTER_ACCELERATE (1 << 3) -#define POINTER_CORE_ONLY (1 << 4) /* do not generate XI event */ #define MAP_LENGTH 256 #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ diff --git a/mi/mipointer.c b/mi/mipointer.c index 432333d44..ed82fcd8a 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -543,7 +543,6 @@ miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, xEvent* events; int i, nevents; int valuators[2]; - int flags; miPointerPtr pPointer = MIPOINTER(pDev); SetupScreen(pScreen); @@ -571,15 +570,8 @@ miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, return; } - flags = POINTER_ABSOLUTE; - - /* If called from ProcWarpCursor, pDev is the VCP and we must not generate - an XI event. */ - if (pDev == inputInfo.pointer) - flags |= POINTER_CORE_ONLY; - nevents = GetPointerEvents(events, pDev, MotionNotify, 0, - flags, 0, 2, valuators); + POINTER_ABSOLUTE, 0, 2, valuators); for (i = 0; i < nevents; i++) mieqEnqueue(pDev, &events[i]); |