xserver: Branch 'input-hotplug' - 11 commits
Daniel Stone
daniels at kemper.freedesktop.org
Wed Oct 25 02:22:02 EEST 2006
dix/devices.c | 15 ++++-
dix/getevents.c | 117 +++++++++++++++++++++++++++++++++++++++--
hw/kdrive/src/kinput.c | 18 ------
hw/vfb/InitInput.c | 4 -
hw/xfree86/common/xf86Module.h | 2
hw/xfree86/common/xf86Xinput.c | 58 --------------------
hw/xfree86/common/xf86Xinput.h | 11 ---
hw/xfree86/loader/misym.c | 2
hw/xfree86/loader/xf86sym.c | 2
hw/xnest/Pointer.c | 4 -
include/input.h | 13 ++++
include/inputstr.h | 51 +++++++++++------
mi/mipointer.c | 70 ------------------------
mi/mipointer.h | 9 ---
mi/mipointrst.h | 9 ---
15 files changed, 179 insertions(+), 206 deletions(-)
New commits:
diff-tree 3da918a16c8908fdfaf89f2a1bcaec19e01528a9 (from aabc087998e680c2fcf0ebc1c5022c1fe8f58f0c)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 02:22:07 2006 +0300
mipointer: remember to update pointer location
Update pointer location so it doesn't get quickly reset by the next
pointer update.
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 679b760..dbe2aae 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -484,4 +484,8 @@ miPointerMoved (DeviceIntPtr pDev, Scree
if(!miPointer.pCursor->bits->emptyMask)
(*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
+
+ miPointer.x = x;
+ miPointer.y = y;
+ miPointer.pScreen = pScreen;
}
diff-tree aabc087998e680c2fcf0ebc1c5022c1fe8f58f0c (from 65cd5aa4d754624566c2263015f1a018d137fce1)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 02:21:39 2006 +0300
GetPointerEvents: always ensure correct number of events
Ensure correct number of valuator events are returned, and that we always
increment events correctly.
diff --git a/dix/getevents.c b/dix/getevents.c
index 0a228cd..e34058c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -504,7 +504,7 @@ GetPointerEvents(xEvent *events, DeviceI
num_events = 1;
/* Do we need to send a DeviceValuator event? */
- if ((num_valuators + first_valuator) >= 2 && sendValuators) {
+ if ((num_valuators + first_valuator) > 2 && sendValuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS * 6;
num_events += ((num_valuators - 1) / 6) + 1;
@@ -614,9 +614,9 @@ GetPointerEvents(xEvent *events, DeviceI
kbp->root_x = x;
kbp->root_y = y;
+ events++;
if (final_valuator > 2 && sendValuators) {
kbp->deviceid |= MORE_EVENTS;
- events++;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,
num_valuators, valuators);
diff-tree 65cd5aa4d754624566c2263015f1a018d137fce1 (from 0514d53e10b3521bb708a9cbde4bab525248eadb)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:12:45 2006 +0300
kdrive/input: remove unnecessary #ifdef XINPUTs
Xi is now mandatory, so don't bother with the ifdefs.
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 724f724..fdeed82 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -45,14 +45,12 @@
#include <X11/extensions/XKBsrv.h>
#endif
-#ifdef XINPUT
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
-#endif
#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
@@ -394,9 +392,7 @@ KdPointerProc(DeviceIntPtr pDevice, int
{
DevicePtr pDev = (DevicePtr)pDevice;
KdPointerInfo *pi;
-#ifdef XINPUT
Atom xiclass;
-#endif
if (!pDev)
return BadImplementation;
@@ -719,9 +715,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int
Bool ret;
DevicePtr pDev = (DevicePtr)pDevice;
KdKeyboardInfo *ki;
-#ifdef XINPUT
Atom xiclass;
-#endif
if (!pDev)
return BadImplementation;
@@ -794,11 +788,9 @@ KdKeyboardProc(DeviceIntPtr pDevice, int
return BadImplementation;
}
-#ifdef XINPUT
xiclass = AtomFromName(XI_KEYBOARD);
AssignTypeAndName(pDevice, xiclass,
ki->name ? ki->name : "Generic KDrive Keyboard");
-#endif
KdResetInputMachine();
@@ -987,9 +979,7 @@ KdAddKeyboard (KdKeyboardInfo *ki)
return !Success;
}
-#ifdef XINPUT
RegisterOtherDevice(ki->dixdev);
-#endif
#ifdef DEBUG
ErrorF("added keyboard %s with dix id %d\n", ki->name, ki->dixdev->id);
@@ -1058,9 +1048,7 @@ KdAddPointer (KdPointerInfo *pi)
return BadDevice;
}
-#ifdef XINPUT
RegisterOtherDevice(pi->dixdev);
-#endif
for (prev = &kdPointers; *prev; prev = &(*prev)->next);
*prev = pi;
diff-tree 0514d53e10b3521bb708a9cbde4bab525248eadb (from b1debebf8fe20ded20ba27e871fd1a6a9de029e3)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:10:44 2006 +0300
xfree86: remove motion history handling
Remove motion history handling, as we now deal with this in the DIX.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 36f2362..915a219 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -138,13 +138,6 @@ xf86ProcessCommonOptions(LocalDevicePtr
} else {
xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
}
-
- local->history_size = xf86SetIntOption(list, "HistorySize", 0);
-
- if (local->history_size > 0) {
- xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
- local->history_size);
- }
}
void
@@ -736,57 +729,6 @@ xf86PostKeyboardEvent(DeviceIntPtr
mieqEnqueue(device, xf86Events + i);
}
-/*
- * Motion history management.
- */
-
-_X_EXPORT void
-xf86MotionHistoryAllocate(LocalDevicePtr local)
-{
- ValuatorClassPtr valuator = local->dev->valuator;
-
- if (!HAS_MOTION_HISTORY(local))
- return;
- if (local->motion_history) xfree(local->motion_history);
- local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time))
- * valuator->numMotionEvents);
- local->first = 0;
- local->last = 0;
-}
-
-_X_EXPORT int
-xf86GetMotionEvents(DeviceIntPtr dev,
- xTimecoord *buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen)
-{
- LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
- ValuatorClassPtr valuator = dev->valuator;
- int num = 0;
- int loop = local->first;
- int size;
- Time current;
-
- if (!HAS_MOTION_HISTORY(local))
- return 0;
-
- size = (sizeof(INT32) * valuator->numAxes + sizeof(Time));
-
- while (loop != local->last) {
- current = *(Time*)(((char *)local->motion_history)+loop*size);
- if (current > stop)
- return num;
- if (current >= start) {
- memcpy(((char *)buff)+size*num,
- ((char *)local->motion_history)+loop*size, size);
- num++;
- }
- loop = (loop + 1) % valuator->numMotionEvents;
- }
- return num;
-}
-
_X_EXPORT LocalDevicePtr
xf86FirstLocalDevice()
{
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 73dcdb7..fe65643 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -86,10 +86,6 @@
#define XI_PRIVATE(dev) \
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
-#ifdef HAS_MOTION_HISTORY
-#undef HAS_MOTION_HISTORY
-#endif
-#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
#ifdef XINPUT
/* This holds the input driver entry and module information. */
@@ -138,9 +134,6 @@ typedef struct _LocalDeviceRec {
DeviceIntPtr dev;
pointer private;
int private_flags;
- pointer motion_history;
- ValuatorMotionProcPtr motion_history_proc;
- unsigned int history_size; /* only for configuration purpose */
unsigned int first;
unsigned int last;
int old_x;
@@ -176,10 +169,6 @@ void xf86PostKeyEvent(DeviceIntPtr devic
...);
void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
int is_down);
-void xf86MotionHistoryAllocate(LocalDevicePtr local);
-int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
void xf86XinputFinalizeInit(DeviceIntPtr dev);
void xf86ActivateDevice(LocalDevicePtr local);
Bool xf86CheckButton(int button, int down);
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 8e39373..3051ded 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -697,8 +697,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86PostButtonEvent)
SYMFUNC(xf86PostKeyEvent)
SYMFUNC(xf86PostKeyboardEvent)
- SYMFUNC(xf86GetMotionEvents)
- SYMFUNC(xf86MotionHistoryAllocate)
SYMFUNC(xf86FirstLocalDevice)
SYMFUNC(xf86ActivateDevice)
SYMFUNC(xf86XInputSetScreen)
diff-tree b1debebf8fe20ded20ba27e871fd1a6a9de029e3 (from b9e180e632d04bf685ade9e32bd0b20882794486)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:10:20 2006 +0300
mi: remove mi motion history
This is now unneeded as we do motion history in the DIX.
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index 3f959fa..46d6a02 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -191,8 +191,6 @@ _X_HIDDEN void *miLookupTab[] = {
SYMFUNC(miSegregateChildren)
SYMFUNC(miHookInitVisuals)
SYMFUNC(miPointerAbsoluteCursor)
- SYMFUNC(miPointerGetMotionEvents)
- SYMFUNC(miPointerGetMotionBufferSize)
SYMFUNC(miOverlayCopyUnderlay)
SYMFUNC(miOverlaySetTransFunction)
SYMFUNC(miOverlayCollectUnderlayRegions)
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 7f850ad..679b760 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -128,7 +128,6 @@ miPointerInitialize (pScreen, spriteFunc
miPointer.confined = FALSE;
miPointer.x = 0;
miPointer.y = 0;
- miPointer.history_start = miPointer.history_end = 0;
return TRUE;
}
@@ -267,39 +266,6 @@ miPointerWarpCursor (pScreen, x, y)
* Pointer/CursorDisplay interface routines
*/
-_X_EXPORT int
-miPointerGetMotionBufferSize ()
-{
- return MOTION_SIZE;
-}
-
-_X_EXPORT int
-miPointerGetMotionEvents (pPtr, coords, start, stop, pScreen)
- DeviceIntPtr pPtr;
- xTimecoord *coords;
- unsigned long start, stop;
- ScreenPtr pScreen;
-{
- int i;
- int count = 0;
- miHistoryPtr h;
-
- for (i = miPointer.history_start; i != miPointer.history_end;)
- {
- h = &miPointer.history[i];
- if (h->event.time >= stop)
- break;
- if (h->event.time >= start)
- {
- *coords++ = h->event;
- count++;
- }
- if (++i == MOTION_SIZE) i = 0;
- }
- return count;
-}
-
-
/*
* miPointerUpdate
*
@@ -518,44 +484,4 @@ miPointerMoved (DeviceIntPtr pDev, Scree
if(!miPointer.pCursor->bits->emptyMask)
(*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
-
- miPointerUpdateHistory(pDev, pScreen, x, y, time);
-}
-
-/* The pointer has moved to x, y; update the motion history. */
-void
-miPointerUpdateHistory (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
- unsigned long time)
-{
- miHistoryPtr history;
- int prev, end, start;
-
- miPointer.x = x;
- miPointer.y = y;
- miPointer.pScreen = pScreen;
-
- end = miPointer.history_end;
- start = miPointer.history_start;
- prev = end - 1;
- if (end == 0)
- prev = MOTION_SIZE - 1;
- history = &miPointer.history[prev];
- if (end == start || history->event.time != time)
- {
- history = &miPointer.history[end];
- if (++end == MOTION_SIZE)
- end = 0;
- if (end == start)
- {
- start = end + 1;
- if (start == MOTION_SIZE)
- start = 0;
- miPointer.history_start = start;
- }
- miPointer.history_end = end;
- }
- history->event.x = x;
- history->event.y = y;
- history->event.time = time;
- history->pScreen = pScreen;
}
diff --git a/mi/mipointer.h b/mi/mipointer.h
index 21b55fa..30e8944 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -181,14 +181,6 @@ extern void miPointerMoved(
int y,
unsigned long time);
-/* Updates the event history. */
-extern void miPointerUpdateHistory(
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x,
- int y,
- unsigned long time);
-
extern int miPointerScreenIndex;
#endif /* MIPOINTER_H */
diff --git a/mi/mipointrst.h b/mi/mipointrst.h
index 2ebf327..a80c52e 100644
--- a/mi/mipointrst.h
+++ b/mi/mipointrst.h
@@ -32,13 +32,6 @@ in this Software without prior written a
#include "mipointer.h"
#include "scrnintstr.h"
-#define MOTION_SIZE 256
-
-typedef struct {
- xTimecoord event;
- ScreenPtr pScreen;
-} miHistoryRec, *miHistoryPtr;
-
typedef struct {
ScreenPtr pScreen; /* current screen */
ScreenPtr pSpriteScreen;/* screen containing current sprite */
@@ -48,8 +41,6 @@ typedef struct {
Bool confined; /* pointer can't change screens */
int x, y; /* hot spot location */
int devx, devy; /* sprite position */
- miHistoryRec history[MOTION_SIZE];
- int history_start, history_end;
} miPointerRec, *miPointerPtr;
typedef struct {
diff-tree b9e180e632d04bf685ade9e32bd0b20882794486 (from 5b38eb69cdaa154791c7f74e35dbe4d3256b19bd)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:09:19 2006 +0300
port all users to the new DIX motion history API
Port KDrive, Xvfb, and Xnest, as well as the virtual core devices, to the
new motion history API. Make GetPointerEvents also update the history.
diff --git a/dix/devices.c b/dix/devices.c
index 86e1e7a..a5110ff 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -285,10 +285,9 @@ CorePointerProc(DeviceIntPtr pDev, int w
case DEVICE_INIT:
for (i = 1; i <= 32; i++)
map[i] = i;
- /* we don't keep history, for now. */
InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
- NULL, (PtrCtrlProcPtr)NoopDDA,
- 0, 2);
+ GetMotionHistory, (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), 2);
pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
pDev->valuator->lastx = pDev->valuator->axisVal[0];
pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
diff --git a/dix/getevents.c b/dix/getevents.c
index 8e22ad6..0a228cd 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -591,6 +591,8 @@ GetPointerEvents(xEvent *events, DeviceI
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
valuators[1 - first_valuator] = y;
+ updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
+
if (pDev->coreEvents) {
cp->valuator->lastx = x;
cp->valuator->lasty = y;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 78943e4..724f724 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -445,11 +445,10 @@ KdPointerProc(DeviceIntPtr pDevice, int
}
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
- miPointerGetMotionEvents,
+ GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
- miPointerGetMotionBufferSize(), pi->nAxes);
+ GetMotionHistorySize(), pi->nAxes);
-#ifdef XINPUT
if (pi->inputClass == KD_TOUCHSCREEN) {
InitAbsoluteClassDeviceStruct(pDevice);
xiclass = AtomFromName(XI_TOUCHSCREEN);
@@ -460,7 +459,6 @@ KdPointerProc(DeviceIntPtr pDevice, int
AssignTypeAndName(pi->dixdev, xiclass,
pi->name ? pi->name : "Generic KDrive Pointer");
-#endif
return Success;
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index c0bfb55..9cb1c02 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -292,8 +292,8 @@ vfbMouseProc(DeviceIntPtr pDevice, int o
map[1] = 1;
map[2] = 2;
map[3] = 3;
- InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents,
- (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize(), 2);
+ InitPointerDeviceStruct(pDev, map, 3, GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
break;
case DEVICE_ON:
diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index b5e45db..912b6fa 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -57,9 +57,9 @@ xnestPointerProc(DeviceIntPtr pDev, int
for (i = 0; i <= nmap; i++)
map[i] = i; /* buttons are already mapped */
InitPointerDeviceStruct(&pDev->public, map, nmap,
- miPointerGetMotionEvents,
+ GetMotionHistory,
xnestChangePointerControl,
- miPointerGetMotionBufferSize(), 2);
+ GetMotionHistorySize(), 2);
break;
case DEVICE_ON:
xnestEventMask |= XNEST_POINTER_EVENT_MASK;
diff-tree 5b38eb69cdaa154791c7f74e35dbe4d3256b19bd (from 11fb58be77ac163844e494b2b0a260cf28a7ecd1)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:08:29 2006 +0300
dix: add motion history support
Add motion history support (sort of based on the XFree86 DDX's
implementation) to the DIX.
diff --git a/dix/devices.c b/dix/devices.c
index 5ea7b14..86e1e7a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -793,7 +793,12 @@ InitValuatorClassDeviceStruct(DeviceIntP
numAxes * sizeof(unsigned int));
if (!valc)
return FALSE;
+
+ valc->motion = NULL;
+ valc->first_motion = 0;
+ valc->last_motion = 0;
valc->GetMotionProc = motionProc;
+
valc->numMotionEvents = numMotionEvents;
valc->motionHintWindow = NullWindow;
valc->numAxes = numAxes;
@@ -805,6 +810,11 @@ InitValuatorClassDeviceStruct(DeviceIntP
valc->dxremaind = 0;
valc->dyremaind = 0;
dev->valuator = valc;
+
+ /* biggest hack ever. */
+ if (motionProc == GetMotionHistory)
+ AllocateMotionHistory(dev);
+
for (i=0; i<numAxes; i++) {
InitValuatorAxisStruct(dev, i, 0, -1, 0, 0, 0);
valc->axisVal[i]=0;
diff --git a/dix/getevents.c b/dix/getevents.c
index bec3c3b..8e22ad6 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -66,6 +66,9 @@ extern Bool XkbCopyKeymap(XkbDescPtr src
/* Maximum number of valuators, divided by six, rounded up. */
#define MAX_VALUATOR_EVENTS 6
+/* Number of motion history events to store. */
+#define MOTION_HISTORY_SIZE 256
+
/**
* Returns the maximum number of events GetKeyboardEvents,
* GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
@@ -368,6 +371,108 @@ getValuatorEvents(xEvent *events, Device
}
/**
+ * Pick some arbitrary size for Xi motion history.
+ */
+_X_EXPORT int
+GetMotionHistorySize()
+{
+ return MOTION_HISTORY_SIZE;
+}
+
+/**
+ * Allocate the motion history buffer.
+ */
+_X_EXPORT void
+AllocateMotionHistory(DeviceIntPtr pDev)
+{
+ if (pDev->valuator->motion)
+ xfree(pDev->valuator->motion);
+
+ if (pDev->valuator->numMotionEvents < 1)
+ return;
+
+ pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes) +
+ sizeof(Time)) *
+ pDev->valuator->numMotionEvents);
+ pDev->valuator->first_motion = 0;
+ pDev->valuator->last_motion = 0;
+}
+
+/**
+ * Dump the motion history between start and stop into the supplied buffer.
+ * Only records the event for a given screen in theory, but in practice, we
+ * sort of ignore this.
+ */
+_X_EXPORT int
+GetMotionHistory(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
+ unsigned long stop, ScreenPtr pScreen)
+{
+ int i = 0, ret = 0;
+ /* The size of a single motion event. */
+ int size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
+ Time current;
+ char *ibuff = NULL, *obuff = (char *) buff;
+
+ if (!pDev->valuator || !pDev->valuator->numMotionEvents)
+ return 0;
+
+ for (i = pDev->valuator->first_motion;
+ i != pDev->valuator->last_motion;
+ i = (i + 1) % pDev->valuator->numMotionEvents) {
+ /* We index the input buffer by which element we're accessing, which
+ * is not monotonic, and the output buffer by how many events we've
+ * written so far. */
+ ibuff = (char *) pDev->valuator->motion + (i * size);
+ memcpy(¤t, ibuff, sizeof(Time));
+
+ if (current > stop) {
+ return ret;
+ }
+ else if (current >= start) {
+ memcpy(obuff, ibuff, size);
+ obuff += size;
+ ret++;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * Update the motion history for a specific device, with the list of
+ * valuators.
+ */
+static void
+updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator,
+ int num_valuators, int *valuators)
+{
+ char *buff = (char *) pDev->valuator->motion;
+
+ if (!pDev->valuator->numMotionEvents)
+ return;
+
+ buff += ((sizeof(INT32) * pDev->valuator->numAxes) + sizeof(CARD32)) *
+ pDev->valuator->last_motion;
+ memcpy(buff, &ms, sizeof(Time));
+
+ buff += sizeof(Time);
+ bzero(buff, sizeof(INT32) * pDev->valuator->numAxes);
+
+ buff += sizeof(INT32) * first_valuator;
+ memcpy(buff, valuators, sizeof(INT32) * num_valuators);
+
+ pDev->valuator->last_motion = (pDev->valuator->last_motion + 1) %
+ pDev->valuator->numMotionEvents;
+
+ /* If we're wrapping around, just keep the circular buffer going. */
+ if (pDev->valuator->first_motion == pDev->valuator->last_motion)
+ pDev->valuator->first_motion = (pDev->valuator->first_motion + 1) %
+ pDev->valuator->numMotionEvents;
+
+ return;
+}
+
+/**
* Generate a series of xEvents (returned in xE) representing pointer
* motion, or button presses. Xi and XKB-aware.
*
diff --git a/include/input.h b/include/input.h
index f6ef337..3fe6944 100644
--- a/include/input.h
+++ b/include/input.h
@@ -418,6 +418,19 @@ extern int GetProximityEvents(
int num_valuators,
int *valuators);
+extern int GetMotionHistorySize(
+ void);
+
+extern void AllocateMotionHistory(
+ DeviceIntPtr pDev);
+
+extern int GetMotionHistory(
+ DeviceIntPtr pDev,
+ xTimecoord *buff,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen);
+
extern void SwitchCoreKeyboard(DeviceIntPtr pDev);
extern void SwitchCorePointer(DeviceIntPtr pDev);
diff --git a/include/inputstr.h b/include/inputstr.h
index 4a48c9d..ada94e6 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -146,15 +146,20 @@ typedef struct _AxisInfo {
typedef struct _ValuatorClassRec {
ValuatorMotionProcPtr GetMotionProc;
- int numMotionEvents;
- WindowPtr motionHintWindow;
- AxisInfoPtr axes;
- unsigned short numAxes;
- int *axisVal;
- CARD8 mode;
- int lastx, lasty; /* last event recorded, not posted to
- * client; see dix/devices.c */
- int dxremaind, dyremaind; /* for acceleration */
+ int numMotionEvents;
+ int first_motion;
+ int last_motion;
+ void *motion;
+
+ WindowPtr motionHintWindow;
+
+ AxisInfoPtr axes;
+ unsigned short numAxes;
+ int *axisVal;
+ int lastx, lasty; /* last event recorded, not posted to
+ * client; see dix/devices.c */
+ int dxremaind, dyremaind; /* for acceleration */
+ CARD8 mode;
} ValuatorClassRec, *ValuatorClassPtr;
typedef struct _ButtonClassRec {
diff-tree 11fb58be77ac163844e494b2b0a260cf28a7ecd1 (from 2a74b8a91da1a98669993078f7fe9081f2d743ce)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:07:36 2006 +0300
miscellaneous warning fixes
Use the correct type for time, and fix the mi prototype of EnqueueEvent.
diff --git a/dix/getevents.c b/dix/getevents.c
index 17a8cb4..bec3c3b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -117,7 +117,8 @@ _X_EXPORT int
GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
int key_code, int first_valuator,
int num_valuators, int *valuators) {
- int numEvents = 0, ms = 0, i = 0;
+ int numEvents = 0, i = 0;
+ CARD32 ms = 0;
int final_valuator = first_valuator + num_valuators;
KeySym sym = pDev->key->curKeySyms.map[key_code *
pDev->key->curKeySyms.mapWidth];
@@ -378,7 +379,8 @@ _X_EXPORT int
GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int flags, int first_valuator, int num_valuators,
int *valuators) {
- int num_events = 0, ms = 0, final_valuator = 0;
+ int num_events = 0, final_valuator = 0;
+ CARD32 ms = 0;
deviceKeyButtonPointer *kbp = NULL;
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr cp = inputInfo.pointer;
diff --git a/mi/mipointer.h b/mi/mipointer.h
index 82ff045..21b55fa 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -73,6 +73,7 @@ typedef struct _miPointerScreenFuncRec {
int /* y */
);
void (*EnqueueEvent)(
+ DeviceIntPtr /* pDev */,
xEventPtr /* event */
);
void (*NewEventScreen)(
diff-tree 2a74b8a91da1a98669993078f7fe9081f2d743ce (from 37d1fffe79c35ada056ce9a56292c000014fe48a)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:04:53 2006 +0300
xfree86: re-bump input abi to 1.0, yet again
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index cf404fb..3c3247e 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -85,7 +85,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 1)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 6)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)
diff-tree 37d1fffe79c35ada056ce9a56292c000014fe48a (from 9f9ac01a819ee96fb5be5d7d346c91f461bf3979)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Tue Oct 24 23:06:57 2006 +0300
inputstr: try to keep device structs the same size
Try to make sure DeviceIntRec and friends stay the same size,
regardless of whether or not XKB is enabled.
diff --git a/include/inputstr.h b/include/inputstr.h
index 1df66da..4a48c9d 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -131,6 +131,8 @@ typedef struct _KeyClassRec {
unsigned short prev_state;
#ifdef XKB
struct _XkbSrvInfo *xkbInfo;
+#else
+ void *pad0;
#endif
} KeyClassRec, *KeyClassPtr;
@@ -163,7 +165,9 @@ typedef struct _ButtonClassRec {
CARD8 down[DOWN_LENGTH];
CARD8 map[MAP_LENGTH];
#ifdef XKB
- union _XkbAction * xkb_acts;
+ union _XkbAction *xkb_acts;
+#else
+ void *pad0;
#endif
} ButtonClassRec, *ButtonClassPtr;
@@ -214,6 +218,8 @@ typedef struct _KbdFeedbackClassRec {
KbdFeedbackPtr next;
#ifdef XKB
struct _XkbSrvLedInfo *xkb_sli;
+#else
+ void *pad0;
#endif
} KbdFeedbackClassRec;
@@ -248,6 +254,8 @@ typedef struct _LedFeedbackClassRec {
LedFeedbackPtr next;
#ifdef XKB
struct _XkbSrvLedInfo *xkb_sli;
+#else
+ void *pad0;
#endif
} LedFeedbackClassRec;
@@ -309,7 +317,9 @@ typedef struct _DeviceIntRec {
BellFeedbackPtr bell;
LedFeedbackPtr leds;
#ifdef XKB
- struct _XkbInterest * xkb_interest;
+ struct _XkbInterest *xkb_interest;
+#else
+ void *pad0;
#endif
DevUnion *devPrivates;
int nPrivates;
diff-tree 9f9ac01a819ee96fb5be5d7d346c91f461bf3979 (from 0cd6a3d8efb5cc1ce4f85ab95bcdf4fb66c7245d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Tue Oct 24 23:01:05 2006 +0300
inputstr: fix indentation
diff --git a/include/inputstr.h b/include/inputstr.h
index 2c64e0d..1df66da 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -93,15 +93,15 @@ typedef struct _OtherInputMasks {
*/
#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
- modifier combinations, but only
- 3 buttons. */
+ modifier combinations, but only
+ 3 buttons. */
- typedef struct _DetailRec { /* Grab details may be bit masks */
- unsigned short exact;
- Mask *pMask;
- } DetailRec;
+typedef struct _DetailRec { /* Grab details may be bit masks */
+ unsigned short exact;
+ Mask *pMask;
+} DetailRec;
- typedef struct _GrabRec {
+typedef struct _GrabRec {
GrabPtr next; /* for chain of passive grabs */
XID resource;
DeviceIntPtr device;
More information about the xorg-commit
mailing list