xserver: Branch 'master' - 13 commits

Peter Hutterer whot at kemper.freedesktop.org
Sun Aug 23 17:26:43 PDT 2009


 Xext/xtest.c                       |    1 
 Xi/extinit.c                       |    2 
 Xi/xichangecursor.c                |    3 
 Xi/xichangehierarchy.c             |    4 
 Xi/xiquerypointer.c                |   50 ++++++--
 Xi/xisetdevfocus.c                 |   10 +
 Xi/xisetdevfocus.h                 |    1 
 configure.ac                       |    2 
 dix/devices.c                      |    3 
 dix/events.c                       |    5 
 include/dix.h                      |    3 
 mi/miscrinit.c                     |    1 
 record/record.c                    |    3 
 test/xi2/Makefile.am               |    4 
 test/xi2/protocol-common.c         |   27 ++++
 test/xi2/protocol-xiquerypointer.c |  220 +++++++++++++++++++++++++++++++++++++
 16 files changed, 314 insertions(+), 25 deletions(-)

New commits:
commit 990d204ef8074665763ad129d0b015b7ab3ae9ef
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 24 09:22:16 2009 +1000

    Xext: remove un-used extern of DeviceMotionNotify.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 6248732..c96cbf5 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -53,7 +53,6 @@
 #include "modinit.h"
 
 extern int DeviceValuator;
-extern int DeviceMotionNotify;
 
 /* XTest events are sent during request processing and may be interruped by
  * a SIGIO. We need a separate event list to avoid events overwriting each
commit 80f18a73267bd3090e459de609a7006a21e6c649
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 24 09:21:03 2009 +1000

    input: move CorePointer/KeyboardProc declarations into header.
    
    The extern declaration in xichangehierarchy.c was broken anyway.
    This fixes a crash on creating a new master device.
    
    Reported-by: Maxim Levitsky
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 48d25c3..c123724 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -54,10 +54,6 @@
 
 #include "xichangehierarchy.h"
 
-extern DeviceProc CorePointerProc;
-extern DeviceProc CoreKeyboardProc;
-
-
 /**
  * Send the current state of the device hierarchy to all clients.
  */
diff --git a/dix/devices.c b/dix/devices.c
index e58e940..f73b5ff 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -98,9 +98,6 @@ DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKeyIndex;
 static int XTstDevicePrivateKeyIndex;
 DevPrivateKey XTstDevicePrivateKey = &XTstDevicePrivateKeyIndex;
 
-
-int CorePointerProc(DeviceIntPtr, int);
-int CoreKeyboardProc(DeviceIntPtr, int);
 /**
  * vxtstpointer
  * is the virtual pointer for XTest. It is the first slave
diff --git a/include/dix.h b/include/dix.h
index c6e52e7..e2db6b6 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -586,6 +586,9 @@ extern Bool IsKeyboardDevice(DeviceIntPtr dev);
 extern Bool IsPointerEvent(InternalEvent *event);
 extern Bool IsMaster(DeviceIntPtr dev);
 
+extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
+extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what);
+
 
 /*
  * These are deprecated compatibility functions and will be removed soon!
commit b96823713129f641ee99306e3cadba8dfe21afa2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 24 09:06:29 2009 +1000

    mi: include shmint.h if needed, silence compiler warning.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 996d424..96113d6 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -40,6 +40,7 @@ from The Open Group.
 #include "miline.h"
 #ifdef MITSHM
 #include <X11/extensions/shm.h>
+#include "shmint.h"
 #endif
 
 /* We use this structure to propogate some information from miScreenInit to
commit 1b3859a49a3861517c9b34f6e8750f7ae0ff2b5d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 12:29:39 2009 +1000

    Xi: add swapping hook for XIGetFocus reply.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index e359083..d91de8f 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -525,6 +525,8 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
 	SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
     else if (rep->RepType == X_XIGetSelectedEvents)
 	SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
+    else if (rep->RepType == X_XIGetFocus)
+	SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
     else {
 	FatalError("XINPUT confused sending swapped reply");
     }
diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c
index 32f7e59..059424e 100644
--- a/Xi/xisetdevfocus.c
+++ b/Xi/xisetdevfocus.c
@@ -118,3 +118,13 @@ ProcXIGetFocus(ClientPtr client)
     WriteReplyToClient(client, sizeof(xXIGetFocusReply), &rep);
     return Success;
 }
+
+void
+SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply *rep)
+{
+    char n;
+    swaps(&rep->sequenceNumber, n);
+    swapl(&rep->length, n);
+    swapl(&rep->focus, n);
+    WriteToClient(client, len, (char *)rep);
+}
diff --git a/Xi/xisetdevfocus.h b/Xi/xisetdevfocus.h
index 5ec1fa2..eb584eb 100644
--- a/Xi/xisetdevfocus.h
+++ b/Xi/xisetdevfocus.h
@@ -32,4 +32,5 @@ int ProcXISetFocus(ClientPtr client);
 int SProcXIGetFocus(ClientPtr client);
 int ProcXIGetFocus(ClientPtr client);
 
+void SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply* rep);
 #endif /* XISETDEVFOCUS_H */
