aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/src/kinput.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
commit4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch)
treec1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/hw/kdrive/src/kinput.c
parentdc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff)
downloadvcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip
Added xorg-server-1.6.2.tar.gz
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 9ba11661c..8e6a475d1 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;
@@ -438,7 +438,6 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
}
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
- GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), pi->nAxes);
@@ -1015,13 +1014,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
@@ -1084,13 +1085,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);
@@ -1128,12 +1131,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;
@@ -1391,11 +1392,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();
}
@@ -1744,7 +1740,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",
@@ -1777,7 +1773,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif
+#endif /* DEBUG */
static void
KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
@@ -1929,11 +1925,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;
}
@@ -1984,9 +1980,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);
}
}
}
@@ -2048,9 +2045,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",
@@ -2111,13 +2109,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;
@@ -2152,10 +2154,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
@@ -2330,11 +2333,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 ();
}
@@ -2349,7 +2352,7 @@ void
ProcessInputEvents ()
{
mieqProcessInputEvents();
- miPointerUpdate();
+ miPointerUpdateSprite(inputInfo.pointer);
if (kdSwitchPending)
KdProcessSwitch ();
KdCheckLock ();
@@ -2407,6 +2410,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
return Success;
case DEVICE_CORE:
+ return BadMatch;
case DEVICE_ENABLE:
return Success;