xserver: Branch 'master' - 7 commits

Peter Hutterer whot at kemper.freedesktop.org
Wed Jun 7 05:13:30 UTC 2017


 Xi/xiwarppointer.c            |    4 ++++
 dix/events.c                  |    2 +-
 hw/xwayland/xwayland-input.c  |   29 ++++++++++++++++++++++++++++-
 hw/xwayland/xwayland-output.c |    3 +++
 hw/xwayland/xwayland.c        |   33 ++++++++++++++++++++++++++++++++-
 hw/xwayland/xwayland.h        |    2 --
 6 files changed, 68 insertions(+), 5 deletions(-)

New commits:
commit d5e2f271ad93e50412ff3605fb25cb9622f437e0
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Sun May 28 15:56:22 2017 +0200

    xwayland: Remove two unused proc pointers.
    
    Xwayland doesn't override these, so we don't need defining those
    in the xwl_screen struct.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.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/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index b37e73b94..a05e0862c 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -62,8 +62,6 @@ struct xwl_screen {
 
     CreateScreenResourcesProcPtr CreateScreenResources;
     CloseScreenProcPtr CloseScreen;
-    CreateWindowProcPtr CreateWindow;
-    DestroyWindowProcPtr DestroyWindow;
     RealizeWindowProcPtr RealizeWindow;
     UnrealizeWindowProcPtr UnrealizeWindow;
     XYToWindowProcPtr XYToWindow;
commit 95febc42cadf392a888104ad6d5cf4f34fdde7d5
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Sun May 28 15:56:21 2017 +0200

    Xi: Use WarpPointerProc hook on XI pointer warping implementation
    
    Just like we do with XWarpPointer's.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.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/Xi/xiwarppointer.c b/Xi/xiwarppointer.c
index 9c2aa3318..955fdb965 100644
--- a/Xi/xiwarppointer.c
+++ b/Xi/xiwarppointer.c
@@ -186,6 +186,10 @@ ProcXIWarpPointer(ClientPtr client)
     pDev->last.valuators[1] = y;
     miPointerUpdateSprite(pDev);
 
+    if (*newScreen->CursorWarpedTo)
+        (*newScreen->CursorWarpedTo) (pDev, newScreen, client,
+                                      dest, pSprite, x, y);
+
     /* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it
        here though. */
     return Success;
commit ca17f3e9fd3b59fdc5ffd0e5d78e4db6ddc87aa1
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Sun May 28 15:56:20 2017 +0200

    xwayland: Lock the pointer if it is confined and has no cursor
    
    In the typical pattern in games of "hide cursor, grab with a confineTo,
    warp constantly the pointer to the middle of the window" the last warping
    step is actually rather optional. Some games may choose to just set up a
    grab with confineTo argument, and trust that they'll get correct relative
    X/Y axis values despite the hidden cursor hitting the confinement window
    edge.
    
    To cater for these cases, lock the pointer whenever there is a pointer
    confinement and the cursor is hidden. This ensures the pointer position
    is in sync with the compositor's when it's next shown again, and more
    importantly resorts to the relative pointer for event delivery.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.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/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 557aac8ed..02fdf6eef 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -2615,11 +2615,35 @@ xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat,
                                    x, y);
 }
 
+static Bool
+xwl_seat_maybe_lock_on_hidden_cursor(struct xwl_seat *xwl_seat)
+{
+    /* Some clients use hidden cursor+confineTo+relative motion
+     * to implement infinite panning (eg. 3D views), lock the
+     * pointer for so the relative pointer is used.
+     */
+    if (xwl_seat->x_cursor ||
+        !xwl_seat->cursor_confinement_window)
+        return FALSE;
+
+    if (xwl_seat->confined_pointer)
+        xwl_seat_destroy_confined_pointer(xwl_seat);
+
+    xwl_seat_create_pointer_warp_emulator(xwl_seat);
+    xwl_pointer_warp_emulator_lock(xwl_seat->pointer_warp_emulator);
+    return TRUE;
+}
+
 void
 xwl_seat_cursor_visibility_changed(struct xwl_seat *xwl_seat)
 {
-    if (xwl_seat->pointer_warp_emulator && xwl_seat->x_cursor != NULL)
+    if (xwl_seat->pointer_warp_emulator && xwl_seat->x_cursor != NULL) {
         xwl_seat_destroy_pointer_warp_emulator(xwl_seat);
+    } else if (!xwl_seat->x_cursor && xwl_seat->cursor_confinement_window) {
+        /* If the cursor goes hidden as is confined, lock it for
+         * relative motion to work. */
+        xwl_seat_maybe_lock_on_hidden_cursor(xwl_seat);
+    }
 }
 
 void
@@ -2658,6 +2682,9 @@ xwl_seat_confine_pointer(struct xwl_seat *xwl_seat,
     if (xwl_seat->pointer_warp_emulator)
         return;
 
+    if (xwl_seat_maybe_lock_on_hidden_cursor(xwl_seat))
+        return;
+
     xwl_seat->confined_pointer =
         zwp_pointer_constraints_v1_confine_pointer(pointer_constraints,
                                                    xwl_window->surface,
commit 513e3bd3870fdb8a8e0e2e52c0fa93872300bc8b
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Sun May 28 15:56:19 2017 +0200

    xwayland: Update root window size when desktop size changes
    
    This fixes grabs on InputOnly windows whose parent is the root window
    failing with GrabNotViewable. This is due to window->borderSize/windowSize
    being computed as clipped by its parent, resulting in a null region.
    
    Setting up the right size on the root window makes the InputOnly size
    correct too, so the GrabNotViewable paths aren't hit anymore.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index bfaf9795a..460caaf56 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -188,8 +188,11 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
     SetRootClip(xwl_screen->screen, xwl_screen->root_clip_mode);
 
     if (xwl_screen->screen->root) {
+        BoxRec box = { 0, 0, width, height };
+
         xwl_screen->screen->root->drawable.width = width;
         xwl_screen->screen->root->drawable.height = height;
+        RegionReset(&xwl_screen->screen->root->winSize, &box);
         RRScreenSizeNotify(xwl_screen->screen);
     }
 
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 993837f78..551443f93 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -443,9 +443,11 @@ xwl_realize_window(WindowPtr window)
     screen->RealizeWindow = xwl_realize_window;
 
     if (xwl_screen->rootless && !window->parent) {
+        BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height };
+
+        RegionReset(&window->winSize, &box);
         RegionNull(&window->clipList);
         RegionNull(&window->borderClip);
-        RegionNull(&window->winSize);
     }
 
     if (xwl_screen->rootless) {
commit fafdb0cc9697eb53635ed1e78bec1d4cd87ab3a2
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Sun May 28 15:56:18 2017 +0200

    xwayland: "Accept" confineTo on InputOnly windows
    
    Of sorts, actually make it confine to the pointer focus, as the
    InputOnly window is entirely invisible to xwayland accounting,
    we don't have a xwl_window for it.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.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/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 65bcb7042..993837f78 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -318,6 +318,15 @@ xwl_cursor_confined_to(DeviceIntPtr device,
     }
 
     xwl_window = xwl_window_from_window(window);
+    if (!xwl_window && xwl_seat->focus_window) {
+        /* Allow confining on InputOnly windows, but only if the geometry
+         * is the same than the focus window.
+         */
+        if (window->drawable.class == InputOnly) {
+            DebugF("Confine on InputOnly window, assuming pointer focus\n");
+            xwl_window = xwl_seat->focus_window;
+        }
+    }
     if (!xwl_window)
         return;
 
commit c217fcb4c4640ffd2fefee63c6fcd7ea5e64b942
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Sun May 28 15:56:17 2017 +0200

    xwayland: Allow pointer warp on root/None window
    
    Of sorts, as we can't honor pointer warping across the whole root window
    coordinates, peek the pointer focus in these cases.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.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/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index cc638ffd4..65bcb7042 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -269,11 +269,31 @@ xwl_cursor_warped_to(DeviceIntPtr device,
     struct xwl_screen *xwl_screen = xwl_screen_get(screen);
     struct xwl_seat *xwl_seat = device->public.devicePrivate;
     struct xwl_window *xwl_window;
+    WindowPtr focus;
 
     if (!xwl_seat)
         xwl_seat = xwl_screen_get_default_seat(xwl_screen);
 
     xwl_window = xwl_window_from_window(window);
+    if (!xwl_window && xwl_seat->focus_window) {
+        focus = xwl_seat->focus_window->window;
+
+        /* Warps on non wl_surface backed Windows are only allowed
+         * as long as the pointer stays within the focus window.
+         */
+        if (x >= focus->drawable.x &&
+            y >= focus->drawable.y &&
+            x < focus->drawable.x + focus->drawable.width &&
+            y < focus->drawable.y + focus->drawable.height) {
+            if (!window) {
+                DebugF("Warp relative to pointer, assuming pointer focus\n");
+                xwl_window = xwl_seat->focus_window;
+            } else if (window == screen->root) {
+                DebugF("Warp on root window, assuming pointer focus\n");
+                xwl_window = xwl_seat->focus_window;
+            }
+        }
+    }
     if (!xwl_window)
         return;
 
commit f065721e6fa6e9057cca4eadaf145a4dc22a08d2
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Sun May 28 15:56:16 2017 +0200

    dix: assume warping on the RootWindow always happens on visible coords
    
    If the root window borderClip region is null, the PointInWindowIsVisible()
    check fails if pointer warping is attempted on the root window, making
    the warping operation bail out early.
    
    Assume coordinates always lay inside the root window for this case,
    the actual position will be clamped later within screen coordinates anyway.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index cc26ba5db..3e3a01ef9 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3575,7 +3575,7 @@ ProcWarpPointer(ClientPtr client)
              winX + stuff->srcX + (int) stuff->srcWidth < x) ||
             (stuff->srcHeight != 0 &&
              winY + stuff->srcY + (int) stuff->srcHeight < y) ||
-            !PointInWindowIsVisible(source, x, y))
+            (source->parent && !PointInWindowIsVisible(source, x, y)))
             return Success;
     }
     if (dest) {


More information about the xorg-commit mailing list