commit fe430d7d3b0a85fbea9e93171423688f76dc9e1e
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 12:09:32 2009 +1000

    test: add XIQueryPointer protocol tests.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index b12e0e2..0a2fa08 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -6,6 +6,7 @@ check_PROGRAMS =  \
 	protocol-xigetselectedevents \
         protocol-xisetclientpointer \
         protocol-xigetclientpointer \
+        protocol-xiquerypointer \
         protocol-eventconvert
 
 TESTS=$(check_PROGRAMS)
@@ -21,6 +22,7 @@ protocol_xiselectevents_LDADD=$(TEST_LDADD)
 protocol_xigetselectedevents_LDADD=$(TEST_LDADD)
 protocol_xisetclientpointer_LDADD=$(TEST_LDADD)
 protocol_xigetclientpointer_LDADD=$(TEST_LDADD)
+protocol_xiquerypointer_LDADD=$(TEST_LDADD)
 protocol_eventconvert_LDADD=$(TEST_LDADD)
 
 protocol_xiqueryversion_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient
@@ -29,6 +31,7 @@ protocol_xiselectevents_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,dixLookupWindow -Wl,-wrap,
 protocol_xigetselectedevents_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource
 protocol_xisetclientpointer_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,dixLookupClient
 protocol_xigetclientpointer_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient
+protocol_xiquerypointer_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow
 
 protocol_xiqueryversion_SOURCES=$(COMMON_SOURCES) protocol-xiqueryversion.c
 protocol_xiquerydevice_SOURCES=$(COMMON_SOURCES) protocol-xiquerydevice.c
@@ -36,4 +39,5 @@ protocol_xiselectevents_SOURCES=$(COMMON_SOURCES) protocol-xiselectevents.c
 protocol_xigetselectedevents_SOURCES=$(COMMON_SOURCES) protocol-xigetselectedevents.c
 protocol_xisetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xisetclientpointer.c
 protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xigetclientpointer.c
+protocol_xiquerypointer_SOURCES=$(COMMON_SOURCES) protocol-xiquerypointer.c
 endif
