xserver: Branch 'master' - 7 commits

Keith Packard keithp at kemper.freedesktop.org
Sun Oct 13 22:03:04 PDT 2013


 dix/events.c                  |   22 ++++++++++------------
 dix/inpututils.c              |   30 +++++++++++++-----------------
 hw/kdrive/ephyr/ephyrdriext.c |    2 +-
 hw/kdrive/ephyr/hostx.c       |    2 ++
 include/input.h               |    6 +++---
 5 files changed, 29 insertions(+), 33 deletions(-)

New commits:
commit 7cf1b595c8c8f9776a39559d2878cf90af3f2859
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Sep 4 15:34:29 2013 +1000

    dix: only deliver for the current grab type
    
    Use the grabtype to determine which type of event to send - all other events
    are pointless and may result in erroneous events being delivered.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 452fc3b..7a1b1c3 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4256,17 +4256,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
 
         sendCore = (IsMaster(thisDev) && thisDev->coreEvents);
         /* try core event */
-        if (sendCore && grab->grabtype == CORE) {
-            deliveries = DeliverOneGrabbedEvent(event, thisDev, CORE);
-        }
-
-        if (!deliveries) {
-            deliveries = DeliverOneGrabbedEvent(event, thisDev, XI2);
-        }
-
-        if (!deliveries) {
-            deliveries = DeliverOneGrabbedEvent(event, thisDev, XI);
-        }
+        if ((sendCore && grab->grabtype == CORE) || grab->grabtype != CORE)
+            deliveries = DeliverOneGrabbedEvent(event, thisDev, grab->grabtype);
 
         if (deliveries && (event->any.type == ET_Motion))
             thisDev->valuator->motionHintWindow = grab->window;
commit 78944d62ffc7fec6f75b6f514ab7a139ba9bc77b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Sep 4 15:34:28 2013 +1000

    dix: don't attempt to deliver an event for a different grabtype
    
    For an active grab, grab->eventMask can be either the core or the XI1 mask.
    With the overlap of event filters, calling DeliverOneGrabbedEvent(XI1) for a
    ProximityOut event will trigger if the client has selected for enter events -
    the filter is the same for both.
    
    Thus, we end up delivering a proximity event to a client not expecting one.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index d63db95..452fc3b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4142,6 +4142,9 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev,
     GrabPtr grab = grabinfo->grab;
     Mask filter;
 
+    if (grab->grabtype != level)
+        return 0;
+
     switch (level) {
     case XI2:
         rc = EventToXI2(event, &xE);
commit 6159811a1aaf848016dbfa7bde68df097027870c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Sep 4 15:34:27 2013 +1000

    include: change grabtypes to start at 1
    
    Avoid erroneous detection of an unset grabtype as CORE
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/include/input.h b/include/input.h
index 1745e9a..350daba 100644
--- a/include/input.h
+++ b/include/input.h
@@ -113,9 +113,9 @@ SOFTWARE.
 #endif
 
 enum InputLevel {
-    CORE,
-    XI,
-    XI2,
+    CORE = 1,
+    XI = 2,
+    XI2 = 3,
 };
 
 typedef unsigned long Leds;
commit be6ea80b79b3d6eb97106ea142e01acbdf059995
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Sep 4 15:34:26 2013 +1000

    dix: only allow button and key events to freeze a sync'd pointer
    
    If a client calls XAllowEvents(SyncPointer) it expects events as normal until
    the next button press or release event - that freezes the device. An e.g.
    proximity event must thus not freeze the pointer.
    
    As per the spec, only button and key events may do so, so narrow it to these
    cases.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 086601a..d63db95 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4268,7 +4268,11 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
         if (deliveries && (event->any.type == ET_Motion))
             thisDev->valuator->motionHintWindow = grab->window;
     }
-    if (deliveries && !deactivateGrab && event->any.type != ET_Motion) {
+    if (deliveries && !deactivateGrab &&
+        (event->any.type == ET_KeyPress ||
+         event->any.type == ET_KeyRelease ||
+         event->any.type == ET_ButtonPress ||
+         event->any.type == ET_ButtonRelease)) {
         switch (grabinfo->sync.state) {
         case FREEZE_BOTH_NEXT_EVENT:
             dev = GetPairedDevice(thisDev);
commit 93a27b2dd0d7ed51120f42456a91a7c59902ebc2
Author: Michele Baldessari <michele at acksyn.org>
Date:   Sun Sep 15 19:30:38 2013 +0100

    Xephyr: restore cursor visibility
    
      Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=69388
    
    Commit c100211034ab69ce453a1644fb61c6808d7e3eda (dix: only show the cursor
    if a window defines one (#58398)) broke the default cursor behaviour in
    Xephyr (unless run with -retro). Restore the default cursor visibility
    so that '-retro' or '-host-cursor' are not needed to have a visible
    cursor.
    
    Signed-off-by: Michele Baldessari <michele at acksyn.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    
    as of ba387cf21f7d95987211f75d8024601e7d64e322 "ephyr: Use host (HW) cursors
    by default." this only applies if -sw-cursor is given on the cmdline.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index d985571..5fa33b9 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -28,6 +28,7 @@
 #endif
 
 #include "hostx.h"
+#include "input.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -436,6 +437,7 @@ hostx_init(void)
     xcb_change_gc(HostX.conn, HostX.gc, XCB_GC_FOREGROUND, &pixel);
 
     if (!hostx_want_host_cursor ()) {
+        CursorVisible = TRUE;
         /* Ditch the cursor, we provide our 'own' */
         cursor_pxm = xcb_generate_id(HostX.conn);
         xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1);
commit 70efc799cbeec26f19831b3b14c0d4646198a077
Author: Michele Baldessari <michele at acksyn.org>
Date:   Sun Sep 15 19:56:34 2013 +0100

    Fix Xephyr compilation when DEBUG is enabled
    
    When DEBUG is enabled Xephyr compilation fails:
    ephyrdriext.c:343:133: error: 'is_ok' undeclared (first use in this
    function)
         EPHYR_LOG("leave. is_ok:%d\n", is_ok);
    
    Just reemove bogus is_ok variable.
    
    Signed-off-by: Michele Baldessari <michele at acksyn.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 13df60a..e2b33db 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -343,7 +343,7 @@ ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y)
     free(rects);
     rects = NULL;
 
-    EPHYR_LOG("leave. is_ok:%d\n", is_ok);
+    EPHYR_LOG("leave.\n");
     /*do cleanup here */
 }
 
commit 5ac4bfca64bd75474e550b26bc1195a5ca245752
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Sep 10 14:18:18 2013 -0400

    input: calloc minimization for xi2mask_new
    
    There's no reason to do this as (nmasks + 2) callocs, and it's a
    surprisingly hot path.  Turns out you hit this ~once per passive grab,
    and you do a few bajillion passive grab changes every time you enter or
    leave the overview in gnome-shell.  According to a callgrind of Xorg
    with gnome-shell-perf-tool run against it:
    
    Ir before: 721437275
    Ir after:  454227086
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Jasper St. Pierre <jstpierre at mecheye.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 9e38e17..a10a7c7 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -960,8 +960,15 @@ XI2Mask *
 xi2mask_new_with_size(size_t nmasks, size_t size)
 {
     int i;
+    int alloc_size;
+    unsigned char *cursor;
+    XI2Mask *mask;
 
-    XI2Mask *mask = calloc(1, sizeof(*mask));
+    alloc_size = sizeof(struct _XI2Mask)
+	       + nmasks * sizeof(unsigned char *)
+	       + nmasks * size;
+
+    mask = calloc(1, alloc_size);
 
     if (!mask)
         return NULL;
@@ -969,20 +976,14 @@ xi2mask_new_with_size(size_t nmasks, size_t size)
     mask->nmasks = nmasks;
     mask->mask_size = size;
 
-    mask->masks = calloc(mask->nmasks, sizeof(*mask->masks));
-    if (!mask->masks)
-        goto unwind;
+    mask->masks = (unsigned char **)(mask + 1);
+    cursor = (unsigned char *)(mask + 1) + nmasks * sizeof(unsigned char *);
 
-    for (i = 0; i < mask->nmasks; i++) {
-        mask->masks[i] = calloc(1, mask->mask_size);
-        if (!mask->masks[i])
-            goto unwind;
+    for (i = 0; i < nmasks; i++) {
+        mask->masks[i] = cursor;
+	cursor += size;
     }
     return mask;
-
- unwind:
-    xi2mask_free(&mask);
-    return NULL;
 }
 
 /**
@@ -1003,14 +1004,9 @@ xi2mask_new(void)
 void
 xi2mask_free(XI2Mask **mask)
 {
-    int i;
-
     if (!(*mask))
         return;
 
-    for (i = 0; (*mask)->masks && i < (*mask)->nmasks; i++)
-        free((*mask)->masks[i]);
-    free((*mask)->masks);
     free((*mask));
     *mask = NULL;
 }


More information about the xorg-commit mailing list