[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-experimental'



 Xi/exevents.c                           |  951 +
 Xi/extinit.c                            |   26 
 Xi/xiallowev.c                          |   53 
 Xi/xipassivegrab.c                      |   27 
 Xi/xiquerydevice.c                      |   39 
 Xi/xiquerydevice.h                      |    1 
 Xi/xiselectev.c                         |   48 
 configure.ac                            |   14 
 dix/Makefile.am                         |    1 
 dix/devices.c                           |   87 
 dix/eventconvert.c                      |   63 
 dix/events.c                            |   69 
 dix/getevents.c                         |  352 
 dix/grabs.c                             |    3 
 dix/inpututils.c                        |    7 
 dix/touch.c                             |  982 +
 dix/window.c                            |    9 
 glx/Makefile.am                         |    3 
 glx/clientinfo.c                        |   48 
 glx/createcontext.c                     |   38 
 glx/dispatch.h                          |16553 ++++++++++++++++++++++++--------
 glx/glapi.c                             |    6 
 glx/glapi_gentable.c                    | 5265 ++++++----
 glx/glapioffsets.h                      | 1174 --
 glx/glapitable.h                        |  883 +
 glx/glprocs.h                           | 2841 +++--
 glx/glxdri2.c                           |    2 
 glx/glxext.h                            |    2 
 glx/indirect_dispatch.c                 |   76 
 glx/indirect_dispatch.h                 | 2035 +--
 glx/indirect_dispatch_swap.c            |   82 
 glx/indirect_program.c                  |    1 
 glx/indirect_reqsize.c                  |   16 
 glx/indirect_reqsize.h                  |  169 
 glx/indirect_size.h                     |   87 
 glx/indirect_size_get.c                 |  145 
 glx/indirect_size_get.h                 |  113 
 glx/indirect_table.c                    |  215 
 glx/swap_interval.c                     |    1 
 hw/dmx/examples/Makefile.am             |   56 
 hw/kdrive/linux/keyboard.c              |    6 
 hw/kdrive/linux/ms.c                    |    4 
 hw/kdrive/linux/ps2.c                   |    4 
 hw/xfree86/common/xf86Module.h          |    2 
 hw/xfree86/common/xf86Xinput.c          |   24 
 hw/xfree86/common/xf86Xinput.h          |    3 
 hw/xfree86/dri2/dri2.c                  |   36 
 hw/xfree86/dri2/dri2.h                  |    3 
 hw/xfree86/dri2/dri2ext.c               |    4 
 hw/xfree86/man/xorg.conf.man            |    2 
 hw/xquartz/mach-startup/Makefile.am     |    7 
 include/dix.h                           |    7 
 include/events.h                        |    1 
 include/eventstr.h                      |   30 
 include/exevents.h                      |   12 
 include/input.h                         |   87 
 include/inputstr.h                      |   55 
 include/misc.h                          |    4 
 include/protocol-versions.h             |    2 
 mi/mieq.c                               |   37 
 os/client.c                             |   69 
 test/Makefile.am                        |    3 
 test/input.c                            |   17 
 test/touch.c                            |  270 
 test/xi2/protocol-eventconvert.c        |  104 
 test/xi2/protocol-xipassivegrabdevice.c |    2 
 test/xi2/protocol-xiselectevents.c      |   38 
 67 files changed, 23733 insertions(+), 9643 deletions(-)

New commits:
commit 98cde254acb9b98337ddecf64c138d38c14ec2bf
Author: Keith Packard <keithp@keithp.com>
Date:   Tue Dec 27 13:42:21 2011 -0800

    Bump version to 1.11.99.901 (1.12 RC1)
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index 261af5f..6de92b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.11.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-12-17"
+AC_INIT([xorg-server], 1.11.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-12-27"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

commit 5037c9af78da6652189de7202e70e1b833395af5
Author: Keith Packard <keithp@keithp.com>
Date:   Tue Dec 27 14:02:01 2011 -0800

    glx/glapioffsets.h is no longer part of the build, remove it
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/glx/Makefile.am b/glx/Makefile.am
index f61a408..ced78b7 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -43,7 +43,6 @@ glapi_sources =					\
 	glapi.c					\
 	glapi.h					\
 	glapi_gentable.c			\
-	glapioffsets.h				\
 	glprocs.h				\
 	glthread.c				\
 	glthread.h

commit cfc4c3d7fa8bd4da4c08b2ab8e6f85435f75353a
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Sat Dec 24 10:00:56 2011 -0800

    Add Solaris support to DetermineClientCmd
    
    Uses /proc/pid/psinfo to read command & partial arguments.
    
    Moves cmdsize & argsize variables into non-Solaris #else clause
    to avoid unused variable warnings.
    
    Fixes format mismatch errors when building with DEBUG defined on
    a 64-bit platform (where Mask is defined as CARD32).
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/os/client.c b/os/client.c
index 4aec097..8f4707b 100644
--- a/os/client.c
+++ b/os/client.c
@@ -59,6 +59,11 @@
 #include "os.h"
 #include "dixstruct.h"
 
+#ifdef __sun
+#include <errno.h>
+#include <procfs.h>
+#endif
+
 /**
  * Try to determine a PID for a client from its connection
  * information. This should be called only once when new client has
@@ -117,8 +122,6 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
 {
     char path[PATH_MAX + 1];
     int totsize = 0;
-    int cmdsize = 0;
-    int argsize = 0;
     int fd = 0;
 
     if (cmdname)
@@ -129,6 +132,48 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
     if (pid == -1)
         return;
 
+#ifdef __sun /* Solaris */
+    /* Solaris does not support /proc/pid/cmdline, but makes information
+     * similar to what ps shows available in a binary structure in the
+     * /proc/pid/psinfo file. */
+    if (snprintf(path, sizeof(path), "/proc/%d/psinfo", pid) < 0)
+        return;
+    fd = open(path, O_RDONLY);
+    if (fd < 0)
+    {
+        ErrorF ("Failed to open %s: %s\n", path, strerror(errno));
+        return;
+    }
+    else
+    {
+        psinfo_t psinfo = { 0 };
+        char *sp;
+
+        totsize = read(fd, &psinfo, sizeof(psinfo_t));
+        close(fd);
+        if (totsize <= 0)
+            return;
+
+        /* pr_psargs is the first PRARGSZ (80) characters of the command
+         * line string - assume up to the first space is the command name,
+         * since it's not delimited.   While there is also pr_fname, that's
+         * more limited, giving only the first 16 chars of the basename of
+         * the file that was exec'ed, thus cutting off many long gnome
+         * command names, or returning "isapython2.6" for all python scripts.
+         */
+        psinfo.pr_psargs[PRARGSZ-1] = '\0';
+        sp = strchr(psinfo.pr_psargs, ' ');
+        if (sp)
+            *sp++ = '\0';
+
+        if (cmdname)
+            *cmdname = strdup(psinfo.pr_psargs);
+
+        if (cmdargs && sp)
+            *cmdargs = strdup(sp);
+    }
+#else /* not Solaris */
+
     /* Check if /proc/pid/cmdline exists. It's not supported on all
      * operating systems. */
     if (snprintf(path, sizeof(path), "/proc/%d/cmdline", pid) < 0)
@@ -146,17 +191,20 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
     path[totsize - 1] = '\0';
 
     /* Contruct the process name without arguments. */
-    cmdsize = strlen(path) + 1;
     if (cmdname)
     {
         *cmdname = strdup(path);
     }
 
     /* Construct the arguments for client process. */
-    argsize = totsize - cmdsize;
-    if (cmdargs && (argsize > 0))
+    if (cmdargs)
     {
-        char *args = malloc(argsize);
+        int cmdsize = strlen(path) + 1;
+        int argsize = totsize - cmdsize;
+        char *args = NULL;
+
+        if (argsize > 0)
+            args = malloc(argsize);
         if (args)
         {
             int i = 0;
@@ -169,6 +217,7 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
             *cmdargs = args;
         }
     }
+#endif
 }
 
 /**
@@ -192,9 +241,9 @@ void ReserveClientIds(struct _Client *client)
         DetermineClientCmd(client->clientIds->pid, &client->clientIds->cmdname, &client->clientIds->cmdargs);
 
     DebugF("client(%lx): Reserved pid(%d).\n",
-           client->clientAsMask, client->clientIds->pid);
+           (unsigned long) client->clientAsMask, client->clientIds->pid);
     DebugF("client(%lx): Reserved cmdname(%s) and cmdargs(%s).\n",
-           client->clientAsMask,
+           (unsigned long) client->clientAsMask,
            client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
            client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
 #endif /* CLIENTIDS */
@@ -216,9 +265,9 @@ void ReleaseClientIds(struct _Client *client)
         return;
 
     DebugF("client(%lx): Released pid(%d).\n",
-           client->clientAsMask, client->clientIds->pid);
+           (unsigned long) client->clientAsMask, client->clientIds->pid);
     DebugF("client(%lx): Released cmdline(%s) and cmdargs(%s).\n",
-           client->clientAsMask,
+           (unsigned long) client->clientAsMask,
            client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
            client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
 

commit a28ff2cf92c2b35e02eacca21af929afabbf6b83
Author: Chase Douglas <chase.douglas@canonical.com>
Date:   Thu Dec 22 12:00:37 2011 -0800

    test/xi2: Really fix infinite loop in test_convert_XITouchOwnershipEvent
    
    long i;
    for (i = 1; ; i <<= 1)
      if (i == (1 << 31))
        break;
    
    (1 << 31) is compiled as an int, and thus is equal to -2147483648. We
    are trying to compare it against a long, which on 64-bit machines is
    2147483648. This results in an infinite loop.
    
    Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index faa9f40..bf1493c 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -1005,7 +1005,7 @@ test_convert_XITouchOwnershipEvent(void)
     {
         in.touchid = i;
         test_XITouchOwnershipEvent(&in);
-	if (i == (1 << 31))
+	if (i == ((long)1 << 31))
 	    break;
     }
 }