diff --git a/test/xi2/protocol-xiquerypointer.c b/test/xi2/protocol-xiquerypointer.c
new file mode 100644
index 0000000..810c615
--- /dev/null
+++ b/test/xi2/protocol-xiquerypointer.c
@@ -0,0 +1,220 @@
+/**
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice (including the next
+ *  paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+/*
+ * Protocol testing for XIQueryPointer request.
+ */
+#include <stdint.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/extensions/XI2proto.h>
+#include "inputstr.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "xiquerypointer.h"
+#include "exevents.h"
+
+#include "protocol-common.h"
+#include <glib.h>
+
+static ClientRec client_request;
+static void reply_XIQueryPointer_data(ClientPtr client, int len,
+                                      char *data, void *userdata);
+
+static struct {
+    DeviceIntPtr dev;
+    WindowPtr win;
+} test_data;
+
+
+/* dixLookupWindow requires a lot of setup not necessary for this test.
+ * Simple wrapper that returns either one of the fake root window or the
+ * fake client window. If the requested ID is neither of those wanted,
+ * return whatever the real dixLookupWindow does.
+ */
+int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+{
+    if (id == root.drawable.id)
+    {
+        *win = &root;
+        return Success;
+    } else if (id == window.drawable.id)
+    {
+        *win = &window;
+        return Success;
+    }
+
+    return __real_dixLookupWindow(win, id, client, access);
+}
+
+static void reply_XIQueryPointer(ClientPtr client, int len, char *data,
+                                 void *userdata)
+{
+    xXIQueryPointerReply *rep = (xXIQueryPointerReply*)data;
+    SpritePtr sprite;
+
+    if (!rep->repType)
+        return;
+
+    if (client->swapped)
+    {
+        char n;
+        swapl(&rep->length, n);
+        swaps(&rep->sequenceNumber, n);
+        swapl(&rep->root, n);
+        swapl(&rep->child, n);
+        swapl(&rep->root_x, n);
+        swapl(&rep->root_y, n);
+        swapl(&rep->win_x, n);
+        swapl(&rep->win_y, n);
+        swaps(&rep->buttons_len, n);
+    }
+
+    reply_check_defaults(rep, len, XIQueryPointer);
+
+    g_assert(rep->root == root.drawable.id);
+    g_assert(rep->same_screen == xTrue);
+
+    sprite = test_data.dev->spriteInfo->sprite;
+    g_assert((rep->root_x >> 16) == sprite->hot.x);
+    g_assert((rep->root_y >> 16) == sprite->hot.y);
+
+    if (test_data.win == &root)
+    {
+        g_assert(rep->root_x == rep->win_x);
+        g_assert(rep->root_y == rep->win_y);
+        g_assert(rep->child == window.drawable.id);
+    } else
+    {
+        int x, y;
+
+        x = sprite->hot.x - window.drawable.x;
+        y = sprite->hot.y - window.drawable.y;
+
+        g_assert((rep->win_x >> 16) == x);
+        g_assert((rep->win_y >> 16) == y);
+        g_assert(rep->child == None);
+    }
+
+
+    g_assert(rep->same_screen == xTrue);
+
+    reply_handler = reply_XIQueryPointer_data;
+}
+
+static void reply_XIQueryPointer_data(ClientPtr client, int len, char *data, void *userdata)
+{
+    reply_handler = reply_XIQueryPointer;
+}
+
+static void request_XIQueryPointer(ClientPtr client, xXIQueryPointerReq* req, int error)
+{
+    char n;
+    int rc;
+
+    rc = ProcXIQueryPointer(&client_request);
+    g_assert(rc == error);
+
+    if (rc == BadDevice)
+        g_assert(client_request.errorValue == req->deviceid);
+
+    client_request.swapped = TRUE;
+    swaps(&req->deviceid, n);
+    swaps(&req->length, n);
+    rc = SProcXIQueryPointer(&client_request);
+    g_assert(rc == error);
+
+    if (rc == BadDevice)
+        g_assert(client_request.errorValue == req->deviceid);
+}
+
+static void test_XIQueryPointer(void)
+{
+    int i;
+    xXIQueryPointerReq request;
+
+    memset(&request, 0, sizeof(request));
+
+    request_init(&request, XIQueryPointer);
+
+    reply_handler = reply_XIQueryPointer;
+
+    client_request = init_client(request.length, &request);
+
+    request.deviceid = XIAllDevices;
+    request_XIQueryPointer(&client_request, &request, BadDevice);
+
+    request.deviceid = XIAllMasterDevices;
+    request_XIQueryPointer(&client_request, &request, BadDevice);
+
+    request.win = root.drawable.id;
+    test_data.win = &root;
+
+    test_data.dev = devices.vcp;
+    request.deviceid = devices.vcp->id;
+    request_XIQueryPointer(&client_request, &request, Success);
+    request.deviceid = devices.vck->id;
+    request_XIQueryPointer(&client_request, &request, BadDevice);
+    request.deviceid = devices.mouse->id;
+    request_XIQueryPointer(&client_request, &request, BadDevice);
+    request.deviceid = devices.kbd->id;
+    request_XIQueryPointer(&client_request, &request, BadDevice);
+
+    test_data.dev = devices.mouse;
+    devices.mouse->u.master = NULL; /* Float, kind-of */
+    request.deviceid = devices.mouse->id;
+    request_XIQueryPointer(&client_request, &request, Success);
+
+    for (i = devices.kbd->id + 1; i <= 0xFFFF; i++)
+    {
+        request.deviceid = i;
+        request_XIQueryPointer(&client_request, &request, BadDevice);
+    }
+
+    request.win = window.drawable.id;
+
+    test_data.dev = devices.vcp;
+    test_data.win = &window;
+    request.deviceid = devices.vcp->id;
+    request_XIQueryPointer(&client_request, &request, Success);
+
+    test_data.dev = devices.mouse;
+    request.deviceid = devices.mouse->id;
+    request_XIQueryPointer(&client_request, &request, Success);
+}
+
+int main(int argc, char** argv)
+{
+    g_test_init(&argc, &argv,NULL);
+    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
+
+    init_simple();
+
+    g_test_add_func("/xi2/protocol/XIQueryPointer", test_XIQueryPointer);
+
+    return g_test_run();
+}
commit 285c88018ba4b3819500027c9b6a05b8c27ff2ee
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 11:38:42 2009 +1000

    Xi: correct length field for XIQueryPointer reply.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 81ba13d..93ceba4 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -119,7 +119,7 @@ ProcXIQueryPointer(ClientPtr client)
     memset(&rep, 0, sizeof(rep));
     rep.repType = X_Reply;
     rep.RepType = X_XIQueryPointer;
