summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-05-20 15:28:16 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-22 15:44:50 +1000
commitb12d302df8283186ce87882c29b2b0294adb2770 (patch)
tree7b2f4ce175d1a1aec64a354b922429b50dcc8bde /Xi
parentadd2defac7e59dcb355e5ba12b6de60861741d57 (diff)
Input: rename DeviceIntRec->isMaster to ->type.
isMaster is not enough as long as we differ between master pointers and keyboard. With flexible device classes, the usual checks for whether a master device is a pointer (currently check for ->button, ->valuators or ->key) do not work as an SD may post an event through a master and mess this check up. Example, a device with valuators but no buttons would remove the button class from the VCP and thus result in the IsPointerDevice(inputInfo.pointer) == FALSE. This will become worse in the future when new device classes are introduced that aren't provided in the current system (e.g. a switch class). This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an IsMaster(dev).
Diffstat (limited to 'Xi')
-rw-r--r--Xi/chdevhier.c20
-rw-r--r--Xi/exevents.c10
-rw-r--r--Xi/listdev.c12
-rw-r--r--Xi/opendev.c2
-rw-r--r--Xi/querydev.c10
-rw-r--r--Xi/setcptr.c2
-rw-r--r--Xi/xiallowev.c6
-rw-r--r--Xi/xigrabdev.c2
-rw-r--r--Xi/xipassivegrab.c6
9 files changed, 35 insertions, 35 deletions
diff --git a/Xi/chdevhier.c b/Xi/chdevhier.c
index e59bfab32..927df5569 100644
--- a/Xi/chdevhier.c
+++ b/Xi/chdevhier.c
@@ -243,7 +243,7 @@ ProcXIChangeHierarchy(ClientPtr client)
if (rc != Success)
goto unwind;
- if (!ptr->isMaster)
+ if (!IsMaster(ptr))
{
client->errorValue = r->deviceid;
rc = BadDevice;
@@ -259,7 +259,7 @@ ProcXIChangeHierarchy(ClientPtr client)
}
for(xtstdevice = inputInfo.devices; xtstdevice ; xtstdevice = xtstdevice->next )
- if( !xtstdevice->isMaster && xtstdevice->u.master == ptr &&
+ if( !IsMaster(xtstdevice) && xtstdevice->u.master == ptr &&
dixLookupPrivate(&xtstdevice->devPrivates, XTstDevicePrivateKey ))
break;
@@ -296,7 +296,7 @@ ProcXIChangeHierarchy(ClientPtr client)
{
/* Search the matching keyboard */
for(xtstdevice = inputInfo.devices; xtstdevice ; xtstdevice = xtstdevice->next )
- if( !xtstdevice->isMaster &&
+ if( !IsMaster(xtstdevice) &&
xtstdevice->u.master == keybd &&
IsKeyboardDevice(xtstdevice) &&
dixLookupPrivate(&xtstdevice->devPrivates, XTstDevicePrivateKey ))
@@ -315,7 +315,7 @@ ProcXIChangeHierarchy(ClientPtr client)
xtstkeybd = xtstptr;
/* Search the matching pointer */
for(xtstdevice = inputInfo.devices; xtstdevice ; xtstdevice = xtstdevice->next )
- if( !xtstdevice->isMaster &&
+ if( !IsMaster(xtstdevice) &&
xtstdevice->u.master == ptr &&
IsPointerDevice(xtstdevice) &&
dixLookupPrivate(&xtstdevice->devPrivates, XTstDevicePrivateKey )
@@ -343,7 +343,7 @@ ProcXIChangeHierarchy(ClientPtr client)
if (rc != Success)
goto unwind;
- if (!newptr->isMaster)
+ if (!IsMaster(newptr))
{
client->errorValue = r->return_pointer;
rc = BadDevice;
@@ -355,7 +355,7 @@ ProcXIChangeHierarchy(ClientPtr client)
if (rc != Success)
goto unwind;
- if (!newkeybd->isMaster)
+ if (!IsMaster(newkeybd))
{
client->errorValue = r->return_keyboard;
rc = BadDevice;
@@ -366,7 +366,7 @@ ProcXIChangeHierarchy(ClientPtr client)
attached;
attached = attached->next)
{
- if (!attached->isMaster) {
+ if (!IsMaster(attached)) {
if (attached->u.master == ptr)
{
AttachDevice(client, attached, newptr);
@@ -418,7 +418,7 @@ ProcXIChangeHierarchy(ClientPtr client)
if (rc != Success)
goto unwind;
- if (ptr->isMaster)
+ if (IsMaster(ptr))
{
client->errorValue = c->deviceid;
rc = BadDevice;
@@ -451,7 +451,7 @@ ProcXIChangeHierarchy(ClientPtr client)
if (rc != Success)
goto unwind;
- if (ptr->isMaster)
+ if (IsMaster(ptr))
{
client->errorValue = c->deviceid;
rc = BadDevice;
@@ -473,7 +473,7 @@ ProcXIChangeHierarchy(ClientPtr client)
client, DixWriteAccess);
if (rc != Success)
goto unwind;
- if (!newmaster->isMaster)
+ if (!IsMaster(newmaster))
{
client->errorValue = c->new_master;
rc = BadDevice;
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 04a4fbd0c..d7fb59935 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -721,7 +721,7 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
{
DeviceIntPtr master = device->u.master;
- if (device->isMaster)
+ if (IsMaster(device))
return;
if (!master) /* if device was set floating between SIGIO and now */
@@ -866,7 +866,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
kptr = &b->down[key>>3];
if (!(*kptr & bit))
return DONT_PROCESS;
- if (device->isMaster) {
+ if (IsMaster(device)) {
DeviceIntPtr sd;
/*
@@ -875,7 +875,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
* event being delivered through the slave first
*/
for (sd = inputInfo.devices; sd; sd = sd->next) {
- if (sd->isMaster || sd->u.master != device)
+ if (IsMaster(sd) || sd->u.master != device)
continue;
if (!sd->button)
continue;
@@ -1007,7 +1007,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
b = device->button;
k = device->key;
- if (device->isMaster || !device->u.master)
+ if (IsMaster(device) || !device->u.master)
CheckMotion(event, device);
switch (event->type)
@@ -1201,7 +1201,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeviceIntPtr mouse;
int btlen, len, i;
- mouse = (dev->isMaster || dev->u.master) ? GetPairedDevice(dev) : NULL;
+ mouse = (IsMaster(dev) || dev->u.master) ? GetPairedDevice(dev) : NULL;
/* XI 2 event */
btlen = (mouse->button) ? (mouse->button->numButtons + 7)/8 : 0;
diff --git a/Xi/listdev.c b/Xi/listdev.c
index 294fec999..95c1532b4 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -177,9 +177,9 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
dev->id = d->id;
dev->type = d->xinput_type;
dev->num_classes = num_classes;
- if (d->isMaster && IsKeyboardDevice(d))
+ if (IsMaster(d) && IsKeyboardDevice(d))
dev->use = IsXKeyboard;
- else if (d->isMaster && IsPointerDevice(d))
+ else if (IsMaster(d) && IsPointerDevice(d))
dev->use = IsXPointer;
else if (d->key && d->kbdfeed)
dev->use = IsXExtensionKeyboard;
@@ -344,7 +344,7 @@ ProcXListInputDevices(ClientPtr client)
AddOtherInputDevices();
for (d = inputInfo.devices; d; d = d->next) {
- if (d->isMaster &&
+ if (IsMaster(d) &&
d != inputInfo.pointer &&
d != inputInfo.keyboard)
continue; /* don't send master devices other than VCP/VCK */
@@ -357,7 +357,7 @@ ProcXListInputDevices(ClientPtr client)
}
for (d = inputInfo.off_devices; d; d = d->next) {
- if (d->isMaster &&
+ if (IsMaster(d) &&
d != inputInfo.pointer &&
d != inputInfo.keyboard)
continue; /* don't send master devices other than VCP/VCK */
@@ -378,7 +378,7 @@ ProcXListInputDevices(ClientPtr client)
dev = (xDeviceInfoPtr) devbuf;
for (d = inputInfo.devices; d; d = d->next)
{
- if (d->isMaster &&
+ if (IsMaster(d) &&
d != inputInfo.pointer &&
d != inputInfo.keyboard)
continue; /* don't count master devices other than VCP/VCK */
@@ -388,7 +388,7 @@ ProcXListInputDevices(ClientPtr client)
for (d = inputInfo.off_devices; d; d = d->next)
{
- if (d->isMaster &&
+ if (IsMaster(d) &&
d != inputInfo.pointer &&
d != inputInfo.keyboard)
continue; /* don't count master devices other than VCP/VCK */
diff --git a/Xi/opendev.c b/Xi/opendev.c
index 4ad5af297..46d55a820 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -112,7 +112,7 @@ ProcXOpenDevice(ClientPtr client)
} else if (status != Success)
return status;
- if (dev->isMaster)
+ if (IsMaster(dev))
return BadDevice;
OpenInputDevice(dev, client, &status);
diff --git a/Xi/querydev.c b/Xi/querydev.c
index b50d0382e..d881b7640 100644
--- a/Xi/querydev.c
+++ b/Xi/querydev.c
@@ -88,14 +88,14 @@ ProcXIQueryDevice(ClientPtr client)
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (stuff->deviceid == XIAllDevices ||
- (stuff->deviceid == XIAllMasterDevices && dev->isMaster))
+ (stuff->deviceid == XIAllMasterDevices && IsMaster(dev)))
len += SizeDeviceInfo(dev);
}
for (dev = inputInfo.off_devices; dev; dev = dev->next)
{
if (stuff->deviceid == XIAllDevices ||
- (stuff->deviceid == XIAllMasterDevices && dev->isMaster))
+ (stuff->deviceid == XIAllMasterDevices && IsMaster(dev)))
len += SizeDeviceInfo(dev);
}
@@ -126,7 +126,7 @@ ProcXIQueryDevice(ClientPtr client)
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (stuff->deviceid == XIAllDevices ||
- (stuff->deviceid == XIAllMasterDevices && dev->isMaster))
+ (stuff->deviceid == XIAllMasterDevices && IsMaster(dev)))
{
len = ListDeviceInfo(dev, (xXIDeviceInfo*)info);
if (client->swapped)
@@ -139,7 +139,7 @@ ProcXIQueryDevice(ClientPtr client)
for (dev = inputInfo.off_devices; dev; dev = dev->next)
{
if (stuff->deviceid == XIAllDevices ||
- (stuff->deviceid == XIAllMasterDevices && dev->isMaster))
+ (stuff->deviceid == XIAllMasterDevices && IsMaster(dev)))
{
len = ListDeviceInfo(dev, (xXIDeviceInfo*)info);
if (client->swapped)
@@ -326,7 +326,7 @@ int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
DeviceIntPtr master = dev->u.master;
int use;
- if (dev->isMaster)
+ if (IsMaster(dev))
{
DeviceIntPtr paired = GetPairedDevice(dev);
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 46b88bf6d..0bfc1eab7 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -74,7 +74,7 @@ ProcXISetClientPointer(ClientPtr client)
if (rc != Success)
return rc;
- if (!IsPointerDevice(pDev) || !pDev->isMaster)
+ if (!IsPointerDevice(pDev) || !IsMaster(pDev))
{
client->errorValue = stuff->deviceid;
return BadDevice;
diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c
index 9eb36c42b..3077e1a44 100644
--- a/Xi/xiallowev.c
+++ b/Xi/xiallowev.c
@@ -82,15 +82,15 @@ ProcXIAllowEvents(ClientPtr client)
AllowSome(client, time, dev, THAWED);
break;
case XIAsyncPairedDevice:
- if (dev->isMaster)
+ if (IsMaster(dev))
AllowSome(client, time, dev, THAW_OTHERS);
break;
case XISyncPair:
- if (dev->isMaster)
+ if (IsMaster(dev))
AllowSome(client, time, dev, FREEZE_BOTH_NEXT_EVENT);
break;
case XIAsyncPair:
- if (dev->isMaster)
+ if (IsMaster(dev))
AllowSome(client, time, dev, THAWED_BOTH);
break;
default:
diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index 20f4e5167..95beb832b 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -74,7 +74,7 @@ ProcXIGrabDevice(ClientPtr client)
if (ret != Success)
return ret;
- if (!dev->isMaster)
+ if (!IsMaster(dev))
stuff->paired_device_mode = GrabModeAsync;
memset(mask.xi2mask, 0, sizeof(mask.xi2mask));
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index d2dabba4f..3f46e6766 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -102,7 +102,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
}
/* Can't grab for modifiers on an attached slave device */
- if (!dev->isMaster)
+ if (!IsMaster(dev))
{
if (!dev->u.master)
stuff->paired_device_mode = GrabModeAsync;
@@ -157,7 +157,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (!modifiers_failed)
return BadAlloc;
- if (IsPointerDevice(dev) && dev->isMaster)
+ if (IsPointerDevice(dev) && IsMaster(dev))
mod_dev = GetPairedDevice(dev);
else
mod_dev = dev;
@@ -261,7 +261,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
if (rc != Success)
return rc;
- if (dev->isMaster)
+ if (IsMaster(dev))
mod_dev = GetPairedDevice(dev);
else
mod_dev = dev;