commit e7df42ab68e30588a5e32ed543b0711821daf009
Author: Keith Packard <keithp@keithp.com>
Date:   Thu Dec 22 09:35:51 2011 -0800

    test/xi2: Fix infinite loop in test_convert_XITouchOwnershipEvent
    
    The touchid test was using a loop like:
    
    	for(i = 1; i < 0xffffffff; i <<= 1)
    
    When 'i' is a 32-bit variable, this infinite loops as it goes from
    0x80000000 to 0. 'i' is declared as 'long', which is 32-bit in 32-bit mode.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index 9872b79..faa9f40 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -1001,10 +1001,12 @@ test_convert_XITouchOwnershipEvent(void)
         test_XITouchOwnershipEvent(&in);
     }
 
-    for (i = 1; i <= 0xFFFFFFFF; i <<= 1)
+    for (i = 1; ; i <<= 1)
     {
         in.touchid = i;
         test_XITouchOwnershipEvent(&in);
+	if (i == (1 << 31))
+	    break;
     }
 }
 

commit cf96183122a85e3376e560f0360b38b5676e57a9
Author: Cyril Brulebois <kibi@debian.org>
Date:   Wed Nov 2 12:41:20 2011 +0100

    xorg.conf.man: Fix bad whatis entry.
    
    Debian's QA tool “lintian” reported a bad whatis entry for the
    xorg.conf(.d) manpages.
    
    It comes with the following pointers:
      For manual pages that document multiple programs, functions, files, or
      other things, the part before "\-" should list each separated by a
      comma and a space. […]
    
      Refer to the lexgrog(1) manual page, the groff_man(7) manual page, and
      the groff_mdoc(7) manual page for details.
    
    Indeed, the current situation is:
      $ whatis xorg.conf; whatis xorg.conf.d
      xorg.conf (5)        - (unknown subject)
      xorg.conf.d (5)      - (unknown subject)
    
    With this patch:
      xorg.conf (5)        - configuration files for Xorg X server
      xorg.conf.d (5)      - configuration files for Xorg X server
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Signed-off-by: Cyril Brulebois <kibi@debian.org>

diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 996798f..5790185 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -2,7 +2,7 @@
 .ds q \N'34'
 .TH __xconfigfile__ __filemansuffix__ __vendorversion__
 .SH NAME
-__xconfigfile__ and __xconfigdir__ \- configuration files for
+__xconfigfile__, __xconfigdir__ \- configuration files for
 __xservername__ X server
 .SH INTRODUCTION
 .B __xservername__

commit f75bdf7fbe757f4603e39139acc3c90538a45e15
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Dec 22 10:00:15 2011 +1000

    test: fix grab mode value tests for new XIGrabModeTouch
    
    This test checks that last-valid-mode + 1 returns a BadValue. With the
    addition of XIGrabModeTouch, that value has changed - sync it up again.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/test/input.c b/test/input.c
index d27b3f0..576cd85 100644
--- a/test/input.c
+++ b/test/input.c
@@ -161,22 +161,31 @@ static void dix_check_grab_values(void)
     rc = CheckGrabValues(&client, &param);
     assert(rc == Success);
 
-    param.this_device_mode = GrabModeAsync + 1;
+    param.this_device_mode = XIGrabModeTouch;
+    rc = CheckGrabValues(&client, &param);
+    assert(rc == Success);
+
+    param.this_device_mode = XIGrabModeTouch + 1;
     rc = CheckGrabValues(&client, &param);
     assert(rc == BadValue);
     assert(client.errorValue == param.this_device_mode);
