xserver: Branch 'xwayland-22.1' - 4 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Oct 20 06:55:20 UTC 2022
hw/xwayland/xwayland-input.c | 21 +++++++++++++++++++++
hw/xwayland/xwayland-screen.c | 2 +-
hw/xwayland/xwayland-window.c | 30 +++++++++++++++++++++++++++---
hw/xwayland/xwayland-window.h | 2 ++
meson.build | 2 +-
5 files changed, 52 insertions(+), 5 deletions(-)
New commits:
commit 71e8be4e3645bd9664b3f7a9f4d958272d604de4
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Mon Oct 17 16:39:30 2022 +0200
xwayland: Clear the "xwl-window" tag on unrealize
Now that we keep the Wayland surface around for longer than the
xwl_window, we might get events for that surface after the X11 window
is unrealized.
Make sure we untag the Wayland surface when the Wayland surface is
delayed, to break the wl_surface/xwl_window relationship, so that events
for that surface are discarded by Xwayland.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
Fixes: e37f18ee9 - xwayland: Delay wl_surface destruction
(cherry picked from commit a1d14aa8c5afbae2f99aa68454d429aed5852b72)
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 0b18be64c..38992d5c1 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -121,6 +121,12 @@ xwl_window_set_xwayland_tag(struct xwl_window *xwl_window)
wl_proxy_set_tag((struct wl_proxy *)xwl_window->surface, &xwl_surface_tag);
}
+static void
+xwl_window_clear_xwayland_tag(struct xwl_window *xwl_window)
+{
+ wl_proxy_set_tag((struct wl_proxy *)xwl_window->surface, NULL);
+}
+
Bool
is_surface_from_xwl_window(struct wl_surface *surface)
{
@@ -618,9 +624,13 @@ release_wl_surface_for_window(struct xwl_window *xwl_window)
return;
}
- /* Otherwise, schedule the destruction later, to mitigate the race
- * between X11 and Wayland processing so that the compositor has the
- * time to establish the association before the wl_surface is destroyed.
+ /* Break the wl_surface / xwl_window relationship */
+ wl_surface_set_user_data(xwl_window->surface, NULL);
+ xwl_window_clear_xwayland_tag(xwl_window);
+
+ /* Schedule the destruction later, to mitigate the race between X11
+ * and Wayland processing so that the compositor has the time to
+ * establish the association before the wl_surface is destroyed.
*/
xwl_wl_surface = xnfcalloc(1, sizeof *xwl_wl_surface);
xwl_wl_surface->wl_surface = xwl_window->surface;
commit f883f6bc6ed5eb8112406da3225d306a30829bdc
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed May 4 14:25:29 2022 +0200
xwayland: set tag on our surfaces
That allows to differentiate Xwayland's own surfaces from others.
This is preparation work for optional libdecor support.
v2: Check for surface not being NULL (Jonas Ådahl <jadahl at gmail.com>)
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
(cherry picked from commit 8a5f3ddb2e4232cbf47bdce25d4b4a929e80e2c9)
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index e1bacb9fc..aa08586bc 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -467,6 +467,9 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
if (surface == NULL)
return;
+ if (!is_surface_from_xwl_window(surface))
+ return;
+
xwl_seat->xwl_screen->serial = serial;
xwl_seat->pointer_enter_serial = serial;
@@ -834,6 +837,9 @@ pointer_gesture_swipe_handle_begin(void *data,
{
struct xwl_seat *xwl_seat = data;
+ if (surface != NULL && !is_surface_from_xwl_window(surface))
+ return;
+
xwl_seat->pointer_gesture_swipe_fingers = fingers;
QueueGestureSwipeEvents(xwl_seat->pointer_gestures,
XI_GestureSwipeBegin, fingers, 0, 0.0, 0.0, 0.0, 0.0);
@@ -893,6 +899,9 @@ pointer_gesture_pinch_handle_begin(void *data,
{
struct xwl_seat *xwl_seat = data;
+ if (surface != NULL && !is_surface_from_xwl_window(surface))
+ return;
+
xwl_seat->pointer_gesture_pinch_fingers = fingers;
xwl_seat->pointer_gesture_pinch_last_scale = 1.0;
QueueGesturePinchEvents(xwl_seat->pointer_gestures,
@@ -1026,6 +1035,9 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
struct xwl_seat *xwl_seat = data;
uint32_t *k;
+ if (surface != NULL && !is_surface_from_xwl_window(surface))
+ return;
+
xwl_seat->xwl_screen->serial = serial;
xwl_seat->keyboard_focus = surface;
@@ -1041,6 +1053,9 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
struct xwl_seat *xwl_seat = data;
uint32_t *k;
+ if (surface != NULL && !is_surface_from_xwl_window(surface))
+ return;
+
xwl_seat->xwl_screen->serial = serial;
wl_array_for_each(k, &xwl_seat->keys)
@@ -1241,6 +1256,9 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
if (surface == NULL)
return;
+ if (!is_surface_from_xwl_window(surface))
+ return;
+
xwl_touch = calloc(1, sizeof *xwl_touch);
if (xwl_touch == NULL) {
ErrorF("%s: ENOMEM\n", __func__);
@@ -1917,6 +1935,9 @@ tablet_tool_proximity_in(void *data, struct zwp_tablet_tool_v2 *tool,
if (wl_surface == NULL)
return;
+ if (!is_surface_from_xwl_window(wl_surface))
+ return;
+
xwl_tablet_tool->proximity_in_serial = serial;
xwl_seat->tablet_focus_window = wl_surface_get_user_data(wl_surface);
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index a5c1e2aef..0b18be64c 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -50,6 +50,7 @@
static DevPrivateKeyRec xwl_window_private_key;
static DevPrivateKeyRec xwl_damage_private_key;
+static const char *xwl_surface_tag = "xwl-surface";
static void
xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
@@ -114,6 +115,18 @@ xwl_window_from_window(WindowPtr window)
return NULL;
}
+static void
+xwl_window_set_xwayland_tag(struct xwl_window *xwl_window)
+{
+ wl_proxy_set_tag((struct wl_proxy *)xwl_window->surface, &xwl_surface_tag);
+}
+
+Bool
+is_surface_from_xwl_window(struct wl_surface *surface)
+{
+ return wl_proxy_get_tag((struct wl_proxy *) surface) == &xwl_surface_tag;
+}
+
void
xwl_window_update_property(struct xwl_window *xwl_window,
PropertyStateRec *propstate)
@@ -482,6 +495,7 @@ ensure_surface_for_window(WindowPtr window)
send_surface_id_event(xwl_window);
wl_surface_set_user_data(xwl_window->surface, xwl_window);
+ xwl_window_set_xwayland_tag(xwl_window);
compRedirectWindow(serverClient, window, CompositeRedirectManual);
diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h
index fbe76784d..6245e47b5 100644
--- a/hw/xwayland/xwayland-window.h
+++ b/hw/xwayland/xwayland-window.h
@@ -66,6 +66,8 @@ struct xwl_window {
struct xwl_window *xwl_window_get(WindowPtr window);
struct xwl_window *xwl_window_from_window(WindowPtr window);
+Bool is_surface_from_xwl_window(struct wl_surface *surface);
+
void xwl_window_update_property(struct xwl_window *xwl_window,
PropertyStateRec *propstate);
Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
commit aff0a4fb583498dbe7b2e56ee2f9fc55b7e43749
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Oct 18 11:12:59 2022 +0200
build: Bump wayland requirement to 1.18
Xwayland uses API such as wl_proxy_set_tag()/wl_proxy_get_tag() which
appeared in Wayland 1.18, but the build system still requires Wayland
1.5 at least.
Bump the Wayland version to match the requirements.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
(cherry picked from commit 395c25f18520a6d2e3895f59b9e2feaf97ff7635)
diff --git a/meson.build b/meson.build
index 23290bb86..27a3f1f7d 100644
--- a/meson.build
+++ b/meson.build
@@ -63,7 +63,7 @@ add_project_arguments(common_wflags, language : ['c', 'objc'])
libdrm_req = '>= 2.4.89'
libselinux_req = '>= 2.0.86'
xext_req = '>= 1.0.99.4'
-wayland_req = '>= 1.5.0'
+wayland_req = '>= 1.18.0'
wayland_protocols_req = '>= 1.22'
gbm_req = '>= 10.2'
commit cf29f7d4c382f77ad1ab0d65ca2e72ca95dd8f21
Author: Demi Marie Obenour <demiobenour at gmail.com>
Date: Sat Oct 8 15:39:39 2022 -0400
Forbid server grabs by non-WM on *rootless* XWayland
a77d95af61c09c91927d1aa4b9860b728b357cdb intended to do this, but the
check for “is this rootless or rootful XWayland” was inverted.
Fixes: a77d95af61c0 ("xwayland: Prevent Xserver grabs with rootless")
Signed-off-by: Demi Marie Obenour <demiobenour at gmail.com>
Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>
(cherry picked from commit cb33e0d27892b885b0d86b5f99af2b71f660de56)
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 752f9353a..812d60dfc 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -622,7 +622,7 @@ static void
xwl_screen_setup_custom_vector(struct xwl_screen *xwl_screen)
{
/* Rootfull Xwayland does not need a custom ProcVector (yet?) */
- if (xwl_screen->rootless)
+ if (!xwl_screen->rootless)
return;
xwl_screen->GrabServer = ProcVector[X_GrabServer];
More information about the xorg-commit
mailing list