mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
seat: simplify touch grabs
This commit is contained in:
parent
65b97d6e8a
commit
4d9ea9919f
8 changed files with 92 additions and 118 deletions
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
extern const struct wlr_pointer_grab default_pointer_grab;
|
||||
extern const struct wlr_keyboard_grab default_keyboard_grab;
|
||||
|
||||
extern const struct wlr_touch_grab_interface default_touch_grab_impl;
|
||||
extern const struct wlr_touch_grab default_touch_grab;
|
||||
|
||||
void seat_client_create_pointer(struct wlr_seat_client *seat_client,
|
||||
uint32_t version, uint32_t id);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ enum wlr_drag_grab_type {
|
|||
|
||||
struct wlr_drag {
|
||||
enum wlr_drag_grab_type grab_type;
|
||||
struct wlr_seat_touch_grab touch_grab;
|
||||
|
||||
struct wlr_seat *seat;
|
||||
struct wlr_seat_client *seat_client;
|
||||
|
|
|
|||
|
|
@ -115,31 +115,20 @@ struct wlr_keyboard_grab {
|
|||
|
||||
struct wlr_seat_touch_grab;
|
||||
|
||||
struct wlr_touch_grab_interface {
|
||||
uint32_t (*down)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*up)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*motion)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*enter)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*frame)(struct wlr_seat_touch_grab *grab);
|
||||
struct wlr_touch_grab {
|
||||
uint32_t (*down)(void *data, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*up)(void *data, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*motion)(void *data, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*enter)(void *data, uint32_t time_msec,
|
||||
struct wlr_touch_point *point);
|
||||
void (*frame)(void *data);
|
||||
// Cancel grab
|
||||
void (*cancel)(struct wlr_seat_touch_grab *grab);
|
||||
void (*cancel)(void *data);
|
||||
// Send wl_touch::cancel
|
||||
void (*wl_cancel)(struct wlr_seat_touch_grab *grab,
|
||||
struct wlr_surface *surface);
|
||||
};
|
||||
|
||||
/**
|
||||
* Passed to wlr_seat_touch_start_grab() to start a grab of the touch device.
|
||||
* The grabber is responsible for handling touch events for the seat.
|
||||
*/
|
||||
struct wlr_seat_touch_grab {
|
||||
const struct wlr_touch_grab_interface *interface;
|
||||
struct wlr_seat *seat;
|
||||
void *data;
|
||||
void (*wl_cancel)(void *data, struct wlr_surface *surface);
|
||||
};
|
||||
|
||||
#define WLR_POINTER_BUTTONS_CAP 16
|
||||
|
|
@ -198,8 +187,8 @@ struct wlr_seat_touch_state {
|
|||
uint32_t grab_serial;
|
||||
uint32_t grab_id;
|
||||
|
||||
struct wlr_seat_touch_grab *grab;
|
||||
struct wlr_seat_touch_grab *default_grab;
|
||||
const struct wlr_touch_grab *grab;
|
||||
void *grab_data;
|
||||
};
|
||||
|
||||
struct wlr_primary_selection_source;
|
||||
|
|
@ -654,7 +643,7 @@ int wlr_seat_touch_num_points(struct wlr_seat *seat);
|
|||
* handling all touch events until the grab ends.
|
||||
*/
|
||||
void wlr_seat_touch_start_grab(struct wlr_seat *wlr_seat,
|
||||
struct wlr_seat_touch_grab *grab);
|
||||
const struct wlr_touch_grab *grab, void *data);
|
||||
|
||||
/**
|
||||
* End the grab of the touch device of this seat. This reverts the grab back to
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ struct wlr_xdg_popup {
|
|||
// each seat gets a popup grab
|
||||
struct wlr_xdg_popup_grab {
|
||||
struct wl_client *client;
|
||||
struct wlr_seat_touch_grab touch_grab;
|
||||
struct wlr_seat *seat;
|
||||
struct wl_list popups;
|
||||
struct wl_list link; // wlr_xdg_shell.popup_grabs
|
||||
|
|
|
|||
|
|
@ -256,15 +256,15 @@ static const struct wlr_pointer_grab drag_pointer_grab = {
|
|||
.cancel = drag_handle_pointer_cancel,
|
||||
};
|
||||
|
||||
static uint32_t drag_handle_touch_down(struct wlr_seat_touch_grab *grab,
|
||||
static uint32_t drag_handle_touch_down(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
// eat the event
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void drag_handle_touch_up(struct wlr_seat_touch_grab *grab,
|
||||
static void drag_handle_touch_up(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
struct wlr_drag *drag = grab->data;
|
||||
struct wlr_drag *drag = data;
|
||||
if (drag->grab_touch_id != point->touch_id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -276,9 +276,9 @@ static void drag_handle_touch_up(struct wlr_seat_touch_grab *grab,
|
|||
drag_destroy(drag);
|
||||
}
|
||||
|
||||
static void drag_handle_touch_motion(struct wlr_seat_touch_grab *grab,
|
||||
static void drag_handle_touch_motion(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
struct wlr_drag *drag = grab->data;
|
||||
struct wlr_drag *drag = data;
|
||||
if (drag->focus && drag->focus_client) {
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &drag->focus_client->data_devices) {
|
||||
|
|
@ -289,19 +289,18 @@ static void drag_handle_touch_motion(struct wlr_seat_touch_grab *grab,
|
|||
}
|
||||
}
|
||||
|
||||
static void drag_handle_touch_enter(struct wlr_seat_touch_grab *grab,
|
||||
static void drag_handle_touch_enter(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
struct wlr_drag *drag = grab->data;
|
||||
struct wlr_drag *drag = data;
|
||||
drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
|
||||
}
|
||||
|
||||
static void drag_handle_touch_cancel(struct wlr_seat_touch_grab *grab) {
|
||||
struct wlr_drag *drag = grab->data;
|
||||
static void drag_handle_touch_cancel(void *data) {
|
||||
struct wlr_drag *drag = data;
|
||||
drag_destroy(drag);
|
||||
}
|
||||
|
||||
static const struct wlr_touch_grab_interface
|
||||
data_device_touch_drag_interface = {
|
||||
static const struct wlr_touch_grab drag_touch_grab = {
|
||||
.down = drag_handle_touch_down,
|
||||
.up = drag_handle_touch_up,
|
||||
.motion = drag_handle_touch_motion,
|
||||
|
|
@ -434,9 +433,6 @@ struct wlr_drag *wlr_drag_create(struct wlr_seat_client *seat_client,
|
|||
wl_signal_add(&source->events.destroy, &drag->source_destroy);
|
||||
}
|
||||
|
||||
drag->touch_grab.data = drag;
|
||||
drag->touch_grab.interface = &data_device_touch_drag_interface;
|
||||
|
||||
return drag;
|
||||
}
|
||||
|
||||
|
|
@ -505,7 +501,7 @@ void wlr_seat_start_touch_drag(struct wlr_seat *seat, struct wlr_drag *drag,
|
|||
drag->grab_touch_id = seat->touch_state.grab_id;
|
||||
drag->touch_id = point->touch_id;
|
||||
|
||||
wlr_seat_touch_start_grab(seat, &drag->touch_grab);
|
||||
wlr_seat_touch_start_grab(seat, &drag_touch_grab, drag);
|
||||
drag_set_focus(drag, point->surface, point->sx, point->sy);
|
||||
|
||||
wlr_seat_start_drag(seat, drag, serial);
|
||||
|
|
|
|||
|
|
@ -211,7 +211,6 @@ void wlr_seat_destroy(struct wlr_seat *seat) {
|
|||
}
|
||||
|
||||
wlr_global_destroy_safe(seat->global);
|
||||
free(seat->touch_state.default_grab);
|
||||
free(seat->name);
|
||||
free(seat);
|
||||
}
|
||||
|
|
@ -247,24 +246,15 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
wl_signal_init(&seat->keyboard_state.events.focus_change);
|
||||
|
||||
// touch state
|
||||
struct wlr_seat_touch_grab *touch_grab =
|
||||
calloc(1, sizeof(struct wlr_seat_touch_grab));
|
||||
if (!touch_grab) {
|
||||
free(seat);
|
||||
return NULL;
|
||||
}
|
||||
touch_grab->interface = &default_touch_grab_impl;
|
||||
touch_grab->seat = seat;
|
||||
seat->touch_state.default_grab = touch_grab;
|
||||
seat->touch_state.grab = touch_grab;
|
||||
|
||||
seat->touch_state.seat = seat;
|
||||
wl_list_init(&seat->touch_state.touch_points);
|
||||
|
||||
seat->touch_state.grab = &default_touch_grab;
|
||||
seat->touch_state.grab_data = seat;
|
||||
|
||||
seat->global = wl_global_create(display, &wl_seat_interface,
|
||||
SEAT_VERSION, seat, seat_handle_bind);
|
||||
if (seat->global == NULL) {
|
||||
free(touch_grab);
|
||||
free(seat);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,44 +8,44 @@
|
|||
#include <wlr/util/log.h>
|
||||
#include "types/wlr_seat.h"
|
||||
|
||||
static uint32_t default_touch_down(struct wlr_seat_touch_grab *grab,
|
||||
static uint32_t default_touch_down(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
return wlr_seat_touch_send_down(grab->seat, point->surface, time,
|
||||
return wlr_seat_touch_send_down(data, point->surface, time,
|
||||
point->touch_id, point->sx, point->sy);
|
||||
}
|
||||
|
||||
static void default_touch_up(struct wlr_seat_touch_grab *grab, uint32_t time,
|
||||
static void default_touch_up(void *data, uint32_t time,
|
||||
struct wlr_touch_point *point) {
|
||||
wlr_seat_touch_send_up(grab->seat, time, point->touch_id);
|
||||
wlr_seat_touch_send_up(data, time, point->touch_id);
|
||||
}
|
||||
|
||||
static void default_touch_motion(struct wlr_seat_touch_grab *grab,
|
||||
static void default_touch_motion(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
if (!point->focus_surface || point->focus_surface == point->surface) {
|
||||
wlr_seat_touch_send_motion(grab->seat, time, point->touch_id, point->sx,
|
||||
wlr_seat_touch_send_motion(data, time, point->touch_id, point->sx,
|
||||
point->sy);
|
||||
}
|
||||
}
|
||||
|
||||
static void default_touch_enter(struct wlr_seat_touch_grab *grab,
|
||||
static void default_touch_enter(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
// not handled by default
|
||||
}
|
||||
|
||||
static void default_touch_frame(struct wlr_seat_touch_grab *grab) {
|
||||
wlr_seat_touch_send_frame(grab->seat);
|
||||
static void default_touch_frame(void *data) {
|
||||
wlr_seat_touch_send_frame(data);
|
||||
}
|
||||
|
||||
static void default_touch_cancel(struct wlr_seat_touch_grab *grab) {
|
||||
static void default_touch_cancel(void *data) {
|
||||
// cannot be cancelled
|
||||
}
|
||||
|
||||
static void default_touch_wl_cancel(struct wlr_seat_touch_grab *grab,
|
||||
static void default_touch_wl_cancel(void *data,
|
||||
struct wlr_surface *surface) {
|
||||
wlr_seat_touch_send_cancel(grab->seat, surface);
|
||||
wlr_seat_touch_send_cancel(data, surface);
|
||||
}
|
||||
|
||||
const struct wlr_touch_grab_interface default_touch_grab_impl = {
|
||||
const struct wlr_touch_grab default_touch_grab = {
|
||||
.down = default_touch_down,
|
||||
.up = default_touch_up,
|
||||
.motion = default_touch_motion,
|
||||
|
|
@ -55,7 +55,6 @@ const struct wlr_touch_grab_interface default_touch_grab_impl = {
|
|||
.wl_cancel = default_touch_wl_cancel,
|
||||
};
|
||||
|
||||
|
||||
static void touch_release(struct wl_client *client,
|
||||
struct wl_resource *resource) {
|
||||
wl_resource_destroy(resource);
|
||||
|
|
@ -79,21 +78,24 @@ static struct wlr_seat_client *seat_client_from_touch_resource(
|
|||
|
||||
|
||||
void wlr_seat_touch_start_grab(struct wlr_seat *wlr_seat,
|
||||
struct wlr_seat_touch_grab *grab) {
|
||||
grab->seat = wlr_seat;
|
||||
const struct wlr_touch_grab *grab, void *data) {
|
||||
wlr_seat->touch_state.grab = grab;
|
||||
wlr_seat->touch_state.grab_data = data;
|
||||
|
||||
wl_signal_emit_mutable(&wlr_seat->events.touch_grab_begin, grab);
|
||||
wl_signal_emit_mutable(&wlr_seat->events.touch_grab_begin, NULL);
|
||||
}
|
||||
|
||||
void wlr_seat_touch_end_grab(struct wlr_seat *wlr_seat) {
|
||||
struct wlr_seat_touch_grab *grab = wlr_seat->touch_state.grab;
|
||||
const struct wlr_touch_grab *grab = wlr_seat->touch_state.grab;
|
||||
void *grab_data = wlr_seat->touch_state.grab_data;
|
||||
|
||||
if (grab != wlr_seat->touch_state.default_grab) {
|
||||
wlr_seat->touch_state.grab = wlr_seat->touch_state.default_grab;
|
||||
wl_signal_emit_mutable(&wlr_seat->events.touch_grab_end, grab);
|
||||
if (grab->interface->cancel) {
|
||||
grab->interface->cancel(grab);
|
||||
if (grab != &default_touch_grab) {
|
||||
wlr_seat->touch_state.grab = &default_touch_grab;
|
||||
wlr_seat->touch_state.grab_data = wlr_seat;
|
||||
|
||||
wl_signal_emit_mutable(&wlr_seat->events.touch_grab_end, NULL);
|
||||
if (grab->cancel) {
|
||||
grab->cancel(grab_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -184,7 +186,7 @@ uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
|
|||
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
|
||||
double sy) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &seat->last_event);
|
||||
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
|
||||
struct wlr_seat_touch_state *touch_state = &seat->touch_state;
|
||||
struct wlr_touch_point *point =
|
||||
touch_point_create(seat, touch_id, surface, sx, sy);
|
||||
if (!point) {
|
||||
|
|
@ -192,7 +194,7 @@ uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t serial = grab->interface->down(grab, time, point);
|
||||
uint32_t serial = touch_state->grab->down(touch_state->grab_data, time, point);
|
||||
|
||||
if (!serial) {
|
||||
touch_point_destroy(point);
|
||||
|
|
@ -210,13 +212,13 @@ uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
|
|||
void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time,
|
||||
int32_t touch_id) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &seat->last_event);
|
||||
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
|
||||
struct wlr_seat_touch_state *touch_state = &seat->touch_state;
|
||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||
if (!point) {
|
||||
return;
|
||||
}
|
||||
|
||||
grab->interface->up(grab, time, point);
|
||||
touch_state->grab->up(touch_state->grab_data, time, point);
|
||||
|
||||
touch_point_destroy(point);
|
||||
}
|
||||
|
|
@ -224,7 +226,7 @@ void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time,
|
|||
void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time,
|
||||
int32_t touch_id, double sx, double sy) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &seat->last_event);
|
||||
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
|
||||
struct wlr_seat_touch_state *touch_state = &seat->touch_state;
|
||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||
if (!point) {
|
||||
return;
|
||||
|
|
@ -233,21 +235,21 @@ void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time,
|
|||
point->sx = sx;
|
||||
point->sy = sy;
|
||||
|
||||
grab->interface->motion(grab, time, point);
|
||||
touch_state->grab->motion(touch_state->grab_data, time, point);
|
||||
}
|
||||
|
||||
void wlr_seat_touch_notify_frame(struct wlr_seat *seat) {
|
||||
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
|
||||
if (grab->interface->frame) {
|
||||
grab->interface->frame(grab);
|
||||
struct wlr_seat_touch_state *touch_state = &seat->touch_state;
|
||||
if (touch_state->grab->frame) {
|
||||
touch_state->grab->frame(touch_state->grab_data);
|
||||
}
|
||||
}
|
||||
|
||||
void wlr_seat_touch_notify_cancel(struct wlr_seat *seat,
|
||||
struct wlr_surface *surface) {
|
||||
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
|
||||
if (grab->interface->wl_cancel) {
|
||||
grab->interface->wl_cancel(grab, surface);
|
||||
struct wlr_seat_touch_state *touch_state = &seat->touch_state;
|
||||
if (touch_state->grab->wl_cancel) {
|
||||
touch_state->grab->wl_cancel(touch_state->grab_data, surface);
|
||||
}
|
||||
|
||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
||||
|
|
@ -307,8 +309,8 @@ void wlr_seat_touch_point_focus(struct wlr_seat *seat,
|
|||
touch_point_set_focus(point, surface, sx, sy);
|
||||
|
||||
if (focus != point->focus_surface) {
|
||||
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
|
||||
grab->interface->enter(grab, time, point);
|
||||
struct wlr_seat_touch_state *touch_state = &seat->touch_state;
|
||||
touch_state->grab->enter(touch_state->grab_data, time, point);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -422,7 +424,7 @@ int wlr_seat_touch_num_points(struct wlr_seat *seat) {
|
|||
}
|
||||
|
||||
bool wlr_seat_touch_has_grab(struct wlr_seat *seat) {
|
||||
return seat->touch_state.grab->interface != &default_touch_grab_impl;
|
||||
return seat->touch_state.grab != &default_touch_grab;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -145,43 +145,47 @@ static const struct wlr_keyboard_grab xdg_keyboard_grab = {
|
|||
.cancel = xdg_keyboard_grab_cancel,
|
||||
};
|
||||
|
||||
static uint32_t xdg_touch_grab_down(struct wlr_seat_touch_grab *grab,
|
||||
static uint32_t xdg_touch_grab_down(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
struct wlr_xdg_popup_grab *popup_grab = grab->data;
|
||||
struct wlr_xdg_popup_grab *popup_grab = data;
|
||||
|
||||
if (wl_resource_get_client(point->surface->resource) != popup_grab->client) {
|
||||
xdg_popup_grab_end(grab->data);
|
||||
xdg_popup_grab_end(popup_grab);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return wlr_seat_touch_send_down(grab->seat, point->surface, time,
|
||||
point->touch_id, point->sx, point->sy);
|
||||
return wlr_seat_touch_send_down(popup_grab->seat, point->surface, time,
|
||||
point->touch_id, point->sx, point->sy);
|
||||
}
|
||||
|
||||
static void xdg_touch_grab_up(struct wlr_seat_touch_grab *grab,
|
||||
static void xdg_touch_grab_up(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
wlr_seat_touch_send_up(grab->seat, time, point->touch_id);
|
||||
struct wlr_xdg_popup_grab *popup_grab = data;
|
||||
wlr_seat_touch_send_up(popup_grab->seat, time, point->touch_id);
|
||||
}
|
||||
|
||||
static void xdg_touch_grab_motion(struct wlr_seat_touch_grab *grab,
|
||||
static void xdg_touch_grab_motion(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
wlr_seat_touch_send_motion(grab->seat, time, point->touch_id, point->sx,
|
||||
point->sy);
|
||||
struct wlr_xdg_popup_grab *popup_grab = data;
|
||||
wlr_seat_touch_send_motion(popup_grab->seat, time, point->touch_id,
|
||||
point->sx, point->sy);
|
||||
}
|
||||
|
||||
static void xdg_touch_grab_enter(struct wlr_seat_touch_grab *grab,
|
||||
static void xdg_touch_grab_enter(void *data,
|
||||
uint32_t time, struct wlr_touch_point *point) {
|
||||
}
|
||||
|
||||
static void xdg_touch_grab_frame(struct wlr_seat_touch_grab *grab) {
|
||||
wlr_seat_touch_send_frame(grab->seat);
|
||||
static void xdg_touch_grab_frame(void *data) {
|
||||
struct wlr_xdg_popup_grab *popup_grab = data;
|
||||
wlr_seat_touch_send_frame(popup_grab->seat);
|
||||
}
|
||||
|
||||
static void xdg_touch_grab_cancel(struct wlr_seat_touch_grab *grab) {
|
||||
wlr_seat_touch_end_grab(grab->seat);
|
||||
static void xdg_touch_grab_cancel(void *data) {
|
||||
struct wlr_xdg_popup_grab *popup_grab = data;
|
||||
wlr_seat_touch_end_grab(popup_grab->seat);
|
||||
}
|
||||
|
||||
static const struct wlr_touch_grab_interface xdg_touch_grab_impl = {
|
||||
static const struct wlr_touch_grab xdg_touch_grab = {
|
||||
.down = xdg_touch_grab_down,
|
||||
.up = xdg_touch_grab_up,
|
||||
.motion = xdg_touch_grab_motion,
|
||||
|
|
@ -227,9 +231,6 @@ static struct wlr_xdg_popup_grab *get_xdg_shell_popup_grab_from_seat(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
xdg_grab->touch_grab.data = xdg_grab;
|
||||
xdg_grab->touch_grab.interface = &xdg_touch_grab_impl;
|
||||
|
||||
wl_list_init(&xdg_grab->popups);
|
||||
|
||||
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
|
||||
|
|
@ -304,9 +305,8 @@ static void xdg_popup_handle_grab(struct wl_client *client,
|
|||
&xdg_pointer_grab, popup_grab);
|
||||
wlr_seat_keyboard_start_grab(seat_client->seat,
|
||||
&xdg_keyboard_grab, popup_grab);
|
||||
|
||||
wlr_seat_touch_start_grab(seat_client->seat,
|
||||
&popup_grab->touch_grab);
|
||||
&xdg_touch_grab, popup_grab);
|
||||
}
|
||||
|
||||
static void xdg_popup_handle_reposition(
|
||||
|
|
@ -445,7 +445,7 @@ void unmap_xdg_popup(struct wlr_xdg_popup *popup) {
|
|||
if (grab->seat->keyboard_state.grab == &xdg_keyboard_grab) {
|
||||
wlr_seat_keyboard_end_grab(grab->seat);
|
||||
}
|
||||
if (grab->seat->touch_state.grab == &grab->touch_grab) {
|
||||
if (grab->seat->touch_state.grab == &xdg_touch_grab) {
|
||||
wlr_seat_touch_end_grab(grab->seat);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue