xserver: Branch 'server-1.9-branch' - 4 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Wed Dec 15 12:13:17 PST 2010


 Xi/exevents.c |    6 +++-
 mi/mieq.c     |    8 +++++-
 test/input.c  |   74 ++++++++++++++++++++++++++++++++++++++++++++--------------
 3 files changed, 68 insertions(+), 20 deletions(-)

New commits:
commit a2c674b75d3b1a663bece6f6e2e34c3e71e6be55
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 5 11:08:27 2010 +1000

    test: reduce range of byte-padding macro tests.
    
    Byte padding and conversion is interesting for the rage of 0-8 bytes, and
    then interesting towards the end of the valid range (INT_MAX - 7 and INT_MAX
    - 3).
    
    Note: this changes the upper range for pad_to_int32() and bytes_to_int32()
    from the previous (INT_MAX - 4) to (INT_MAX - 3).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit d435e1ecb86e2fe6292b5945262956644f979bbb)

diff --git a/test/input.c b/test/input.c
index 5f03471..d1c4dd9 100644
--- a/test/input.c
+++ b/test/input.c
@@ -682,45 +682,82 @@ static void dix_grab_matching(void)
     g_assert(rc == TRUE);
 }
 
-static void include_byte_padding_macros(void)
+static void test_bits_to_byte(int i)
 {
-    int i;
-    g_test_message("Testing bits_to_bytes()");
-
-    /* the macros don't provide overflow protection */
-    for (i = 0; i < INT_MAX - 7; i++)
-    {
         int expected_bytes;
         expected_bytes = (i + 7)/8;
 
         g_assert(bits_to_bytes(i) >= i/8);
         g_assert((bits_to_bytes(i) * 8) - i <= 7);
         g_assert(expected_bytes == bits_to_bytes(i));
-    }
+}
 
-    g_test_message("Testing bytes_to_int32()");
-    for (i = 0; i < INT_MAX - 3; i++)
-    {
+static void test_bytes_to_int32(int i)
+{
         int expected_4byte;
         expected_4byte = (i + 3)/4;
 
         g_assert(bytes_to_int32(i) <= i);
         g_assert((bytes_to_int32(i) * 4) - i <= 3);
         g_assert(expected_4byte == bytes_to_int32(i));
-    }
-
-    g_test_message("Testing pad_to_int32");
+}
 
-    for (i = 0; i < INT_MAX - 3; i++)
-    {
+static void test_pad_to_int32(int i)
+{
         int expected_bytes;
         expected_bytes = ((i + 3)/4) * 4;
 
         g_assert(pad_to_int32(i) >= i);
         g_assert(pad_to_int32(i) - i <= 3);
         g_assert(expected_bytes == pad_to_int32(i));
-    }
+}
+static void include_byte_padding_macros(void)
+{
+    g_test_message("Testing bits_to_bytes()");
+
+    /* the macros don't provide overflow protection */
+    test_bits_to_byte(0);
+    test_bits_to_byte(1);
+    test_bits_to_byte(2);
+    test_bits_to_byte(7);
+    test_bits_to_byte(8);
+    test_bits_to_byte(0xFF);
+    test_bits_to_byte(0x100);
+    test_bits_to_byte(INT_MAX - 9);
+    test_bits_to_byte(INT_MAX - 8);
+
+    g_test_message("Testing bytes_to_int32()");
+
+    test_bytes_to_int32(0);
+    test_bytes_to_int32(1);
+    test_bytes_to_int32(2);
+    test_bytes_to_int32(7);
+    test_bytes_to_int32(8);
+    test_bytes_to_int32(0xFF);
+    test_bytes_to_int32(0x100);
+    test_bytes_to_int32(0xFFFF);
+    test_bytes_to_int32(0x10000);
+    test_bytes_to_int32(0xFFFFFF);
+    test_bytes_to_int32(0x1000000);
+    test_bytes_to_int32(INT_MAX - 4);
+    test_bytes_to_int32(INT_MAX - 3);
+
+    g_test_message("Testing pad_to_int32");
 
+    test_pad_to_int32(0);
+    test_pad_to_int32(0);
+    test_pad_to_int32(1);
+    test_pad_to_int32(2);
+    test_pad_to_int32(7);
+    test_pad_to_int32(8);
+    test_pad_to_int32(0xFF);
+    test_pad_to_int32(0x100);
+    test_pad_to_int32(0xFFFF);
+    test_pad_to_int32(0x10000);
+    test_pad_to_int32(0xFFFFFF);
+    test_pad_to_int32(0x1000000);
+    test_pad_to_int32(INT_MAX - 4);
+    test_pad_to_int32(INT_MAX - 3);
 }
 
 static void xi_unregister_handlers(void)
