aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/src/kinput.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 20:12:58 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 20:12:58 +0000
commit2553bdd7c359cd87525d367761c86932cec5adff (patch)
treeae71245933c98474a699d3e392de5820879b2018 /xorg-server/hw/kdrive/src/kinput.c
parente2c51f2ee7b0a3ea1a052fc49324057b4a4bbc78 (diff)
parent4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (diff)
downloadvcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.gz
vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.bz2
vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.zip
svn merge file:///D:/svnrepos/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/hw/kdrive/src/kinput.c')
-rw-r--r--xorg-server/hw/kdrive/src/kinput.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c
index b1b04fa52..cef47c74e 100644
--- a/xorg-server/hw/kdrive/src/kinput.c
+++ b/xorg-server/hw/kdrive/src/kinput.c
@@ -65,7 +65,7 @@ static struct KdConfigDevice *kdConfigPointers = NULL;
static KdKeyboardDriver *kdKeyboardDrivers = NULL;
static KdPointerDriver *kdPointerDrivers = NULL;
-static xEvent *kdEvents = NULL;
+static EventListPtr kdEvents = NULL;
static Bool kdInputEnabled;
static Bool kdOffScreen;
@@ -458,7 +458,6 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
}
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
- GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), pi->nAxes);
@@ -1038,13 +1037,15 @@ KdAddKeyboard (KdKeyboardInfo *ki)
if (!ki)
return !Success;
- ki->dixdev = AddInputDevice(KdKeyboardProc, TRUE);
+ ki->dixdev = AddInputDevice(serverClient, KdKeyboardProc, TRUE);
if (!ki->dixdev) {
ErrorF("Couldn't register keyboard device %s\n",
ki->name ? ki->name : "(unnamed)");
return !Success;
}
+ ki->dixdev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
+ ki->dixdev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
RegisterOtherDevice(ki->dixdev);
#ifdef DEBUG
@@ -1107,13 +1108,15 @@ KdAddPointer (KdPointerInfo *pi)
pi->mouseState = start;
pi->eventHeld = FALSE;
- pi->dixdev = AddInputDevice(KdPointerProc, TRUE);
+ pi->dixdev = AddInputDevice(serverClient, KdPointerProc, TRUE);
if (!pi->dixdev) {
ErrorF("Couldn't add pointer device %s\n",
pi->name ? pi->name : "(unnamed)");
return BadDevice;
}
+ pi->dixdev->deviceGrab.ActivateGrab = ActivatePointerGrab;
+ pi->dixdev->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
RegisterOtherDevice(pi->dixdev);
for (prev = &kdPointers; *prev; prev = &(*prev)->next);
@@ -1151,12 +1154,10 @@ KdGetOptions (InputOption **options, char *string)
InputOption *newopt = NULL, **tmpo = NULL;
int tam_key = 0;
- newopt = (InputOption *) xalloc(sizeof (InputOption));
+ newopt = xcalloc(1, sizeof (InputOption));
if (!newopt)
return FALSE;
- bzero(newopt, sizeof (InputOption));
-
for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
; /* Hello, I'm here */
*tmpo = newopt;
@@ -1414,11 +1415,6 @@ KdInitInput (void)
ErrorF("Failed to add keyboard!\n");
}
- if (!kdEvents)
- kdEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
- if (!kdEvents)
- FatalError("Couldn't allocate event buffer\n");
-
mieqInit();
}
@@ -1767,7 +1763,7 @@ KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
return keyboard;
}
-#ifndef NDEBUG
+#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@@ -1800,7 +1796,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif
+#endif /* DEBUG */
static void
KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
@@ -1952,11 +1948,11 @@ KdCheckSpecialKeys(KdKeyboardInfo *ki, int type, int sym)
case XK_BackSpace:
case XK_Delete:
case XK_KP_Delete:
- /*
+ /*
* Set the dispatch exception flag so the server will terminate the
* next time through the dispatch loop.
*/
- if (kdDontZap == FALSE)
+ if (kdAllowZap || party_like_its_1989)
dispatchException |= DE_TERMINATE;
break;
}
@@ -2007,9 +2003,10 @@ KdReleaseAllKeys (void)
key++) {
if (IsKeyDown(ki, key)) {
KdHandleKeyboardEvent(ki, KeyRelease, key);
+ GetEventList(&kdEvents);
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
for (i = 0; i < nEvents; i++)
- KdQueueEvent (ki->dixdev, kdEvents + i);
+ KdQueueEvent (ki->dixdev, (kdEvents + i)->event);
}
}
}
@@ -2071,9 +2068,10 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
KdHandleKeyboardEvent(ki, type, key_code);
}
+ GetEventList(&kdEvents);
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
for (i = 0; i < nEvents; i++)
- KdQueueEvent(ki->dixdev, kdEvents + i);
+ KdQueueEvent(ki->dixdev, (kdEvents + i)->event);
}
else {
ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n",
@@ -2134,13 +2132,17 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
if (flags & KD_MOUSE_DELTA)
{
if (x || y || z)
+ {
dixflags = POINTER_RELATIVE | POINTER_ACCELERATE;
- } else if ((pi->dixdev->valuator) && (x != pi->dixdev->valuator->lastx ||
- y != pi->dixdev->valuator->lasty))
- dixflags = POINTER_ABSOLUTE;
-
- if (dixflags)
- _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ }
+ } else
+ {
+ dixflags = POINTER_ABSOLUTE;
+ if (x != pi->dixdev->last.valuators[0] ||
+ y != pi->dixdev->last.valuators[1])
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ }
buttons = flags;
@@ -2175,10 +2177,11 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
return;
- nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3,
- valuators);
+ GetEventList(&kdEvents);
+ nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel,
+ 0, 3, valuators);
for (i = 0; i < nEvents; i++)
- KdQueueEvent(pi->dixdev, kdEvents + i);
+ KdQueueEvent(pi->dixdev, (kdEvents + i)->event);
}
void
@@ -2353,11 +2356,11 @@ KdCrossScreen(ScreenPtr pScreen, Bool entering)
int KdCurScreen; /* current event screen */
static void
-KdWarpCursor (ScreenPtr pScreen, int x, int y)
+KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
KdBlockSigio ();
KdCurScreen = pScreen->myNum;
- miPointerWarpCursor (pScreen, x, y);
+ miPointerWarpCursor(pDev, pScreen, x, y);
KdUnblockSigio ();
}
@@ -2373,7 +2376,7 @@ void
ProcessInputEvents ()
{
mieqProcessInputEvents();
- miPointerUpdate();
+ miPointerUpdateSprite(inputInfo.pointer);
if (kdSwitchPending)
KdProcessSwitch ();
KdCheckLock ();
@@ -2432,6 +2435,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
return Success;
case DEVICE_CORE:
+ return BadMatch;
case DEVICE_ENABLE:
return Success;