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>
This commit is contained in:
parent
41f3419fee
commit
8a5f3ddb2e
|
@ -525,6 +525,9 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
|
||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!is_surface_from_xwl_window(surface))
|
||||||
|
return;
|
||||||
|
|
||||||
xwl_seat->xwl_screen->serial = serial;
|
xwl_seat->xwl_screen->serial = serial;
|
||||||
xwl_seat->pointer_enter_serial = serial;
|
xwl_seat->pointer_enter_serial = serial;
|
||||||
|
|
||||||
|
@ -867,6 +870,9 @@ pointer_gesture_swipe_handle_begin(void *data,
|
||||||
{
|
{
|
||||||
struct xwl_seat *xwl_seat = data;
|
struct xwl_seat *xwl_seat = data;
|
||||||
|
|
||||||
|
if (surface != NULL && !is_surface_from_xwl_window(surface))
|
||||||
|
return;
|
||||||
|
|
||||||
xwl_seat->pointer_gesture_swipe_fingers = fingers;
|
xwl_seat->pointer_gesture_swipe_fingers = fingers;
|
||||||
QueueGestureSwipeEvents(xwl_seat->pointer_gestures,
|
QueueGestureSwipeEvents(xwl_seat->pointer_gestures,
|
||||||
XI_GestureSwipeBegin, fingers, 0, 0.0, 0.0, 0.0, 0.0);
|
XI_GestureSwipeBegin, fingers, 0, 0.0, 0.0, 0.0, 0.0);
|
||||||
|
@ -926,6 +932,9 @@ pointer_gesture_pinch_handle_begin(void *data,
|
||||||
{
|
{
|
||||||
struct xwl_seat *xwl_seat = 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_fingers = fingers;
|
||||||
xwl_seat->pointer_gesture_pinch_last_scale = 1.0;
|
xwl_seat->pointer_gesture_pinch_last_scale = 1.0;
|
||||||
QueueGesturePinchEvents(xwl_seat->pointer_gestures,
|
QueueGesturePinchEvents(xwl_seat->pointer_gestures,
|
||||||
|
@ -1095,6 +1104,9 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
|
||||||
struct xwl_seat *xwl_seat = data;
|
struct xwl_seat *xwl_seat = data;
|
||||||
uint32_t *k;
|
uint32_t *k;
|
||||||
|
|
||||||
|
if (surface != NULL && !is_surface_from_xwl_window(surface))
|
||||||
|
return;
|
||||||
|
|
||||||
xwl_seat->xwl_screen->serial = serial;
|
xwl_seat->xwl_screen->serial = serial;
|
||||||
xwl_seat->keyboard_focus = surface;
|
xwl_seat->keyboard_focus = surface;
|
||||||
|
|
||||||
|
@ -1112,6 +1124,9 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
|
||||||
struct xwl_seat *xwl_seat = data;
|
struct xwl_seat *xwl_seat = data;
|
||||||
uint32_t *k;
|
uint32_t *k;
|
||||||
|
|
||||||
|
if (surface != NULL && !is_surface_from_xwl_window(surface))
|
||||||
|
return;
|
||||||
|
|
||||||
xwl_seat->xwl_screen->serial = serial;
|
xwl_seat->xwl_screen->serial = serial;
|
||||||
|
|
||||||
wl_array_for_each(k, &xwl_seat->keys)
|
wl_array_for_each(k, &xwl_seat->keys)
|
||||||
|
@ -1314,6 +1329,9 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
|
||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!is_surface_from_xwl_window(surface))
|
||||||
|
return;
|
||||||
|
|
||||||
xwl_touch = calloc(1, sizeof *xwl_touch);
|
xwl_touch = calloc(1, sizeof *xwl_touch);
|
||||||
if (xwl_touch == NULL) {
|
if (xwl_touch == NULL) {
|
||||||
ErrorF("%s: ENOMEM\n", __func__);
|
ErrorF("%s: ENOMEM\n", __func__);
|
||||||
|
@ -1997,6 +2015,9 @@ tablet_tool_proximity_in(void *data, struct zwp_tablet_tool_v2 *tool,
|
||||||
if (wl_surface == NULL)
|
if (wl_surface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!is_surface_from_xwl_window(wl_surface))
|
||||||
|
return;
|
||||||
|
|
||||||
xwl_tablet_tool->proximity_in_serial = serial;
|
xwl_tablet_tool->proximity_in_serial = serial;
|
||||||
xwl_seat->tablet_focus_window = wl_surface_get_user_data(wl_surface);
|
xwl_seat->tablet_focus_window = wl_surface_get_user_data(wl_surface);
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
static DevPrivateKeyRec xwl_window_private_key;
|
static DevPrivateKeyRec xwl_window_private_key;
|
||||||
static DevPrivateKeyRec xwl_damage_private_key;
|
static DevPrivateKeyRec xwl_damage_private_key;
|
||||||
|
static const char *xwl_surface_tag = "xwl-surface";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
|
xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
|
||||||
|
@ -112,6 +113,18 @@ xwl_window_from_window(WindowPtr window)
|
||||||
return NULL;
|
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
|
void
|
||||||
xwl_window_update_property(struct xwl_window *xwl_window,
|
xwl_window_update_property(struct xwl_window *xwl_window,
|
||||||
PropertyStateRec *propstate)
|
PropertyStateRec *propstate)
|
||||||
|
@ -672,6 +685,7 @@ ensure_surface_for_window(WindowPtr window)
|
||||||
send_surface_id_event(xwl_window);
|
send_surface_id_event(xwl_window);
|
||||||
|
|
||||||
wl_surface_set_user_data(xwl_window->surface, xwl_window);
|
wl_surface_set_user_data(xwl_window->surface, xwl_window);
|
||||||
|
xwl_window_set_xwayland_tag(xwl_window);
|
||||||
|
|
||||||
compRedirectWindow(serverClient, window, CompositeRedirectManual);
|
compRedirectWindow(serverClient, window, CompositeRedirectManual);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ struct xwl_window {
|
||||||
struct xwl_window *xwl_window_get(WindowPtr window);
|
struct xwl_window *xwl_window_get(WindowPtr window);
|
||||||
struct xwl_window *xwl_window_from_window(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,
|
void xwl_window_update_property(struct xwl_window *xwl_window,
|
||||||
PropertyStateRec *propstate);
|
PropertyStateRec *propstate);
|
||||||
Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
|
Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
|
||||||
|
|
Loading…
Reference in New Issue