xserver: Branch 'master' - 2 commits
Peter Hutterer
whot at kemper.freedesktop.org
Mon Apr 20 20:13:07 PDT 2009
Xi/chdevhier.c | 2 +-
Xi/exevents.c | 2 ++
dix/devices.c | 26 +++++++++++++++++++-------
include/input.h | 5 +++--
4 files changed, 25 insertions(+), 10 deletions(-)
New commits:
commit 826a5bff0136b2b4d55a9e6e6bc3a7a64da9031e
Author: Benjamin Close <benjamin.close at clearchain.com>
Date: Thu Apr 16 15:33:30 2009 +1000
dix: Change AllocMaster into AllocDevicePair, allow creation of SDs too.
Allocating a slave device is essentially the same as allocating a master device.
Hence we rename AllocMaster to AllocDevicePair and provided the ability to
indicate if a master or slave device pair is required.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/Xi/chdevhier.c b/Xi/chdevhier.c
index 9a85829..5c8b369 100644
--- a/Xi/chdevhier.c
+++ b/Xi/chdevhier.c
@@ -108,7 +108,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
strncpy(name, (char*)&c[1], c->namelen);
- rc = AllocMasterDevice(client, name, &ptr, &keybd);
+ rc = AllocDevicePair(client, name, &ptr, &keybd, TRUE);
if (rc != Success)
{
xfree(name);
diff --git a/dix/devices.c b/dix/devices.c
index 9f56842..bbddf3b 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -545,9 +545,9 @@ CorePointerProc(DeviceIntPtr pDev, int what)
void
InitCoreDevices(void)
{
- if (AllocMasterDevice(serverClient, "Virtual core",
- &inputInfo.pointer,
- &inputInfo.keyboard) != Success)
+ if (AllocDevicePair(serverClient, "Virtual core",
+ &inputInfo.pointer, &inputInfo.keyboard,
+ TRUE) != Success)
FatalError("Failed to allocate core devices");
if (ActivateDevice(inputInfo.pointer) != Success ||
@@ -2270,12 +2270,16 @@ GetPairedDevice(DeviceIntPtr dev)
/**
- * Create a new master device (== one pointer, one keyboard device).
+ * Create a new device pair (== one pointer, one keyboard device).
* Only allocates the devices, you will need to call ActivateDevice() and
* EnableDevice() manually.
+ * Either a master or a slave device can be created depending on
+ * the value for master.
*/
int
-AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr* keybd)
+AllocDevicePair (ClientPtr client, char* name,
+ DeviceIntPtr* ptr, DeviceIntPtr* keybd,
+ Bool master)
{
DeviceIntPtr pointer;
DeviceIntPtr keyboard;
@@ -2299,7 +2303,7 @@ AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr*
pointer->spriteInfo->spriteOwner = TRUE;
pointer->u.lastSlave = NULL;
- pointer->isMaster = TRUE;
+ pointer->isMaster = master;
keyboard = AddInputDevice(client, CoreKeyboardProc, TRUE);
if (!keyboard)
@@ -2321,7 +2325,7 @@ AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr*
keyboard->spriteInfo->spriteOwner = FALSE;
keyboard->u.lastSlave = NULL;
- keyboard->isMaster = TRUE;
+ keyboard->isMaster = master;
/* The ClassesRec stores the device classes currently not used. */
diff --git a/include/input.h b/include/input.h
index 7651919..b3bb5d1 100644
--- a/include/input.h
+++ b/include/input.h
@@ -468,10 +468,11 @@ extern _X_EXPORT int AttachDevice(ClientPtr client,
extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
-extern _X_EXPORT int AllocMasterDevice(ClientPtr client,
+extern _X_EXPORT int AllocDevicePair(ClientPtr client,
char* name,
DeviceIntPtr* ptr,
- DeviceIntPtr* keybd);
+ DeviceIntPtr* keybd,
+ Bool master);
extern _X_EXPORT void DeepCopyDeviceClasses(DeviceIntPtr from,
DeviceIntPtr to);
commit e2e5932bda3f473629d4be6f3ca4dcab18993eb6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu Apr 16 11:06:52 2009 +1000
dix: don't allow more than MAX_VALUATORS on one device.
Some keyboards (?) advertise more than MAX_VALUATORS axes. Parts of the
internal event delivery relies on not having more than MAX_VALUATOR axes, so
let's cap it down.
If there's real devices that require more than the current 36, I'm sure we can
bump this up.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/Xi/exevents.c b/Xi/exevents.c
index cfae57d..3f531d9 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1037,6 +1037,8 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
if (!dev || !dev->valuator || minval > maxval)
return;
+ if (axnum >= dev->valuator->numAxes)
+ return;
ax = dev->valuator->axes + axnum;
diff --git a/dix/devices.c b/dix/devices.c
index d14eddd..9f56842 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1081,6 +1081,14 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
if (!dev)
return FALSE;
+ if (numAxes >= MAX_VALUATORS)
+ {
+ LogMessage(X_WARNING,
+ "Device '%s' has %d axes, only using first %d.\n",
+ dev->name, numAxes, MAX_VALUATORS);
+ numAxes = MAX_VALUATORS;
+ }
+
valc = (ValuatorClassPtr)xcalloc(1, sizeof(ValuatorClassRec) +
numAxes * sizeof(AxisInfo) +
numAxes * sizeof(unsigned int));
More information about the xorg-commit
mailing list