-    rep.length = 5;
+    rep.length = 6;
     rep.sequenceNumber = client->sequence;
     rep.root = (GetCurrentRootWindow(pDev))->drawable.id;
     rep.root_x = FP1616(pSprite->hot.x, 0);
commit e4ea91a02d6fac9dad844150c5d2fbe7dc9629b1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 12:12:05 2009 +1000

    Xi: allow XIQueryPointer requests for master pointers and floating slaves.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 80e953d..81ba13d 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -91,7 +91,8 @@ ProcXIQueryPointer(ClientPtr client)
         return rc;
     }
 
-    if (pDev->valuator == NULL)
+    if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
+        (!IsMaster(pDev) && pDev->u.master)) /* no attached devices */
     {
         client->errorValue = stuff->deviceid;
         return BadDevice;
@@ -108,9 +109,14 @@ ProcXIQueryPointer(ClientPtr client)
     if (pDev->valuator->motionHintWindow)
         MaybeStopHint(pDev, client);
 
-    kbd = GetPairedDevice(pDev);
+    if (IsMaster(pDev))
+        kbd = GetPairedDevice(pDev);
+    else
+        kbd = (pDev->key) ? pDev : NULL;
 
     pSprite = pDev->spriteInfo->sprite;
+
+    memset(&rep, 0, sizeof(rep));
     rep.repType = X_Reply;
     rep.RepType = X_XIQueryPointer;
     rep.length = 5;
@@ -120,14 +126,17 @@ ProcXIQueryPointer(ClientPtr client)
     rep.root_y = FP1616(pSprite->hot.y, 0);
     rep.child = None;
 
-    state = &kbd->key->xkbInfo->prev_state;
-    rep.mods.base_mods = state->base_mods;
-    rep.mods.latched_mods = state->latched_mods;
-    rep.mods.locked_mods = state->locked_mods;
-
-    rep.group.base_group = state->base_group;
-    rep.group.latched_group = state->latched_group;
-    rep.group.locked_group = state->locked_group;
+    if (kbd)
+    {
+        state = &kbd->key->xkbInfo->prev_state;
+        rep.mods.base_mods = state->base_mods;
+        rep.mods.latched_mods = state->latched_mods;
+        rep.mods.locked_mods = state->locked_mods;
+
+        rep.group.base_group = state->base_group;
+        rep.group.latched_group = state->latched_group;
+        rep.group.locked_group = state->locked_group;
+    }
 
     if (pDev->button)
     {
commit 8e396f2b806496cdcac233cc731b0322735020c3
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 12:11:19 2009 +1000

    Xi: fix swapping for XIQueryPointer request/reply handling.
    
    buttons_size is necessary as WriteToClient swaps the buttons_len field,
    resulting in the wrong number of bytes being written later.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index d51d383..80e953d 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -64,6 +64,8 @@ SProcXIQueryPointer(ClientPtr client)
 
     REQUEST(xXIQueryPointerReq);
     swaps(&stuff->length, n);
+    swaps(&stuff->deviceid, n);
+    swapl(&stuff->win, n);
     return (ProcXIQueryPointer(client));
 }
 
@@ -77,6 +79,7 @@ ProcXIQueryPointer(ClientPtr client)
     SpritePtr pSprite;
     XkbStatePtr state;
     char *buttons = NULL;
+    int buttons_size = 0; /* size of buttons array */
 
     REQUEST(xXIQueryPointerReq);
     REQUEST_SIZE_MATCH(xXIQueryPointerReq);
@@ -131,7 +134,8 @@ ProcXIQueryPointer(ClientPtr client)
         int i, down;
         rep.buttons_len = bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
         rep.length += rep.buttons_len;
-        buttons = xcalloc(rep.buttons_len, 4);
+        buttons_size = rep.buttons_len * 4;
+        buttons = xcalloc(1, buttons_size);
         if (!buttons)
             return BadAlloc;
 
@@ -180,7 +184,7 @@ ProcXIQueryPointer(ClientPtr client)
 
     WriteReplyToClient(client, sizeof(xXIQueryPointerReply), &rep);
     if (buttons)
-        WriteToClient(client, rep.buttons_len * 4, buttons);
+        WriteToClient(client, buttons_size, buttons);
 
     xfree(buttons);
 
@@ -202,6 +206,14 @@ SRepXIQueryPointer(ClientPtr client, int size,
 
     swaps(&rep->sequenceNumber, n);
     swapl(&rep->length, n);
+    swapl(&rep->root, n);
+    swapl(&rep->child, n);
+    swapl(&rep->root_x, n);
+    swapl(&rep->root_y, n);
+    swapl(&rep->win_x, n);
+    swapl(&rep->win_y, n);
+    swaps(&rep->buttons_len, n);
+
     WriteToClient(client, size, (char *)rep);
 }
 
commit f1c856ef9073d9d02bc84ce1472883c8441a9758
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 10:42:15 2009 +1000

    test: fake initialization of a sprite trace and window locations
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index fc10698..3307499 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -39,6 +39,23 @@ void *userdata;
 
 extern int CorePointerProc(DeviceIntPtr pDev, int what);
 extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
+
+static void fake_init_sprite(DeviceIntPtr dev)
+{
+    SpritePtr sprite;
+    sprite = dev->spriteInfo->sprite;
+
+    sprite->spriteTraceSize = 10;
+    sprite->spriteTrace = xcalloc(sprite->spriteTraceSize, sizeof(WindowPtr));
+    sprite->spriteTraceGood = 1;
+    sprite->spriteTrace[0] = &root;
+    sprite->hot.x = 100;
+    sprite->hot.y = 200;
+    sprite->hotPhys.x = 100;
+    sprite->hotPhys.y = 200;
+    sprite->win = &window;
+}
+
 /**
  * Create and init 2 master devices (VCP + VCK) and two slave devices, one
  * default mouse, one default keyboard.
@@ -69,6 +86,9 @@ struct devices init_devices(void)
     devices.num_devices = 4;
     devices.num_master_devices = 2;
 
+    fake_init_sprite(devices.mouse);
+    fake_init_sprite(devices.vcp);
+
     return devices;
 }
 
@@ -98,6 +118,13 @@ void init_window(WindowPtr window, WindowPtr parent, int id)
     memset(window, 0, sizeof(window));
 
     window->drawable.id = id;
+    if (parent)
+    {
+        window->drawable.x = 30;
+        window->drawable.y = 50;
+        window->drawable.width = 100;
+        window->drawable.height = 200;
+    }
     window->parent = parent;
     window->optional = xcalloc(1, sizeof(WindowOptRec));
     g_assert(window->optional);
commit 58fd28f6b6bebab7f31c54e696f96d64ebb50f5a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 09:44:37 2009 +1000

    Xi: return deviceid as error value in XIQueryPointer.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index da1d101..d51d383 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -83,7 +83,10 @@ ProcXIQueryPointer(ClientPtr client)
 
     rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
     if (rc != Success)
+    {
+        client->errorValue = stuff->deviceid;
         return rc;
+    }
 
     if (pDev->valuator == NULL)
     {
commit b41dd4328bfb8a0981d299bb60f986a2bc55fd24
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 21 09:43:46 2009 +1000

    record: include recordproto.h, require recordproto 1.13.99.1
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index 50ed4cb..bbb5fa8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -848,7 +848,7 @@ fi
 AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
 if test "x$RECORD" = xyes; then
 	AC_DEFINE(XRECORD, 1, [Support Record extension])
-	REQUIRED_MODULES="$REQUIRED_MODULES recordproto"
+	REQUIRED_MODULES="$REQUIRED_MODULES [recordproto >= 1.13.99.1]"
 	RECORD_LIB='$(top_builddir)/record/librecord.la'
 fi
 
diff --git a/record/record.c b/record/record.c
index 7000b00..84a9618 100644
--- a/record/record.c
+++ b/record/record.c
@@ -38,8 +38,7 @@ and Jim Haggerty of Metheus.
 
 #include "dixstruct.h"
 #include "extnsionst.h"
-#define _XRECORD_SERVER_
-#include <X11/extensions/recordstr.h>
+#include <X11/extensions/recordproto.h>
 #include "set.h"
 #include "swaprep.h"
 #include "inputstr.h"
commit 65354e5a698a5b527db09afc431110afba0e14b2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Aug 20 10:52:52 2009 +1000

    Xi: return BadDevice for changing device cursors on non-master pointers.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c
index dc33d70..ea5bdeb 100644
--- a/Xi/xichangecursor.c
+++ b/Xi/xichangecursor.c
@@ -78,6 +78,9 @@ int ProcXIChangeCursor(ClientPtr client)
     if (rc != Success)
         return rc;
 
+    if (!IsMaster(pDev) || !IsPointerDevice(pDev))
+        return BadDevice;
+
     if (stuff->win != None)
     {
         rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
commit ef75301854d41c6b11dd2742fa9d17a5de8a4cfa
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Aug 20 10:52:24 2009 +1000

    dix: FixUpEventFromWindow mustn't scramble non-device events.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index b32960a..de96de3 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2258,7 +2258,10 @@ FixUpEventFromWindow(
             event->evtype == XI_RawKeyRelease ||
             event->evtype == XI_RawButtonPress ||
             event->evtype == XI_RawButtonRelease ||
-            event->evtype == XI_RawMotion)
+            event->evtype == XI_RawMotion ||
+            event->evtype == XI_DeviceChanged ||
+            event->evtype == XI_HierarchyChanged ||
+            event->evtype == XI_PropertyEvent)
             return;
 
         event->root = RootWindow(pDev)->drawable.id;


More information about the xorg-commit mailing list