[PATCH] Use GetMaster instead of direct u.master access in core procs

Alan Coopersmith alan.coopersmith at oracle.com
Thu Aug 12 00:09:02 PDT 2010


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---

Requested by whot during IRC conversation of previous patches.
Also not tested beyond verifying "xset m" seemed to work
with a single physical mouse system.

 dix/devices.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dix/devices.c b/dix/devices.c
index 2e65a04..62ff4b0 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2018,8 +2018,9 @@ ProcChangeKeyboardControl (ClientPtr client)
     keyboard = PickKeyboard(client);
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
-        if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
-            pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+        if ((pDev == keyboard ||
+	     (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
+	    && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
             ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
 	    if (ret != Success)
                 return ret;
@@ -2027,8 +2028,9 @@ ProcChangeKeyboardControl (ClientPtr client)
     }
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
-        if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
-            pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+        if ((pDev == keyboard ||
+	     (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
+	    && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
             ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
             if (ret != Success)
                 error = ret;
@@ -2088,7 +2090,8 @@ ProcBell(ClientPtr client)
 	newpercent = base - newpercent + stuff->percent;
 
     for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if ((dev == keybd || (!IsMaster(dev) && dev->u.master == keybd)) &&
+        if ((dev == keybd ||
+	     (!IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == keybd)) &&
             dev->kbdfeed && dev->kbdfeed->BellProc) {
 
 	    rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixBellAccess);
@@ -2157,7 +2160,8 @@ ProcChangePointerControl(ClientPtr client)
     }
 
     for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if ((dev == mouse || (!IsMaster(dev) && dev->u.master == mouse)) &&
+        if ((dev == mouse ||
+	     (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
             dev->ptrfeed) {
 	    rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
 	    if (rc != Success)
@@ -2166,7 +2170,8 @@ ProcChangePointerControl(ClientPtr client)
     }
 
     for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if ((dev == mouse || (!IsMaster(dev) && dev->u.master == mouse)) &&
+        if ((dev == mouse ||
+	     (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
             dev->ptrfeed) {
             dev->ptrfeed->ctrl = ctrl;
         }
-- 
1.5.6.5



More information about the xorg-devel mailing list