xserver: Branch 'input-hotplug' - 3 commits
Daniel Stone
daniels at kemper.freedesktop.org
Sun Oct 22 16:33:10 EEST 2006
Xi/chgdctl.c | 99 ++++++++++++++++++++++++-------------------------
dix/devices.c | 4 +
dix/getevents.c | 5 --
hw/kdrive/src/kinput.c | 8 +--
mi/mieq.c | 2
5 files changed, 59 insertions(+), 59 deletions(-)
New commits:
diff-tree be21630164e865eca72ff2a686a38ae4e30fd79c (from f08b6b2367705cb5b60e996e6328197430bf1919)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 16:33:02 2006 +0300
dix, Xi: make use of deviceid in DevicePresenceNotify
Use the deviceid and control fields in DevicePresenceNotify since
the last push to inputproto to send a DPN whenever a control changes
on a device.
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 597955c..badd938 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -66,6 +66,7 @@ SOFTWARE.
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
+#include "exevents.h"
#include "chgdctl.h"
@@ -98,7 +99,7 @@ int
ProcXChangeDeviceControl(ClientPtr client)
{
unsigned len;
- int i, status;
+ int i, status, ret = BadValue;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
@@ -108,6 +109,7 @@ ProcXChangeDeviceControl(ClientPtr clien
xDeviceAbsAreaCtl *area;
xDeviceCoreCtl *c;
xDeviceEnableCtl *e;
+ devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -115,9 +117,8 @@ ProcXChangeDeviceControl(ClientPtr clien
len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadDevice);
- return Success;
+ ret = BadDevice;
+ goto out;
}
rep.repType = X_Reply;
@@ -130,25 +131,22 @@ ProcXChangeDeviceControl(ClientPtr clien
r = (xDeviceResolutionCtl *) & stuff[1];
if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) ||
(len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl,
- 0, BadLength);
- return Success;
+ ret = BadLength;
+ goto out;
}
if (!dev->valuator) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
+ goto out;
}
if ((dev->grab) && !SameClient(dev->grab, client)) {
rep.status = AlreadyGrabbed;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
- return Success;
+ ret = Success;
+ goto out;
}
resolution = (CARD32 *) (r + 1);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadValue);
- return Success;
+ ret = BadValue;
+ goto out;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (status == Success) {
@@ -162,23 +160,21 @@ ProcXChangeDeviceControl(ClientPtr clien
}
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
+
+ ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
case DEVICE_ABS_CALIB:
calib = (xDeviceAbsCalibCtl *)&stuff[1];
if (calib->button_threshold < 0 || calib->button_threshold > 255) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadValue);
- return Success;
+ ret = BadValue;
+ goto out;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
@@ -192,15 +188,12 @@ ProcXChangeDeviceControl(ClientPtr clien
dev->absolute->flip_y = calib->flip_y;
dev->absolute->rotation = calib->rotation;
dev->absolute->button_threshold = calib->button_threshold;
+ ret = Success;
} else if (status == DeviceBusy || status == BadValue) {
rep.status = status;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
@@ -216,15 +209,12 @@ ProcXChangeDeviceControl(ClientPtr clien
dev->absolute->height = area->height;
dev->absolute->screen = area->screen;
dev->absolute->following = area->following;
+ ret = Success;
} else if (status == DeviceBusy || status == BadValue) {
rep.status = status;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = Success;
}
break;
@@ -235,15 +225,12 @@ ProcXChangeDeviceControl(ClientPtr clien
if (status == Success) {
dev->coreEvents = c->status;
+ ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
@@ -257,23 +244,35 @@ ProcXChangeDeviceControl(ClientPtr clien
EnableDevice(dev);
else
DisableDevice(dev);
+ ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
default:
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
- return Success;
+ ret = BadValue;
+ }
+
+out:
+ if (ret == Success) {
+ dpn.type = DevicePresenceNotify;
+ dpn.time = currentTime.milliseconds;
+ dpn.devchange = 1;
+ dpn.deviceid = dev->id;
+ dpn.control = stuff->control;
+ SendEventToAllWindows(dev, DevicePresenceNotifyMask,
+ (xEvent *) &dpn, 1);
+
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
+ }
+ else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret);
}
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
+
return Success;
}
diff --git a/dix/devices.c b/dix/devices.c
index c906bcd..5ea7b14 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -201,6 +201,8 @@ ActivateDevice(DeviceIntPtr dev)
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
+ ev.devchange = 0;
+ ev.deviceid = 0;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
@@ -557,6 +559,8 @@ RemoveDevice(DeviceIntPtr dev)
if (ret == Success) {
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
+ ev.devchange = 0;
+ ev.deviceid = 0;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
diff-tree f08b6b2367705cb5b60e996e6328197430bf1919 (from 77e724585f6c53feb55475b94d8cfcb6acf1159b)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 12:30:02 2006 +0300
kdrive: change DEVICE_TOUCHSCREEN to DEVICE_ABS_{CALIB,AREA}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 449be9e..a2e2c0f 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2316,11 +2316,9 @@ ChangeDeviceControl(register ClientPtr c
/* FIXME do something more intelligent here */
return BadMatch;
- case DEVICE_TOUCHSCREEN:
- if (!pDev->touchscreen)
- return BadDevice;
- else
- return Success;
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return Success;
case DEVICE_CORE:
return Success;
diff-tree 77e724585f6c53feb55475b94d8cfcb6acf1159b (from e26a494f417c3c700636ee68892c3015b2e0f27a)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 20 00:44:46 2006 +0300
minor formatting fixes
diff --git a/dix/getevents.c b/dix/getevents.c
index 42b9df9..c6a35ba 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1,6 +1,6 @@
/*
* Copyright © 2006 Nokia Corporation
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and that
@@ -121,7 +121,7 @@ GetKeyboardValuatorEvents(xEvent *events
if (!events)
return 0;
-
+
if (type != KeyPress && type != KeyRelease)
return 0;
@@ -179,7 +179,6 @@ GetKeyboardValuatorEvents(xEvent *events
events += numEvents;
}
}
-
ms = GetTimeInMillis();
diff --git a/mi/mieq.c b/mi/mieq.c
index 0ac68d6..63cd6e1 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -113,7 +113,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e
ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
return;
}
- if (oldtail == miEventQueue.head ||
+ if (oldtail == miEventQueue.head ||
!(lastkbp->type == DeviceMotionNotify ||
lastkbp->type == DeviceButtonPress ||
lastkbp->type == DeviceButtonRelease) ||
More information about the xorg-commit
mailing list