-    assert(client.errorValue == GrabModeAsync + 1);
+    assert(client.errorValue == XIGrabModeTouch + 1);
 
     param.this_device_mode = GrabModeSync;
     param.other_devices_mode = GrabModeAsync;
     rc = CheckGrabValues(&client, &param);
+
+    param.this_device_mode = GrabModeSync;
+    param.other_devices_mode = XIGrabModeTouch;
+    rc = CheckGrabValues(&client, &param);
+    assert(rc == Success);
     assert(rc == Success);
 
-    param.other_devices_mode = GrabModeAsync + 1;
+    param.other_devices_mode = XIGrabModeTouch + 1;
     rc = CheckGrabValues(&client, &param);
     assert(rc == BadValue);
     assert(client.errorValue == param.other_devices_mode);
-    assert(client.errorValue == GrabModeAsync + 1);
+    assert(client.errorValue == XIGrabModeTouch + 1);
 
     param.other_devices_mode = GrabModeSync;
 

commit 2bb282cd45cb8149b39d72397ef5bbcfebca11d2
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Dec 21 14:45:27 2011 +1000

    Xi: only activate the device grab if we don't already have one
    
    If the device is already grabbed, don't activate the passive grab, it screws
    with our event masks. Just deliver to the grabbing client instead.
    
    Reported-by: Carlos Garnacho <carlosg@gnome.org>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 0849690..db49e31 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1385,8 +1385,8 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent
     if (grab)
     {
         /* this side-steps the usual activation mechansims, but... */
-        if (ev->any.type == ET_TouchBegin)
-            ActivatePassiveGrab(dev, grab, ptrev, ev); /* also delivers the event */
+        if (ev->any.type == ET_TouchBegin && !dev->deviceGrab.grab)
+                ActivatePassiveGrab(dev, grab, ptrev, ev); /* also delivers the event */
         else {
             int deliveries = 0;
             /* 'grab' is the passive grab, but if the grab isn't active,

commit 475ef5cc8339fac3696fe654ef683f92f0b0cc2c
Author: Carlos Garnacho <carlosg@gnome.org>
Date:   Wed Dec 21 01:08:40 2011 +0100

    dix: fix xi2 mask/filter when delivering grabbed events
    
    Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/dix/events.c b/dix/events.c
index d802903..5360267 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4192,8 +4192,8 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel l
             if (rc == Success)
             {
                 int evtype = xi2_get_type(xE);
-                mask = xi2mask_isset(grab->xi2mask, dev, evtype);
-                filter = 1;
+                mask = GetXI2MaskByte(grab->xi2mask, dev, evtype);
+                filter = GetEventFilter(dev, xE);
             }
             break;
         case XI:

commit 4551510f752624592f9201f73db89ac1325a234a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Dec 19 09:08:05 2011 +1000

    test: add a basic test for ownership event values
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index dba5cb1..9872b79 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -915,12 +915,106 @@ static void test_convert_XIDeviceChangedEvent(void)
     }
 }
 
+static void
+test_values_XITouchOwnershipEvent(TouchOwnershipEvent *in,
+                                  xXITouchOwnershipEvent *out,
+                                  BOOL swap)
+{
+    if (swap)
+    {
+        swaps(&out->sequenceNumber);
+        swapl(&out->length);
+        swaps(&out->evtype);
+        swaps(&out->deviceid);
+        swaps(&out->sourceid);
+        swapl(&out->time);
+        swapl(&out->touchid);
+        swapl(&out->root);
+        swapl(&out->event);
+        swapl(&out->child);
+        swapl(&out->time);
+    }
+
+    assert(out->type == GenericEvent);
+    assert(out->extension == 0); /* IReqCode defaults to 0 */
+    assert(out->evtype == GetXI2Type(in->type));
+    assert(out->time == in->time);
+    assert(out->deviceid == in->deviceid);
+    assert(out->sourceid == in->sourceid);
+    assert(out->touchid == in->touchid);
+    assert(out->flags == in->reason);
+}
+
+static void
+test_XITouchOwnershipEvent(TouchOwnershipEvent *in)
+{
+    xXITouchOwnershipEvent *out, *swapped;
+    int rc;
+
+    rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+    assert(rc == Success);
+
+    test_values_XITouchOwnershipEvent(in, out, FALSE);
+
+    swapped = calloc(1, sizeof(xEvent) + out->length * 4);
+    XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
+    test_values_XITouchOwnershipEvent(in, swapped, TRUE);
+    free(out);
+    free(swapped);
+}
+
+static void
+test_convert_XITouchOwnershipEvent(void)
+{
+    TouchOwnershipEvent in;
+    long i;
+
+    memset(&in, 0, sizeof(in));
+    in.header           = ET_Internal;
+    in.type             = ET_TouchOwnership;
+    in.length           = sizeof(in);
+    in.time             = 0;
+    in.deviceid         = 1;
+    in.sourceid         = 2;
+    in.touchid          = 0;
+    in.reason           = 0;
+    in.resource         = 0;
+    in.flags            = 0;
+
+    test_XITouchOwnershipEvent(&in);
+
+    in.flags            = XIAcceptTouch;
+    test_XITouchOwnershipEvent(&in);
+
+    in.flags            = XIRejectTouch;
+    test_XITouchOwnershipEvent(&in);
+
+    for (i = 1; i <= 0xFFFF; i <<= 1)
+    {
+        in.deviceid = i;
+        test_XITouchOwnershipEvent(&in);
+    }
+
+    for (i = 1; i <= 0xFFFF; i <<= 1)
+    {
+        in.sourceid = i;
+        test_XITouchOwnershipEvent(&in);
+    }
+
+    for (i = 1; i <= 0xFFFFFFFF; i <<= 1)
+    {
+        in.touchid = i;
+        test_XITouchOwnershipEvent(&in);
+    }
+}
+
 int main(int argc, char** argv)
 {
     test_convert_XIRawEvent();
     test_convert_XIFocusEvent();
     test_convert_XIDeviceEvent();
     test_convert_XIDeviceChangedEvent();
+    test_convert_XITouchOwnershipEvent();
 
     return 0;
 }

commit 0c661dc478b4b436a3e61066d31bc510c7a08456
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Dec 19 08:31:37 2011 +1000

    test: drop printfs from protocol-eventconvert.c
    
    The test outputs are noisy enough, no need having these here too.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index e2037f9..dba5cb1 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -193,7 +193,6 @@ static void test_convert_XIRawEvent(void)
 
     memset(&in, 0, sizeof(in));
 
-    printf("Testing all event types\n");
     in.header = ET_Internal;
     in.type = ET_RawMotion;
     test_XIRawEvent(&in);
@@ -214,7 +213,6 @@ static void test_convert_XIRawEvent(void)
     in.type = ET_RawButtonRelease;
     test_XIRawEvent(&in);
 
-    printf("Testing details and other fields\n");
     in.detail.button = 1L;
     test_XIRawEvent(&in);
     in.detail.button = 1L << 8;
@@ -246,7 +244,6 @@ static void test_convert_XIRawEvent(void)
     in.deviceid = ~0 & 0xFF;
     test_XIRawEvent(&in);
 
-    printf("Testing valuator masks\n");
     for (i = 0; i < MAX_VALUATORS; i++)
     {
         XISetMask(in.valuators.mask, i);
@@ -432,7 +429,6 @@ static void test_convert_XIDeviceEvent(void)
 
     memset(&in, 0, sizeof(in));
 
-    printf("Testing simple field values\n");
     in.header = ET_Internal;
     in.type = ET_Motion;
     in.length = sizeof(DeviceEvent);
@@ -456,7 +452,6 @@ static void test_convert_XIDeviceEvent(void)
 
     test_XIDeviceEvent(&in);
 
-    printf("Testing field ranges\n");
     /* 32 bit */
     in.detail.button = 1L;
     test_XIDeviceEvent(&in);
@@ -604,7 +599,6 @@ static void test_convert_XIDeviceEvent(void)
     in.mods.effective = ~0 & 0xFF;
     test_XIDeviceEvent(&in);
 
-    printf("Testing button masks\n");
     for (i = 0; i < sizeof(in.buttons) * 8; i++)
     {
         XISetMask(in.buttons, i);
@@ -618,7 +612,6 @@ static void test_convert_XIDeviceEvent(void)
         test_XIDeviceEvent(&in);
     }
 
-    printf("Testing valuator masks\n");
     for (i = 0; i < MAX_VALUATORS; i++)
     {
         XISetMask(in.valuators.mask, i);
@@ -799,7 +792,6 @@ static void test_convert_XIDeviceChangedEvent(void)
     DeviceChangedEvent in;
     int i;
 
-    printf("Testing simple field values\n");
     memset(&in, 0, sizeof(in));
     in.header = ET_Internal;
     in.type = ET_DeviceChanged;

commit 8080d785b2c1e5791312ed0975efd1b8aea58d98
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Dec 21 11:11:48 2011 +1000

    dix: remove requirement for client_id be the first element
    
    Leftover code from an earlier version of GetTouchEvents.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index b60ddc0..3b40a5b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1738,6 +1738,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
     } touchpoint;
     int need_rawevent = TRUE;
     Bool emulate_pointer = FALSE;
+    int client_id = 0;
 
     if (!dev->enabled || !t || !v)
         return 0;
@@ -1761,6 +1762,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
         }
 
         need_rawevent = FALSE;
+        client_id = touchpoint.dix_ti->client_id;
     } else /* a DDX-submitted touch */
     {
         touchpoint.ti = TouchFindByDDXID(dev, ddx_touchid, (type == XI_TouchBegin));
@@ -1770,6 +1772,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
                     type == XI_TouchBegin ? "begin" : "find", ddx_touchid);
             return 0;
         }
