summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-02-18 11:45:29 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-22 14:35:45 +1000
commit77113dd3eef03dd65b556b672d976817b3f4542e (patch)
treefb1a4039af4f6ae7dd7af57a78ecde827faf0743
parent2936635698619271a790004480a14285149277cb (diff)
input: Change a bunch of direct dev->u.master accesses to use GetMaster()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
-rw-r--r--Xi/exevents.c2
-rw-r--r--Xi/xichangehierarchy.c4
-rw-r--r--Xi/xiquerydevice.c2
-rw-r--r--dix/devices.c10
-rw-r--r--dix/events.c4
-rw-r--r--mi/mieq.c10
6 files changed, 17 insertions, 15 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 0df65791a..736896092 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -716,7 +716,7 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
if (IsFloating(slave))
return; /* set floating since the event */
- if (slave->u.master->id != dce->masterid)
+ if (GetMaster(slave, MASTER_ATTACHED)->id != dce->masterid)
return; /* not our slave anymore, don't care */
/* FIXME: we probably need to send a DCE for the new slave now */
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index b9cdedf77..6683f6a5c 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -282,12 +282,12 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
for (attached = inputInfo.devices; attached; attached = attached->next)
{
if (!IsMaster(attached)) {
- if (attached->u.master == ptr)
+ if (GetMaster(attached, MASTER_ATTACHED) == ptr)
{
AttachDevice(client, attached, newptr);
flags[attached->id] |= XISlaveAttached;
}
- if (attached->u.master == keybd)
+ if (GetMaster(attached, MASTER_ATTACHED) == keybd)
{
AttachDevice(client, attached, newkeybd);
flags[attached->id] |= XISlaveAttached;
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 3cad8d7f1..8b5421130 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -375,7 +375,7 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
{
- DeviceIntPtr master = dev->u.master;
+ DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
int use;
if (IsMaster(dev))
diff --git a/dix/devices.c b/dix/devices.c
index f7018d0d1..058f32b05 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -446,7 +446,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
{
for (other = inputInfo.devices; other; other = other->next)
{
- if (other->u.master == dev)
+ if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev)
{
AttachDevice(NULL, other, NULL);
flags[other->id] |= XISlaveDetached;
@@ -2327,7 +2327,7 @@ RecalculateMasterButtons(DeviceIntPtr slave)
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (IsMaster(dev) ||
- dev->u.master != master ||
+ GetMaster(dev, MASTER_ATTACHED) != master ||
!dev->button)
continue;
@@ -2408,8 +2408,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
free(dev->spriteInfo->sprite);
}
- oldmaster = dev->u.master;
- dev->u.master = master;
+ oldmaster = GetMaster(dev, MASTER_ATTACHED);
+ dev->master = master;
/* If device is set to floating, we need to create a sprite for it,
* otherwise things go bad. However, we don't want to render the cursor,
@@ -2460,7 +2460,7 @@ DeviceIntPtr
GetPairedDevice(DeviceIntPtr dev)
{
if (!IsMaster(dev) && !IsFloating(dev))
- dev = dev->u.master;
+ dev = GetMaster(dev, MASTER_ATTACHED);
return dev->spriteInfo->paired;
}
diff --git a/dix/events.c b/dix/events.c
index b0e52f1c4..8b3bfb791 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1407,7 +1407,7 @@ DetachFromMaster(DeviceIntPtr dev)
if (!IsFloating(dev))
return;
- dev->saved_master_id = dev->u.master->id;
+ dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
AttachDevice(NULL, dev, NULL);
}
@@ -3237,7 +3237,7 @@ ProcWarpPointer(ClientPtr client)
dev = PickPointer(client);
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
- if ((tmp == dev) || (!IsMaster(tmp) && tmp->u.master == dev)) {
+ if (GetMaster(tmp, MASTER_ATTACHED) == dev) {
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
if (rc != Success)
return rc;
diff --git a/mi/mieq.c b/mi/mieq.c
index 6853103a5..a3e60855d 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -321,6 +321,7 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
DeviceIntPtr mdev;
int len = original->any.length;
int type = original->any.type;
+ int mtype; /* which master type? */
CHECKEVENT(original);
@@ -337,20 +338,21 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
{
case ET_KeyPress:
case ET_KeyRelease:
- mdev = GetMaster(sdev, MASTER_KEYBOARD);
+ mtype = MASTER_KEYBOARD;
break;
case ET_ButtonPress:
case ET_ButtonRelease:
case ET_Motion:
case ET_ProximityIn:
case ET_ProximityOut:
- mdev = GetMaster(sdev, MASTER_POINTER);
+ mtype = MASTER_POINTER;
break;
default:
- mdev = sdev->u.master;
+ mtype = MASTER_ATTACHED;
break;
}
+ mdev = GetMaster(sdev, mtype);
memcpy(copy, original, len);
ChangeDeviceID(mdev, copy);
FixUpEventForMaster(mdev, sdev, original, copy);
@@ -466,7 +468,7 @@ mieqProcessInputEvents(void)
pthread_mutex_unlock(&miEventQueueMutex);
#endif
- master = (dev && !IsMaster(dev) && dev->u.master) ? dev->u.master : NULL;
+ master = (dev) ? GetMaster(dev, MASTER_ATTACHED) : NULL;
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);