xserver: Branch 'mpx'

Peter Hutterer whot at kemper.freedesktop.org
Thu Mar 22 09:28:52 EET 2007


 Xi/Makefile.am |    4 ++
 Xi/extinit.c   |   14 +++++++
 Xi/getcptr.c   |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Xi/getcptr.h   |   43 ++++++++++++++++++++++
 Xi/getpairp.c  |  110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Xi/getpairp.h  |   45 +++++++++++++++++++++++
 Xi/querydp.c   |    1 
 dix/cursor.c   |    1 
 dix/events.c   |    6 ++-
 9 files changed, 332 insertions(+), 3 deletions(-)

New commits:
diff-tree f8cd19bd1692d12a6047c088a626a6ae715d469d (from 0acf993e2878d0866fd4e2db8252c1ea6841e494)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Mar 22 17:47:01 2007 +1030

    Xi:     add GetClientPointer and GetPointerPairing requests.
    
    dix:    use PickKeyboard for ProcSetInputFocus and ProcGetInputFocus instead
            of the core keyboard.

diff --git a/Xi/Makefile.am b/Xi/Makefile.am
index 16d0e8d..9b1253e 100644
--- a/Xi/Makefile.am
+++ b/Xi/Makefile.am
@@ -32,6 +32,8 @@ libXi_la_SOURCES =	\
 	extinit.c \
 	getbmap.c \
 	getbmap.h \
+	getcptr.c \
+	getcptr.h \
 	getdctl.c \
 	getdctl.h \
 	getfctl.c \
@@ -42,6 +44,8 @@ libXi_la_SOURCES =	\
 	getkmap.h \
 	getmmap.c \
 	getmmap.h \
+	getpairp.c \
+	getpairp.h \
 	getprop.c \
 	getprop.h \
 	getselev.c \
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 672d333..3766a95 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -86,11 +86,13 @@ SOFTWARE.
 #include "devbell.h"
 #include "getbmap.h"
 #include "getbmap.h"
+#include "getcptr.h"
 #include "getdctl.h"
 #include "getfctl.h"
 #include "getfocus.h"
 #include "getkmap.h"
 #include "getmmap.h"
+#include "getpairp.h"
 #include "getprop.h"
 #include "getselev.h"
 #include "getvers.h"
@@ -370,6 +372,10 @@ ProcIDispatch(register ClientPtr client)
         return ProcXQueryWindowAccess(client);
     else if (stuff->data == X_SetClientPointer)
         return ProcXSetClientPointer(client);
+    else if (stuff->data == X_GetClientPointer)
+        return ProcXGetClientPointer(client);
+    else if (stuff->data == X_GetPairedPointer)
+        return ProcXGetPairedPointer(client);
     else {
 	SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
     }