commit 8d0866559dd418389b018f1e48c6f8605e6ebc8d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 5 10:59:52 2010 +1000

    test: compare byte padding macros against the expected bytes.
    
    We calculate the expected bytes for each value, let's use it.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit f49ee9074a66883a3c525b0d6e71589123288465)

diff --git a/test/input.c b/test/input.c
index f08e13b..5f03471 100644
--- a/test/input.c
+++ b/test/input.c
@@ -695,6 +695,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bits_to_bytes(i) >= i/8);
         g_assert((bits_to_bytes(i) * 8) - i <= 7);
+        g_assert(expected_bytes == bits_to_bytes(i));
     }
 
     g_test_message("Testing bytes_to_int32()");
@@ -705,6 +706,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bytes_to_int32(i) <= i);
         g_assert((bytes_to_int32(i) * 4) - i <= 3);
+        g_assert(expected_4byte == bytes_to_int32(i));
     }
 
     g_test_message("Testing pad_to_int32");
@@ -716,6 +718,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(pad_to_int32(i) >= i);
         g_assert(pad_to_int32(i) - i <= 3);
+        g_assert(expected_bytes == pad_to_int32(i));
     }
 
 }
commit 97f40a17afc197342b5aea92d870dd4099ac6b44
Author: Eoghan Sherry <ejsherry at gmail.com>
Date:   Sun Nov 28 16:15:51 2010 -0500

    Xi: Fix master button update when slave buttons are mapped. #24887
    
    It is currently assumed that an event button delieved to a master device
    corresponds to the slave button states. However, the event button is a
    logical (mapped) slave button and slave button states correspond to
    physical (unmapped) slave buttons. This leads to incorrect update of the
    master button state and incorrect events devlivered to clients. Fix the
    situation by taking the slave button map into account when querying a
    slave button state.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=24887
    
    Signed-off-by: Eoghan Sherry <ejsherry at gmail.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 36b614dedf4ddc428e43ad1542d4f9314f73f60a)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index e19e207..6d88151 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -878,8 +878,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
                     continue;
                 if (!sd->button)
                     continue;
-                if (button_is_down(sd, key, BUTTON_PROCESSED))
-                    return DONT_PROCESS;
+                for (i = 1; i <= sd->button->numButtons; i++)
+                    if (sd->button->map[i] == key &&
+                        button_is_down(sd, i, BUTTON_PROCESSED))
+                        return DONT_PROCESS;
             }
         }
         set_button_up(device, key, BUTTON_PROCESSED);
commit faecab3b13bbaecf4f35f49b833d1b79a5fb647d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Sep 3 11:54:41 2010 +1000

    mi: handle DGA subtypes when determining the master device.
    
    The subtype in the DGA event is the core type and all ET_ event types (where
    applicable) are identical to the core types. Thus the switch statement below
    will work as required and assign the right master device.
    
    Fixes a crasher bug on keyboard devices with valuators. If a device sends a
    motion event while grabbed and a DGA client is active (but has not selected
    input through DGA), the valuator event is posted through the VCK and
    eventually results in a NULL-pointer dereference on dev->valuator.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 31ab9f8860848504df18a8be9d19b817b191e0df)

diff --git a/mi/mieq.c b/mi/mieq.c
index d1441e2..01da52a 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -320,6 +320,7 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
 {
     DeviceIntPtr mdev;
     int len = original->any.length;
+    int type = original->any.type;
 
     CHECKEVENT(original);
 
@@ -327,7 +328,12 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
     if (!sdev || !sdev->u.master)
         return NULL;
 
-    switch(original->any.type)
+#if XFreeXDGA
+    if (type == ET_DGAEvent)
+        type = original->dga_event.subtype;
+#endif
+
+    switch(type)
     {
         case ET_KeyPress:
         case ET_KeyRelease:


More information about the xorg-commit mailing list