diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2022-05-04 14:25:29 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2022-10-19 11:29:36 +0200 |
commit | f883f6bc6ed5eb8112406da3225d306a30829bdc (patch) | |
tree | 128549c040d470732941ae19e05f21f16fceaca6 | |
parent | aff0a4fb583498dbe7b2e56ee2f9fc55b7e43749 (diff) |
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@gmail.com>)
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 8a5f3ddb2e4232cbf47bdce25d4b4a929e80e2c9)
-rw-r--r-- | hw/xwayland/xwayland-input.c | 21 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window.c | 14 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window.h | 2 |
3 files changed, 37 insertions, 0 deletions
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); |