@@ -477,6 +483,10 @@ SProcIDispatch(register ClientPtr client
         return SProcXQueryWindowAccess(client);
     else if (stuff->data == X_SetClientPointer)
         return SProcXSetClientPointer(client);
+    else if (stuff->data == X_GetClientPointer)
+        return SProcXGetClientPointer(client);
+    else if (stuff->data == X_GetPairedPointer)
+        return SProcXGetPairedPointer(client);
     else {
 	SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
     }
@@ -561,6 +571,10 @@ SReplyIDispatch(ClientPtr client, int le
     else if (rep->RepType == X_QueryWindowAccess)
         SRepXQueryWindowAccess(client, len,
                                (xQueryWindowAccessReply*) rep);
+    else if (rep->RepType == X_GetClientPointer)
+        SRepXGetClientPointer(client, len, (xGetClientPointerReply*) rep);
+    else if (rep->RepType == X_GetPairedPointer)
+        SRepXGetPairedPointer(client, len, (xGetPairedPointerReply*) rep);
     else {
 	FatalError("XINPUT confused sending swapped reply");
     }
diff --git a/Xi/getcptr.c b/Xi/getcptr.c
new file mode 100644
index 0000000..d9ca4d3
--- /dev/null
+++ b/Xi/getcptr.c
@@ -0,0 +1,111 @@
+/*
+
+Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
+
+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 both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the author shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the author.
+
+*/
+
+#define	 NEED_EVENTS
+#define	 NEED_REPLIES
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>	/* for inputstr.h    */
+#include <X11/Xproto.h>	/* Request macro     */
+#include "inputstr.h"	/* DeviceIntPtr      */
+#include "windowstr.h"	/* window structure  */
+#include "scrnintstr.h"	/* screen structure  */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "extnsionst.h"
+#include "extinit.h"	/* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "getcptr.h"
+
+/***********************************************************************
+ * This procedure allows a client to query another client's client pointer
+ * setting.
+ */
+
+int
+SProcXGetClientPointer(ClientPtr client)
+{
+    char n;
+    REQUEST(xGetClientPointerReq);
+
+    swaps(&stuff->length, n);
+    swapl(&stuff->win, n);
+    return ProcXGetClientPointer(client);
+}
+
+int ProcXGetClientPointer(ClientPtr client)
+{
+    int err;
+    WindowPtr win;
+    ClientPtr winclient;
+    xGetClientPointerReply rep;
+    REQUEST(xGetClientPointerReq);
+    REQUEST_SIZE_MATCH(xGetClientPointerReq);
+
+    err = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
+    if (err != Success)
+    {
+        SendErrorToClient(client, IReqCode, X_GetClientPointer, 
+                stuff->win, err); 
+        return Success;
+    }
+
+    winclient = wClient(win);
+
+    rep.repType = X_Reply;
+    rep.RepType = X_GetClientPointer;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.set = (winclient->clientPtr != NULL);
+    rep.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0;
+
+    WriteReplyToClient(client, sizeof(xGetClientPointerReply), &rep);
+    return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetClientPointer function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void 
+SRepXGetClientPointer(ClientPtr client, int size, 
+        xGetClientPointerReply* rep)
+{
+    char n;
+    swaps(&rep->sequenceNumber, n);
+    swapl(&rep->length, n);
+    WriteToClient(client, size, (char *)rep);
+}
+
diff --git a/Xi/getcptr.h b/Xi/getcptr.h
new file mode 100644
index 0000000..456d1ba
--- /dev/null
+++ b/Xi/getcptr.h
@@ -0,0 +1,43 @@
+/************************************************************
+
+Copyright 2007 by Peter Hutterer <peter at cs.unisa.edu.au>
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef GETCPTR_H
+#define GETCPTR_H 1
+int SProcXGetClientPointer(ClientPtr /* client */
+        );
+
+int ProcXGetClientPointer(ClientPtr /* client */
+        );
+
+void SRepXGetClientPointer(ClientPtr /* client */,
+        int /* size */,
+        xGetClientPointerReply* /* rep */
+        );
+
+#endif /* GETCPTR_H */
diff --git a/Xi/getpairp.c b/Xi/getpairp.c
new file mode 100644
index 0000000..4f1ff03
--- /dev/null
+++ b/Xi/getpairp.c
@@ -0,0 +1,110 @@
+/*
+
+Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
+
+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 both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the author shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the author.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>	/* for inputstr.h    */
+#include <X11/Xproto.h>	/* Request macro     */
+#include "inputstr.h"	/* DeviceIntPtr      */
+#include "windowstr.h"	/* window structure  */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "extnsionst.h"
+#include "extinit.h"	/* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+#include "getpairp.h"
+
+/***********************************************************************
+ *
+ * This procedure allows a client to query the paired pointer for a keyboard
+ * device.
+ *
+ */
+
+int
+SProcXGetPairedPointer(ClientPtr client)
+{
+    char n;
+    REQUEST(xGetPairedPointerReq);
+    swaps(&stuff->length, n);
+    return (ProcXGetPairedPointer(client));
+}
+
+int 
+ProcXGetPairedPointer(ClientPtr client)
+{
+    xGetPairedPointerReply rep;
+    DeviceIntPtr kbd, ptr;
+
+    REQUEST(xGetPairedPointerReq);
+    REQUEST_SIZE_MATCH(xGetPairedPointerReq);
+
+    kbd = LookupDeviceIntRec(stuff->deviceid);
+    if (!kbd || !kbd->key) {
+        SendErrorToClient(client, IReqCode, X_GetPairedPointer,
+                stuff->deviceid, BadDevice);
+        return Success;
+    }
+
+    ptr = GetPairedPointer(kbd);
+
+    rep.repType = X_Reply;
+    rep.RepType = X_GetPairedPointer;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    if (ptr == inputInfo.pointer)
+    {
+        rep.paired = FALSE;
+        rep.deviceid = 0;
+    } else 
+    {
+        rep.paired = TRUE;
+        rep.deviceid = ptr->id;
+    }
+    WriteReplyToClient(client, sizeof(xGetPairedPointerReply), &rep);
+    return Success;
+}
+
+void
+SRepXGetPairedPointer(ClientPtr client, int size,
+        xGetPairedPointerReply* rep)
+{
+    char n;
+
+    swaps(&rep->sequenceNumber, n);
+    swapl(&rep->length, n);
+    WriteToClient(client, size, (char *)rep);
+}
diff --git a/Xi/getpairp.h b/Xi/getpairp.h
new file mode 100644
index 0000000..9b4759e
--- /dev/null
+++ b/Xi/getpairp.h
@@ -0,0 +1,45 @@
+/*
+
+Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
+
+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 both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the author shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the author.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef GETPAIRP_H
+#define GETPAIRP_H 1
+
+int SProcXGetPairedPointer(ClientPtr /* client */
+        );
+int ProcXGetPairedPointer(ClientPtr /* client */
+        );
+void SRepXGetPairedPointer(ClientPtr /* client */,
+        int /* size */,
+        xGetPairedPointerReply* /* rep */
+        );
+
+#endif /* GETPAIRP_H */
diff --git a/Xi/querydp.c b/Xi/querydp.c
index c1ba2ee..a24dad0 100644
--- a/Xi/querydp.c
+++ b/Xi/querydp.c
@@ -164,3 +164,4 @@ SRepXQueryDevicePointer(ClientPtr client
     swapl(&rep->length, n);
     WriteToClient(client, size, (char *)rep);
 }
+
diff --git a/dix/cursor.c b/dix/cursor.c
index 5b5c498..c58e2fa 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -131,7 +131,6 @@ FreeCursor(pointer value, XID cid)
     }
     FreeCursorBits(pCurs->bits);
     xfree( pCurs);
-    MPXDBG("freeing memory for cursor\n");
     return(Success);
 }
 
diff --git a/dix/events.c b/dix/events.c
index c9b5a4f..65d6eae 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3897,6 +3897,7 @@ int
 ProcSetInputFocus(client)
     ClientPtr client;
 {
+    DeviceIntPtr kbd = PickKeyboard(client);
     REQUEST(xSetInputFocusReq);
 
     REQUEST_SIZE_MATCH(xSetInputFocusReq);
@@ -3904,16 +3905,17 @@ ProcSetInputFocus(client)
     if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
 	return Success;
 
-    return SetInputFocus(client, inputInfo.keyboard, stuff->focus,
+    return SetInputFocus(client, kbd, stuff->focus,
 			 stuff->revertTo, stuff->time, FALSE);
 }
 
 int
 ProcGetInputFocus(ClientPtr client)
 {
+    DeviceIntPtr kbd = PickKeyboard(client);
     xGetInputFocusReply rep;
     /* REQUEST(xReq); */
-    FocusClassPtr focus = inputInfo.keyboard->focus;
+    FocusClassPtr focus = kbd->focus;
 
     REQUEST_SIZE_MATCH(xReq);
     rep.type = X_Reply;



More information about the xorg-commit mailing list