+        client_id = touchpoint.ti->client_id;
     }
 
     if (!(flags & TOUCH_CLIENT_ID))
@@ -1787,7 +1790,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
         raw = &events->raw_event;
         events++;
         num_events++;
-        init_raw(dev, raw, ms, type, touchpoint.ti->client_id);
+        init_raw(dev, raw, ms, type, client_id);
         set_raw_valuators(raw, &mask, raw->valuators.data_raw);
     }
 
@@ -1877,7 +1880,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
     event->root = scr->root->drawable.id;
 
     event_set_root_coordinates(event, screenx, screeny);
-    event->touchid = touchpoint.ti->client_id;
+    event->touchid = client_id;
     event->flags = flags;
 
     if (emulate_pointer)
diff --git a/include/inputstr.h b/include/inputstr.h
index 9881c7e..518e2f4 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -301,7 +301,6 @@ typedef struct _ValuatorClassRec {
 } ValuatorClassRec;
 
 typedef struct _TouchPointInfo {
-    /* client_id must be first element, see GetTouchEvents */
     uint32_t    client_id;          /* touch ID as seen in client events */
     int         sourceid;           /* Source device's ID for this touchpoint */
     Bool        active;             /* whether or not the touch is active */
@@ -328,7 +327,6 @@ typedef struct _TouchPointInfo {
 typedef struct _TouchListener TouchListener;
 
 typedef struct _DDXTouchPointInfo {
-    /* client_id must be first element, see GetTouchEvents */
     uint32_t    client_id;          /* touch ID as seen in client events */
     Bool        active;             /* whether or not the touch is active */
     uint32_t    ddx_id;             /* touch ID given by the DDX */

commit 552de314bf0c8e4de5d002bdd1c12388c2f42283
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Dec 19 14:52:41 2011 +1000

    dix: don't retrieve the syncEvents tail on an empty list
    
    An empty list points to itself but syncEvents has the list head only and is
    of a different format than the elements. Thus, casting it to a QdEventPtr
    gives us garbage.
    
    Segfaults with XTS test case Xlib13/XGrabKeyboard
    
    Introduced in 7af23259d88f4c28ed21140f82cc03b3724c06bb.
    
    Reported-by: Aaron Plattner <aplattner@nvidia.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/events.c b/dix/events.c
index 48cf7a2..d802903 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1116,13 +1116,14 @@ NoticeEventTime(InternalEvent *ev)
 void
 EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
 {
-    QdEventPtr	tail;
+    QdEventPtr	tail = NULL;
     QdEventPtr	qe;
     SpritePtr	pSprite = device->spriteInfo->sprite;
     int		eventlen;
     DeviceEvent *event = &ev->device_event;
 
-    tail = list_last_entry(&syncEvents.pending, QdEventRec, next);
+    if (!list_is_empty(&syncEvents.pending))
+        tail = list_last_entry(&syncEvents.pending, QdEventRec, next);
 
     NoticeTime((InternalEvent*)event);
 

commit 76c11e0872dedcd360cbe02cf62bb9de3b212957
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Dec 16 12:41:08 2011 +1000

    dix: button state must show the logical buttons, not physical buttons
    
    If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
    press, but the state was set for button 1. Fix this, the state must be set
    for that button's logical mapping.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655928
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 50a122f..d279c1d 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -674,7 +674,7 @@ void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
 
     for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
         if (BitIsOn(mouse->button->down, i))
-            SetBit(event->buttons, i);
+            SetBit(event->buttons, mouse->button->map[i]);
 
     if (mouse && mouse->touch && mouse->touch->buttonsDown > 0)
         SetBit(event->buttons, mouse->button->map[1]);

commit 8a32c39c00789c16006de61112627722ce548be1
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Dec 15 07:59:06 2011 +1000

    mi: handle screen switching on pointer emulated touch events
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/mi/mieq.c b/mi/mieq.c
index 5bdf971..6c46eb9 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -514,6 +514,12 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
             if (!handler)
                 mieqMoveToNewScreen(dev, screen, &event->device_event);
             break;
+        case ET_TouchBegin:
+        case ET_TouchUpdate:
+        case ET_TouchEnd:
+            if (!handler && (event->device_event.flags & TOUCH_POINTER_EMULATED))
+                mieqMoveToNewScreen(dev, screen, &event->device_event);
+            break;
         default:
             break;
     }

commit 48547068b115b1f5e5f46a70110454a2175fb9a4
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Dec 15 07:57:47 2011 +1000

    mi: split move to new screen logic to a helper function
    
    No functional changes.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/mi/mieq.c b/mi/mieq.c
index ea8bcf0..5bdf971 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -471,6 +471,19 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
 }
 
 
+static void
+mieqMoveToNewScreen(DeviceIntPtr dev, ScreenPtr screen, DeviceEvent *event)
+{
+    if (dev && screen && screen != DequeueScreen(dev))
+    {
+        int x = 0, y = 0;
+        DequeueScreen(dev) = screen;
+        x = event->root_x;
+        y = event->root_y;
+        NewCurrentScreen (dev, DequeueScreen(dev), x, y);
+    }
+}
+
 /**
  * Post the given @event through the device hierarchy, as appropriate.
  * Use this function if an event must be posted for a given device during the
@@ -482,7 +495,6 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
                        ScreenPtr screen)
 {
     mieqHandler handler;
-    int x = 0, y = 0;
     DeviceIntPtr master;
     InternalEvent mevent; /* master event */
 
@@ -499,12 +511,8 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
         case ET_KeyRelease:
         case ET_ButtonPress:
         case ET_ButtonRelease:
-            if (dev && screen && screen != DequeueScreen(dev) && !handler) {
-                DequeueScreen(dev) = screen;
-                x = event->device_event.root_x;
-                y = event->device_event.root_y;
-                NewCurrentScreen (dev, DequeueScreen(dev), x, y);
-            }
+            if (!handler)
+                mieqMoveToNewScreen(dev, screen, &event->device_event);
             break;
         default:
             break;

commit 3b1e2035cc4740711360c845cfcdff07f7b60558
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Thu Dec 15 07:52:28 2011 +1000

    dix: Remove touch grabs if the grab disappears
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/grabs.c b/dix/grabs.c
index da014df..701470c 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -266,6 +266,9 @@ CreateGrab(
 void
 FreeGrab(GrabPtr pGrab)
 {
+    if (pGrab->grabtype == XI2 && pGrab->type == XI_TouchBegin)
+        TouchListenerGone(pGrab->resource);
+
     free(pGrab->modifiersDetail.pMask);
     free(pGrab->detail.pMask);
 
diff --git a/dix/touch.c b/dix/touch.c
index 9bd07c3..db0bf33 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -37,6 +37,7 @@
 #include "inpututils.h"
 #include "eventconvert.h"
 #include "windowstr.h"
+#include "mi.h"
 
 #define TOUCH_HISTORY_SIZE 100
 
@@ -936,3 +937,46 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
     if (!ti)
         return;
 }
+
+/* As touch grabs don't turn into active grabs with their own resources, we
+ * need to walk all the touches and remove this grab from any delivery
+ * lists. */
+void
+TouchListenerGone(XID resource)
+{
+    TouchPointInfoPtr ti;
+    DeviceIntPtr dev;
+    InternalEvent *events = InitEventList(GetMaximumEventsNum());
+    int i, j, k, nev;
+
+    if (!events)
+        FatalError("TouchListenerGone: couldn't allocate events\n");
+
+    for (dev = inputInfo.devices; dev; dev = dev->next)
+    {
+        if (!dev->touch)
+            continue;
+
+        for (i = 0; i < dev->touch->num_touches; i++)
+        {
+            ti = &dev->touch->touches[i];
+            if (!ti->active)
+                continue;
+
+            for (j = 0; j < ti->num_listeners; j++)
+            {
+                if (ti->listeners[j].listener != resource)
+                    continue;
+
+                nev = GetTouchOwnershipEvents(events, dev, ti, XIRejectTouch,
+                                              resource, 0);
+                for (k = 0; k < nev; k++)
+                    mieqProcessDeviceEvent(dev, events + k, NULL);
+
+                break;
+            }
+        }
+    }
+
+    FreeEventList(events, GetMaximumEventsNum());
+}
diff --git a/include/input.h b/include/input.h
index 4ed9dce..fb45617 100644
--- a/include/input.h
+++ b/include/input.h


Reply to: