mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-07 05:55:58 +01:00
rename seat handle to seat client
This commit is contained in:
parent
57efc3417f
commit
fddef4d58e
7 changed files with 245 additions and 235 deletions
|
@ -28,7 +28,7 @@ struct wlr_data_offer {
|
||||||
struct wlr_data_source {
|
struct wlr_data_source {
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wlr_data_offer *offer;
|
struct wlr_data_offer *offer;
|
||||||
struct wlr_seat_handle *seat;
|
struct wlr_seat_client *seat_client;
|
||||||
struct wl_array mime_types;
|
struct wl_array mime_types;
|
||||||
|
|
||||||
bool accepted;
|
bool accepted;
|
||||||
|
@ -54,8 +54,8 @@ struct wlr_drag {
|
||||||
struct wlr_seat_pointer_grab pointer_grab;
|
struct wlr_seat_pointer_grab pointer_grab;
|
||||||
struct wlr_seat_keyboard_grab keyboard_grab;
|
struct wlr_seat_keyboard_grab keyboard_grab;
|
||||||
|
|
||||||
struct wlr_seat_handle *handle;
|
struct wlr_seat_client *seat_client;
|
||||||
struct wlr_seat_handle *focus_handle;
|
struct wlr_seat_client *focus_client;
|
||||||
|
|
||||||
struct wlr_surface *icon;
|
struct wlr_surface *icon;
|
||||||
struct wlr_surface *focus;
|
struct wlr_surface *focus;
|
||||||
|
@ -63,7 +63,7 @@ struct wlr_drag {
|
||||||
|
|
||||||
struct wl_listener icon_destroy;
|
struct wl_listener icon_destroy;
|
||||||
struct wl_listener source_destroy;
|
struct wl_listener source_destroy;
|
||||||
struct wl_listener handle_unbound;
|
struct wl_listener seat_client_unbound;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,15 +73,13 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(
|
||||||
struct wl_display *display);
|
struct wl_display *display);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new wl_data_offer if there is a wl_data_source currently set as the
|
* Creates a new wl_data_offer if there is a wl_data_source currently set as
|
||||||
* seat selection and sends it to the client for this handle, followed by the
|
* the seat selection and sends it to the seat client, followed by the
|
||||||
* wl_data_device.selection() event.
|
* wl_data_device.selection() event. If there is no current selection, the
|
||||||
* If there is no current selection, the wl_data_device.selection() event will
|
* wl_data_device.selection() event will carry a NULL wl_data_offer. If the
|
||||||
* carry a NULL wl_data_offer.
|
* client does not have a wl_data_device for the seat nothing * will be done.
|
||||||
* If the client does not have a wl_data_device for the seat nothing * will be
|
|
||||||
* done.
|
|
||||||
*/
|
*/
|
||||||
void wlr_seat_handle_send_selection(struct wlr_seat_handle *handle);
|
void wlr_seat_client_send_selection(struct wlr_seat_client *seat_client);
|
||||||
|
|
||||||
void wlr_seat_set_selection(struct wlr_seat *seat,
|
void wlr_seat_set_selection(struct wlr_seat *seat,
|
||||||
struct wlr_data_source *source, uint32_t serial);
|
struct wlr_data_source *source, uint32_t serial);
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
* to issue input events to that client. The lifetime of these objects is
|
* to issue input events to that client. The lifetime of these objects is
|
||||||
* managed by wlr_seat; some may be NULL.
|
* managed by wlr_seat; some may be NULL.
|
||||||
*/
|
*/
|
||||||
struct wlr_seat_handle {
|
struct wlr_seat_client {
|
||||||
struct wl_resource *wl_resource;
|
struct wl_resource *wl_resource;
|
||||||
|
struct wl_client *client;
|
||||||
struct wlr_seat *wlr_seat;
|
struct wlr_seat *wlr_seat;
|
||||||
|
|
||||||
struct wl_resource *pointer;
|
struct wl_resource *pointer;
|
||||||
|
@ -40,7 +41,8 @@ struct wlr_pointer_grab_interface {
|
||||||
struct wlr_seat_keyboard_grab;
|
struct wlr_seat_keyboard_grab;
|
||||||
|
|
||||||
struct wlr_keyboard_grab_interface {
|
struct wlr_keyboard_grab_interface {
|
||||||
void (*enter)(struct wlr_seat_keyboard_grab *grab, struct wlr_surface *surface);
|
void (*enter)(struct wlr_seat_keyboard_grab *grab,
|
||||||
|
struct wlr_surface *surface);
|
||||||
void (*key)(struct wlr_seat_keyboard_grab *grab, uint32_t time,
|
void (*key)(struct wlr_seat_keyboard_grab *grab, uint32_t time,
|
||||||
uint32_t key, uint32_t state);
|
uint32_t key, uint32_t state);
|
||||||
void (*modifiers)(struct wlr_seat_keyboard_grab *grab,
|
void (*modifiers)(struct wlr_seat_keyboard_grab *grab,
|
||||||
|
@ -71,7 +73,7 @@ struct wlr_seat_pointer_grab {
|
||||||
|
|
||||||
struct wlr_seat_pointer_state {
|
struct wlr_seat_pointer_state {
|
||||||
struct wlr_seat *wlr_seat;
|
struct wlr_seat *wlr_seat;
|
||||||
struct wlr_seat_handle *focused_handle;
|
struct wlr_seat_client *focused_client;
|
||||||
struct wlr_surface *focused_surface;
|
struct wlr_surface *focused_surface;
|
||||||
|
|
||||||
struct wlr_seat_pointer_grab *grab;
|
struct wlr_seat_pointer_grab *grab;
|
||||||
|
@ -90,7 +92,7 @@ struct wlr_seat_keyboard_state {
|
||||||
struct wlr_seat *wlr_seat;
|
struct wlr_seat *wlr_seat;
|
||||||
struct wlr_keyboard *keyboard;
|
struct wlr_keyboard *keyboard;
|
||||||
|
|
||||||
struct wlr_seat_handle *focused_handle;
|
struct wlr_seat_client *focused_client;
|
||||||
struct wlr_surface *focused_surface;
|
struct wlr_surface *focused_surface;
|
||||||
|
|
||||||
struct wl_listener keyboard_destroy;
|
struct wl_listener keyboard_destroy;
|
||||||
|
@ -106,7 +108,7 @@ struct wlr_seat_keyboard_state {
|
||||||
struct wlr_seat {
|
struct wlr_seat {
|
||||||
struct wl_global *wl_global;
|
struct wl_global *wl_global;
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
struct wl_list handles;
|
struct wl_list clients;
|
||||||
char *name;
|
char *name;
|
||||||
uint32_t capabilities;
|
uint32_t capabilities;
|
||||||
|
|
||||||
|
@ -138,8 +140,7 @@ struct wlr_seat {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_seat_pointer_request_set_cursor_event {
|
struct wlr_seat_pointer_request_set_cursor_event {
|
||||||
struct wl_client *client;
|
struct wlr_seat_client *seat_client;
|
||||||
struct wlr_seat_handle *seat_handle;
|
|
||||||
struct wlr_surface *surface;
|
struct wlr_surface *surface;
|
||||||
int32_t hotspot_x, hotspot_y;
|
int32_t hotspot_x, hotspot_y;
|
||||||
};
|
};
|
||||||
|
@ -153,11 +154,11 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name);
|
||||||
*/
|
*/
|
||||||
void wlr_seat_destroy(struct wlr_seat *wlr_seat);
|
void wlr_seat_destroy(struct wlr_seat *wlr_seat);
|
||||||
/**
|
/**
|
||||||
* Gets a wlr_seat_handle for the specified client, or returns NULL if no
|
* Gets a wlr_seat_client for the specified client, or returns NULL if no
|
||||||
* handle is bound for that client.
|
* client is bound for that client.
|
||||||
*/
|
*/
|
||||||
struct wlr_seat_handle *wlr_seat_handle_for_client(struct wlr_seat *wlr_seat,
|
struct wlr_seat_client *wlr_seat_client_for_wl_client(struct wlr_seat *wlr_seat,
|
||||||
struct wl_client *client);
|
struct wl_client *wl_client);
|
||||||
/**
|
/**
|
||||||
* Updates the capabilities available on this seat.
|
* Updates the capabilities available on this seat.
|
||||||
* Will automatically send them to all clients.
|
* Will automatically send them to all clients.
|
||||||
|
@ -231,9 +232,9 @@ void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat,
|
||||||
void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat);
|
void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the seat of a pointer enter event to the given surface and request it to be the
|
* Notify the seat of a pointer enter event to the given surface and request it
|
||||||
* focused surface for the pointer. Pass surface-local coordinates where the
|
* to be the focused surface for the pointer. Pass surface-local coordinates
|
||||||
* enter occurred.
|
* where the enter occurred.
|
||||||
*/
|
*/
|
||||||
void wlr_seat_pointer_notify_enter(struct wlr_seat *wlr_seat,
|
void wlr_seat_pointer_notify_enter(struct wlr_seat *wlr_seat,
|
||||||
struct wlr_surface *surface, double sx, double sy);
|
struct wlr_surface *surface, double sx, double sy);
|
||||||
|
|
|
@ -475,12 +475,12 @@ static void handle_request_set_cursor(struct wl_listener *listener,
|
||||||
struct wlr_seat_pointer_request_set_cursor_event *event = data;
|
struct wlr_seat_pointer_request_set_cursor_event *event = data;
|
||||||
|
|
||||||
struct wlr_surface *focused_surface =
|
struct wlr_surface *focused_surface =
|
||||||
event->seat_handle->wlr_seat->pointer_state.focused_surface;
|
event->seat_client->wlr_seat->pointer_state.focused_surface;
|
||||||
bool ok = focused_surface != NULL && focused_surface->resource != NULL;
|
bool ok = focused_surface != NULL && focused_surface->resource != NULL;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
struct wl_client *focused_client =
|
struct wl_client *focused_client =
|
||||||
wl_resource_get_client(focused_surface->resource);
|
wl_resource_get_client(focused_surface->resource);
|
||||||
ok = event->client == focused_client;
|
ok = event->seat_client->client == focused_client;
|
||||||
}
|
}
|
||||||
if (!ok || input->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
if (!ok || input->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
||||||
wlr_log(L_DEBUG, "Denying request to set cursor from unfocused client");
|
wlr_log(L_DEBUG, "Denying request to set cursor from unfocused client");
|
||||||
|
@ -489,7 +489,7 @@ static void handle_request_set_cursor(struct wl_listener *listener,
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Setting client cursor");
|
wlr_log(L_DEBUG, "Setting client cursor");
|
||||||
cursor_set_surface(input, event->surface, event->hotspot_x, event->hotspot_y);
|
cursor_set_surface(input, event->surface, event->hotspot_x, event->hotspot_y);
|
||||||
input->cursor_client = event->client;
|
input->cursor_client = event->seat_client->client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursor_initialize(struct roots_input *input) {
|
void cursor_initialize(struct roots_input *input) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ static uint32_t data_offer_choose_action(struct wlr_data_offer *offer) {
|
||||||
return WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
|
return WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offer->source->seat &&
|
if (offer->source->seat_client &&
|
||||||
offer->source->compositor_action & available_actions) {
|
offer->source->compositor_action & available_actions) {
|
||||||
return offer->source->compositor_action;
|
return offer->source->compositor_action;
|
||||||
}
|
}
|
||||||
|
@ -263,31 +263,31 @@ static struct wlr_data_offer *wlr_data_source_send_offer(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wlr_seat_handle_send_selection(struct wlr_seat_handle *handle) {
|
void wlr_seat_client_send_selection(struct wlr_seat_client *client) {
|
||||||
if (!handle->data_device) {
|
if (!client->data_device) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->wlr_seat->selection_source) {
|
if (client->wlr_seat->selection_source) {
|
||||||
struct wlr_data_offer *offer =
|
struct wlr_data_offer *offer =
|
||||||
wlr_data_source_send_offer(handle->wlr_seat->selection_source,
|
wlr_data_source_send_offer(client->wlr_seat->selection_source,
|
||||||
handle->data_device);
|
client->data_device);
|
||||||
wl_data_device_send_selection(handle->data_device, offer->resource);
|
wl_data_device_send_selection(client->data_device, offer->resource);
|
||||||
} else {
|
} else {
|
||||||
wl_data_device_send_selection(handle->data_device, NULL);
|
wl_data_device_send_selection(client->data_device, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_handle_selection_data_source_destroy(
|
static void seat_client_selection_data_source_destroy(
|
||||||
struct wl_listener *listener, void *data) {
|
struct wl_listener *listener, void *data) {
|
||||||
struct wlr_seat *seat =
|
struct wlr_seat *seat =
|
||||||
wl_container_of(listener, seat, selection_data_source_destroy);
|
wl_container_of(listener, seat, selection_data_source_destroy);
|
||||||
|
|
||||||
if (seat->keyboard_state.focused_handle &&
|
if (seat->keyboard_state.focused_client &&
|
||||||
seat->keyboard_state.focused_surface &&
|
seat->keyboard_state.focused_surface &&
|
||||||
seat->keyboard_state.focused_handle->data_device) {
|
seat->keyboard_state.focused_client->data_device) {
|
||||||
wl_data_device_send_selection(
|
wl_data_device_send_selection(
|
||||||
seat->keyboard_state.focused_handle->data_device, NULL);
|
seat->keyboard_state.focused_client->data_device, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
seat->selection_source = NULL;
|
seat->selection_source = NULL;
|
||||||
|
@ -311,35 +311,36 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
|
||||||
seat->selection_source = source;
|
seat->selection_source = source;
|
||||||
seat->selection_serial = serial;
|
seat->selection_serial = serial;
|
||||||
|
|
||||||
struct wlr_seat_handle *focused_handle =
|
struct wlr_seat_client *focused_client =
|
||||||
seat->keyboard_state.focused_handle;
|
seat->keyboard_state.focused_client;
|
||||||
|
|
||||||
if (focused_handle) {
|
if (focused_client) {
|
||||||
wlr_seat_handle_send_selection(focused_handle);
|
wlr_seat_client_send_selection(focused_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit(&seat->events.selection, seat);
|
wl_signal_emit(&seat->events.selection, seat);
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
seat->selection_data_source_destroy.notify =
|
seat->selection_data_source_destroy.notify =
|
||||||
seat_handle_selection_data_source_destroy;
|
seat_client_selection_data_source_destroy;
|
||||||
wl_signal_add(&source->events.destroy,
|
wl_signal_add(&source->events.destroy,
|
||||||
&seat->selection_data_source_destroy);
|
&seat->selection_data_source_destroy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void data_device_set_selection(struct wl_client *client,
|
static void data_device_set_selection(struct wl_client *client,
|
||||||
struct wl_resource *seat_resource, struct wl_resource *source_resource,
|
struct wl_resource *dd_resource, struct wl_resource *source_resource,
|
||||||
uint32_t serial) {
|
uint32_t serial) {
|
||||||
if (!source_resource) {
|
if (!source_resource) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_data_source *source = wl_resource_get_user_data(source_resource);
|
struct wlr_data_source *source = wl_resource_get_user_data(source_resource);
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(seat_resource);
|
struct wlr_seat_client *seat_client =
|
||||||
|
wl_resource_get_user_data(dd_resource);
|
||||||
|
|
||||||
// TODO: store serial and check against incoming serial here
|
// TODO: store serial and check against incoming serial here
|
||||||
wlr_seat_set_selection(handle->wlr_seat, source, serial);
|
wlr_seat_set_selection(seat_client->wlr_seat, source, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void data_device_release(struct wl_client *client,
|
static void data_device_release(struct wl_client *client,
|
||||||
|
@ -347,13 +348,14 @@ static void data_device_release(struct wl_client *client,
|
||||||
wl_resource_destroy(resource);
|
wl_resource_destroy(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drag_handle_seat_unbound(struct wl_listener *listener, void *data) {
|
static void drag_client_seat_unbound(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_drag *drag = wl_container_of(listener, drag, handle_unbound);
|
struct wlr_drag *drag =
|
||||||
struct wlr_seat_handle *unbound_handle = data;
|
wl_container_of(listener, drag, seat_client_unbound);
|
||||||
|
struct wlr_seat_client *unbound_client = data;
|
||||||
|
|
||||||
if (drag->focus_handle == unbound_handle) {
|
if (drag->focus_client == unbound_client) {
|
||||||
drag->focus_handle = NULL;
|
drag->focus_client = NULL;
|
||||||
wl_list_remove(&drag->handle_unbound.link);
|
wl_list_remove(&drag->seat_client_unbound.link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,10 +365,10 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drag->focus_handle && drag->focus_handle->data_device) {
|
if (drag->focus_client && drag->focus_client->data_device) {
|
||||||
wl_list_remove(&drag->handle_unbound.link);
|
wl_list_remove(&drag->seat_client_unbound.link);
|
||||||
wl_data_device_send_leave(drag->focus_handle->data_device);
|
wl_data_device_send_leave(drag->focus_client->data_device);
|
||||||
drag->focus_handle = NULL;
|
drag->focus_client = NULL;
|
||||||
drag->focus = NULL;
|
drag->focus = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +378,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
|
||||||
|
|
||||||
if (!drag->source &&
|
if (!drag->source &&
|
||||||
wl_resource_get_client(surface->resource) !=
|
wl_resource_get_client(surface->resource) !=
|
||||||
wl_resource_get_client(drag->handle->wl_resource)) {
|
wl_resource_get_client(drag->seat_client->wl_resource)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,11 +389,11 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
|
||||||
drag->source->offer = NULL;
|
drag->source->offer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat_handle *focus_handle =
|
struct wlr_seat_client *focus_client =
|
||||||
wlr_seat_handle_for_client(drag->handle->wlr_seat,
|
wlr_seat_client_for_wl_client(drag->seat_client->wlr_seat,
|
||||||
wl_resource_get_client(surface->resource));
|
wl_resource_get_client(surface->resource));
|
||||||
|
|
||||||
if (!focus_handle || !focus_handle->data_device) {
|
if (!focus_client || !focus_client->data_device) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +401,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
|
||||||
if (drag->source) {
|
if (drag->source) {
|
||||||
drag->source->accepted = false;
|
drag->source->accepted = false;
|
||||||
struct wlr_data_offer *offer =
|
struct wlr_data_offer *offer =
|
||||||
wlr_data_source_send_offer(drag->source, focus_handle->data_device);
|
wlr_data_source_send_offer(drag->source, focus_client->data_device);
|
||||||
if (offer == NULL) {
|
if (offer == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -415,17 +417,18 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
|
||||||
offer_resource = offer->resource;
|
offer_resource = offer->resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t serial = wl_display_next_serial(drag->handle->wlr_seat->display);
|
uint32_t serial =
|
||||||
|
wl_display_next_serial(drag->seat_client->wlr_seat->display);
|
||||||
|
|
||||||
wl_data_device_send_enter(focus_handle->data_device, serial,
|
wl_data_device_send_enter(focus_client->data_device, serial,
|
||||||
surface->resource, wl_fixed_from_double(sx),
|
surface->resource, wl_fixed_from_double(sx),
|
||||||
wl_fixed_from_double(sy), offer_resource);
|
wl_fixed_from_double(sy), offer_resource);
|
||||||
|
|
||||||
drag->focus = surface;
|
drag->focus = surface;
|
||||||
drag->focus_handle = focus_handle;
|
drag->focus_client = focus_client;
|
||||||
drag->handle_unbound.notify = drag_handle_seat_unbound;
|
drag->seat_client_unbound.notify = drag_client_seat_unbound;
|
||||||
wl_signal_add(&focus_handle->wlr_seat->events.client_unbound,
|
wl_signal_add(&focus_client->wlr_seat->events.client_unbound,
|
||||||
&drag->handle_unbound);
|
&drag->seat_client_unbound);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_drag_end(struct wlr_drag *drag) {
|
static void wlr_drag_end(struct wlr_drag *drag) {
|
||||||
|
@ -452,8 +455,8 @@ static void pointer_drag_enter(struct wlr_seat_pointer_grab *grab,
|
||||||
static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
|
static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
|
||||||
uint32_t time, double sx, double sy) {
|
uint32_t time, double sx, double sy) {
|
||||||
struct wlr_drag *drag = grab->data;
|
struct wlr_drag *drag = grab->data;
|
||||||
if (drag->focus && drag->focus_handle && drag->focus_handle->data_device) {
|
if (drag->focus && drag->focus_client && drag->focus_client->data_device) {
|
||||||
wl_data_device_send_motion(drag->focus_handle->data_device, time,
|
wl_data_device_send_motion(drag->focus_client->data_device, time,
|
||||||
wl_fixed_from_double(sx), wl_fixed_from_double(sy));
|
wl_fixed_from_double(sx), wl_fixed_from_double(sy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,10 +468,10 @@ static uint32_t pointer_drag_button(struct wlr_seat_pointer_grab *grab,
|
||||||
if (drag->source &&
|
if (drag->source &&
|
||||||
grab->seat->pointer_state.grab_button == button &&
|
grab->seat->pointer_state.grab_button == button &&
|
||||||
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||||
if (drag->focus_handle && drag->focus_handle->data_device &&
|
if (drag->focus_client && drag->focus_client->data_device &&
|
||||||
drag->source->current_dnd_action &&
|
drag->source->current_dnd_action &&
|
||||||
drag->source->accepted) {
|
drag->source->accepted) {
|
||||||
wl_data_device_send_drop(drag->focus_handle->data_device);
|
wl_data_device_send_drop(drag->focus_client->data_device);
|
||||||
if (wl_resource_get_version(drag->source->resource) >=
|
if (wl_resource_get_version(drag->source->resource) >=
|
||||||
WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION) {
|
WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION) {
|
||||||
wl_data_source_send_dnd_drop_performed(
|
wl_data_source_send_dnd_drop_performed(
|
||||||
|
@ -551,14 +554,14 @@ static void drag_handle_drag_source_destroy(struct wl_listener *listener,
|
||||||
wlr_drag_end(drag);
|
wlr_drag_end(drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool seat_handle_start_drag(struct wlr_seat_handle *handle,
|
static bool seat_client_start_drag(struct wlr_seat_client *client,
|
||||||
struct wlr_data_source *source, struct wlr_surface *icon) {
|
struct wlr_data_source *source, struct wlr_surface *icon) {
|
||||||
struct wlr_drag *drag = calloc(1, sizeof(struct wlr_drag));
|
struct wlr_drag *drag = calloc(1, sizeof(struct wlr_drag));
|
||||||
if (drag == NULL) {
|
if (drag == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat *seat = handle->wlr_seat;
|
struct wlr_seat *seat = client->wlr_seat;
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
drag->icon = icon;
|
drag->icon = icon;
|
||||||
|
@ -573,7 +576,7 @@ static bool seat_handle_start_drag(struct wlr_seat_handle *handle,
|
||||||
drag->source = source;
|
drag->source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
drag->handle = handle;
|
drag->seat_client = client;
|
||||||
drag->pointer_grab.data = drag;
|
drag->pointer_grab.data = drag;
|
||||||
drag->pointer_grab.interface = &wlr_data_device_pointer_drag_interface;
|
drag->pointer_grab.interface = &wlr_data_device_pointer_drag_interface;
|
||||||
|
|
||||||
|
@ -591,12 +594,12 @@ static bool seat_handle_start_drag(struct wlr_seat_handle *handle,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void data_device_start_drag(struct wl_client *client,
|
static void data_device_start_drag(struct wl_client *client,
|
||||||
struct wl_resource *handle_resource,
|
struct wl_resource *device_resource,
|
||||||
struct wl_resource *source_resource,
|
struct wl_resource *source_resource,
|
||||||
struct wl_resource *origin_resource, struct wl_resource *icon_resource,
|
struct wl_resource *origin_resource, struct wl_resource *icon_resource,
|
||||||
uint32_t serial) {
|
uint32_t serial) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(handle_resource);
|
struct wlr_seat_client *seat_client = wl_resource_get_user_data(device_resource);
|
||||||
struct wlr_seat *seat = handle->wlr_seat;
|
struct wlr_seat *seat = seat_client->wlr_seat;
|
||||||
struct wlr_surface *origin = wl_resource_get_user_data(origin_resource);
|
struct wlr_surface *origin = wl_resource_get_user_data(origin_resource);
|
||||||
struct wlr_data_source *source = NULL;
|
struct wlr_data_source *source = NULL;
|
||||||
struct wlr_surface *icon = NULL;
|
struct wlr_surface *icon = NULL;
|
||||||
|
@ -619,17 +622,17 @@ static void data_device_start_drag(struct wl_client *client,
|
||||||
}
|
}
|
||||||
if (icon) {
|
if (icon) {
|
||||||
if (wlr_surface_set_role(icon, "wl_data_device-icon",
|
if (wlr_surface_set_role(icon, "wl_data_device-icon",
|
||||||
handle_resource, WL_DATA_DEVICE_ERROR_ROLE) < 0) {
|
icon_resource, WL_DATA_DEVICE_ERROR_ROLE) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO touch grab
|
// TODO touch grab
|
||||||
|
|
||||||
if (!seat_handle_start_drag(handle, source, icon)) {
|
if (!seat_client_start_drag(seat_client, source, icon)) {
|
||||||
wl_resource_post_no_memory(handle_resource);
|
wl_resource_post_no_memory(device_resource);
|
||||||
} else {
|
} else {
|
||||||
source->seat = handle;
|
source->seat_client = seat_client;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,7 +645,7 @@ static const struct wl_data_device_interface data_device_impl = {
|
||||||
void data_device_manager_get_data_device(struct wl_client *client,
|
void data_device_manager_get_data_device(struct wl_client *client,
|
||||||
struct wl_resource *manager_resource, uint32_t id,
|
struct wl_resource *manager_resource, uint32_t id,
|
||||||
struct wl_resource *seat_resource) {
|
struct wl_resource *seat_resource) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(seat_resource);
|
struct wlr_seat_client *seat_client = wl_resource_get_user_data(seat_resource);
|
||||||
|
|
||||||
struct wl_resource *resource =
|
struct wl_resource *resource =
|
||||||
wl_resource_create(client,
|
wl_resource_create(client,
|
||||||
|
@ -653,16 +656,16 @@ void data_device_manager_get_data_device(struct wl_client *client,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->data_device != NULL) {
|
if (seat_client->data_device != NULL) {
|
||||||
// XXX this is probably a protocol violation, but it simplfies our code
|
// XXX this is probably a protocol violation, but it simplfies our code
|
||||||
// and it's stupid to create several data devices for the same seat.
|
// and it's stupid to create several data devices for the same seat.
|
||||||
wl_resource_destroy(handle->data_device);
|
wl_resource_destroy(seat_client->data_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->data_device = resource;
|
seat_client->data_device = resource;
|
||||||
|
|
||||||
wl_resource_set_implementation(resource, &data_device_impl,
|
wl_resource_set_implementation(resource, &data_device_impl,
|
||||||
handle, NULL);
|
seat_client, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void data_source_resource_destroy(struct wl_resource *resource) {
|
static void data_source_resource_destroy(struct wl_resource *resource) {
|
||||||
|
@ -705,7 +708,7 @@ static void data_source_set_actions(struct wl_client *client,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source->seat) {
|
if (source->seat_client) {
|
||||||
wl_resource_post_error(source->resource,
|
wl_resource_post_error(source->resource,
|
||||||
WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK,
|
WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK,
|
||||||
"invalid action change after "
|
"invalid action change after "
|
||||||
|
|
276
types/wlr_seat.c
276
types/wlr_seat.c
|
@ -21,15 +21,16 @@ static void pointer_send_frame(struct wl_resource *resource) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wl_pointer_set_cursor(struct wl_client *client,
|
static void wl_pointer_set_cursor(struct wl_client *client,
|
||||||
struct wl_resource *resource, uint32_t serial,
|
struct wl_resource *pointer_resource, uint32_t serial,
|
||||||
struct wl_resource *surface_resource,
|
struct wl_resource *surface_resource,
|
||||||
int32_t hotspot_x, int32_t hotspot_y) {
|
int32_t hotspot_x, int32_t hotspot_y) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(resource);
|
struct wlr_seat_client *seat_client =
|
||||||
|
wl_resource_get_user_data(pointer_resource);
|
||||||
struct wlr_surface *surface = NULL;
|
struct wlr_surface *surface = NULL;
|
||||||
if (surface_resource != NULL) {
|
if (surface_resource != NULL) {
|
||||||
surface = wl_resource_get_user_data(surface_resource);
|
surface = wl_resource_get_user_data(surface_resource);
|
||||||
|
|
||||||
if (wlr_surface_set_role(surface, "wl_pointer-cursor", resource,
|
if (wlr_surface_set_role(surface, "wl_pointer-cursor", surface_resource,
|
||||||
WL_POINTER_ERROR_ROLE) < 0) {
|
WL_POINTER_ERROR_ROLE) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -40,13 +41,12 @@ static void wl_pointer_set_cursor(struct wl_client *client,
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event->client = client;
|
event->seat_client = seat_client;
|
||||||
event->seat_handle = handle;
|
|
||||||
event->surface = surface;
|
event->surface = surface;
|
||||||
event->hotspot_x = hotspot_x;
|
event->hotspot_x = hotspot_x;
|
||||||
event->hotspot_y = hotspot_y;
|
event->hotspot_y = hotspot_y;
|
||||||
|
|
||||||
wl_signal_emit(&handle->wlr_seat->events.request_set_cursor, event);
|
wl_signal_emit(&seat_client->wlr_seat->events.request_set_cursor, event);
|
||||||
|
|
||||||
free(event);
|
free(event);
|
||||||
}
|
}
|
||||||
|
@ -57,28 +57,29 @@ static const struct wl_pointer_interface wl_pointer_impl = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wl_pointer_destroy(struct wl_resource *resource) {
|
static void wl_pointer_destroy(struct wl_resource *resource) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(resource);
|
struct wlr_seat_client *client = wl_resource_get_user_data(resource);
|
||||||
if (handle->pointer) {
|
if (client->pointer) {
|
||||||
handle->pointer = NULL;
|
client->pointer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wl_seat_get_pointer(struct wl_client *client,
|
static void wl_seat_get_pointer(struct wl_client *client,
|
||||||
struct wl_resource *_handle, uint32_t id) {
|
struct wl_resource *pointer_resource, uint32_t id) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(_handle);
|
struct wlr_seat_client *seat_client =
|
||||||
if (!(handle->wlr_seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) {
|
wl_resource_get_user_data(pointer_resource);
|
||||||
|
if (!(seat_client->wlr_seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (handle->pointer) {
|
if (seat_client->pointer) {
|
||||||
// TODO: this is probably a protocol violation but it simplifies our
|
// TODO: this is probably a protocol violation but it simplifies our
|
||||||
// code and it'd be stupid for clients to create several pointers for
|
// code and it'd be stupid for clients to create several pointers for
|
||||||
// the same seat
|
// the same seat
|
||||||
wl_resource_destroy(handle->pointer);
|
wl_resource_destroy(seat_client->pointer);
|
||||||
}
|
}
|
||||||
handle->pointer = wl_resource_create(client, &wl_pointer_interface,
|
seat_client->pointer = wl_resource_create(client, &wl_pointer_interface,
|
||||||
wl_resource_get_version(_handle), id);
|
wl_resource_get_version(pointer_resource), id);
|
||||||
wl_resource_set_implementation(handle->pointer, &wl_pointer_impl,
|
wl_resource_set_implementation(seat_client->pointer, &wl_pointer_impl,
|
||||||
handle, &wl_pointer_destroy);
|
seat_client, &wl_pointer_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_keyboard_interface wl_keyboard_impl = {
|
static const struct wl_keyboard_interface wl_keyboard_impl = {
|
||||||
|
@ -86,47 +87,49 @@ static const struct wl_keyboard_interface wl_keyboard_impl = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wl_keyboard_destroy(struct wl_resource *resource) {
|
static void wl_keyboard_destroy(struct wl_resource *resource) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(resource);
|
struct wlr_seat_client *client = wl_resource_get_user_data(resource);
|
||||||
if (handle->keyboard) {
|
if (client->keyboard) {
|
||||||
handle->keyboard = NULL;
|
client->keyboard = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_handle_send_keymap(struct wlr_seat_handle *handle,
|
static void seat_client_send_keymap(struct wlr_seat_client *client,
|
||||||
struct wlr_keyboard *keyboard) {
|
struct wlr_keyboard *keyboard) {
|
||||||
if (!keyboard || !handle->keyboard) {
|
if (!keyboard || !client->keyboard) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO: We should probably lift all of the keys set by the other
|
// TODO: We should probably lift all of the keys set by the other
|
||||||
// keyboard
|
// keyboard
|
||||||
wl_keyboard_send_keymap(handle->keyboard,
|
wl_keyboard_send_keymap(client->keyboard,
|
||||||
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keyboard->keymap_fd,
|
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keyboard->keymap_fd,
|
||||||
keyboard->keymap_size);
|
keyboard->keymap_size);
|
||||||
|
|
||||||
if (wl_resource_get_version(handle->keyboard) >=
|
if (wl_resource_get_version(client->keyboard) >=
|
||||||
WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
|
WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
|
||||||
wl_keyboard_send_repeat_info(handle->keyboard, 25, 600);
|
wl_keyboard_send_repeat_info(client->keyboard, 25, 600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wl_seat_get_keyboard(struct wl_client *client,
|
static void wl_seat_get_keyboard(struct wl_client *client,
|
||||||
struct wl_resource *_handle, uint32_t id) {
|
struct wl_resource *seat_resource, uint32_t id) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(_handle);
|
struct wlr_seat_client *seat_client =
|
||||||
if (!(handle->wlr_seat->capabilities & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
wl_resource_get_user_data(seat_resource);
|
||||||
|
if (!(seat_client->wlr_seat->capabilities & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (handle->keyboard) {
|
if (seat_client->keyboard) {
|
||||||
// TODO: this is probably a protocol violation but it simplifies our
|
// TODO: this is probably a protocol violation but it simplifies our
|
||||||
// code and it'd be stupid for clients to create several keyboards for
|
// code and it'd be stupid for clients to create several keyboards for
|
||||||
// the same seat
|
// the same seat
|
||||||
wl_resource_destroy(handle->keyboard);
|
wl_resource_destroy(seat_client->keyboard);
|
||||||
}
|
}
|
||||||
handle->keyboard = wl_resource_create(client, &wl_keyboard_interface,
|
seat_client->keyboard = wl_resource_create(client, &wl_keyboard_interface,
|
||||||
wl_resource_get_version(_handle), id);
|
wl_resource_get_version(seat_resource), id);
|
||||||
wl_resource_set_implementation(handle->keyboard, &wl_keyboard_impl,
|
wl_resource_set_implementation(seat_client->keyboard, &wl_keyboard_impl,
|
||||||
handle, &wl_keyboard_destroy);
|
seat_client, &wl_keyboard_destroy);
|
||||||
|
|
||||||
seat_handle_send_keymap(handle, handle->wlr_seat->keyboard_state.keyboard);
|
seat_client_send_keymap(seat_client,
|
||||||
|
seat_client->wlr_seat->keyboard_state.keyboard);
|
||||||
|
|
||||||
// TODO possibly handle the case where this keyboard needs an enter
|
// TODO possibly handle the case where this keyboard needs an enter
|
||||||
// right away
|
// right away
|
||||||
|
@ -137,55 +140,56 @@ static const struct wl_touch_interface wl_touch_impl = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wl_touch_destroy(struct wl_resource *resource) {
|
static void wl_touch_destroy(struct wl_resource *resource) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(resource);
|
struct wlr_seat_client *client = wl_resource_get_user_data(resource);
|
||||||
if (handle->touch) {
|
if (client->touch) {
|
||||||
handle->touch = NULL;
|
client->touch = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wl_seat_get_touch(struct wl_client *client,
|
static void wl_seat_get_touch(struct wl_client *client,
|
||||||
struct wl_resource *_handle, uint32_t id) {
|
struct wl_resource *seat_resource, uint32_t id) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(_handle);
|
struct wlr_seat_client *seat_client =
|
||||||
if (!(handle->wlr_seat->capabilities & WL_SEAT_CAPABILITY_TOUCH)) {
|
wl_resource_get_user_data(seat_resource);
|
||||||
|
if (!(seat_client->wlr_seat->capabilities & WL_SEAT_CAPABILITY_TOUCH)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (handle->touch) {
|
if (seat_client->touch) {
|
||||||
// TODO: this is probably a protocol violation but it simplifies our
|
// TODO: this is probably a protocol violation but it simplifies our
|
||||||
// code and it'd be stupid for clients to create several pointers for
|
// code and it'd be stupid for clients to create several pointers for
|
||||||
// the same seat
|
// the same seat
|
||||||
wl_resource_destroy(handle->touch);
|
wl_resource_destroy(seat_client->touch);
|
||||||
}
|
}
|
||||||
handle->touch = wl_resource_create(client, &wl_touch_interface,
|
seat_client->touch = wl_resource_create(client, &wl_touch_interface,
|
||||||
wl_resource_get_version(_handle), id);
|
wl_resource_get_version(seat_resource), id);
|
||||||
wl_resource_set_implementation(handle->touch, &wl_touch_impl,
|
wl_resource_set_implementation(seat_client->touch, &wl_touch_impl,
|
||||||
handle, &wl_touch_destroy);
|
seat_client, &wl_touch_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_seat_handle_resource_destroy(struct wl_resource *resource) {
|
static void wlr_seat_client_resource_destroy(struct wl_resource *resource) {
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(resource);
|
struct wlr_seat_client *client = wl_resource_get_user_data(resource);
|
||||||
wl_signal_emit(&handle->wlr_seat->events.client_unbound, handle);
|
wl_signal_emit(&client->wlr_seat->events.client_unbound, client);
|
||||||
|
|
||||||
if (handle == handle->wlr_seat->pointer_state.focused_handle) {
|
if (client == client->wlr_seat->pointer_state.focused_client) {
|
||||||
handle->wlr_seat->pointer_state.focused_handle = NULL;
|
client->wlr_seat->pointer_state.focused_client = NULL;
|
||||||
}
|
}
|
||||||
if (handle == handle->wlr_seat->keyboard_state.focused_handle) {
|
if (client == client->wlr_seat->keyboard_state.focused_client) {
|
||||||
handle->wlr_seat->keyboard_state.focused_handle = NULL;
|
client->wlr_seat->keyboard_state.focused_client = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->pointer) {
|
if (client->pointer) {
|
||||||
wl_resource_destroy(handle->pointer);
|
wl_resource_destroy(client->pointer);
|
||||||
}
|
}
|
||||||
if (handle->keyboard) {
|
if (client->keyboard) {
|
||||||
wl_resource_destroy(handle->keyboard);
|
wl_resource_destroy(client->keyboard);
|
||||||
}
|
}
|
||||||
if (handle->touch) {
|
if (client->touch) {
|
||||||
wl_resource_destroy(handle->touch);
|
wl_resource_destroy(client->touch);
|
||||||
}
|
}
|
||||||
if (handle->data_device) {
|
if (client->data_device) {
|
||||||
wl_resource_destroy(handle->data_device);
|
wl_resource_destroy(client->data_device);
|
||||||
}
|
}
|
||||||
wl_list_remove(&handle->link);
|
wl_list_remove(&client->link);
|
||||||
free(handle);
|
free(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_seat_interface wl_seat_impl = {
|
struct wl_seat_interface wl_seat_impl = {
|
||||||
|
@ -195,23 +199,25 @@ struct wl_seat_interface wl_seat_impl = {
|
||||||
.release = resource_destroy
|
.release = resource_destroy
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wl_seat_bind(struct wl_client *wl_client, void *_wlr_seat,
|
static void wl_seat_bind(struct wl_client *client, void *_wlr_seat,
|
||||||
uint32_t version, uint32_t id) {
|
uint32_t version, uint32_t id) {
|
||||||
struct wlr_seat *wlr_seat = _wlr_seat;
|
struct wlr_seat *wlr_seat = _wlr_seat;
|
||||||
assert(wl_client && wlr_seat);
|
assert(client && wlr_seat);
|
||||||
|
|
||||||
struct wlr_seat_handle *handle = calloc(1, sizeof(struct wlr_seat_handle));
|
struct wlr_seat_client *seat_client =
|
||||||
handle->wl_resource = wl_resource_create(
|
calloc(1, sizeof(struct wlr_seat_client));
|
||||||
wl_client, &wl_seat_interface, version, id);
|
seat_client->wl_resource =
|
||||||
handle->wlr_seat = wlr_seat;
|
wl_resource_create(client, &wl_seat_interface, version, id);
|
||||||
wl_resource_set_implementation(handle->wl_resource, &wl_seat_impl,
|
seat_client->client = client;
|
||||||
handle, wlr_seat_handle_resource_destroy);
|
seat_client->wlr_seat = wlr_seat;
|
||||||
wl_list_insert(&wlr_seat->handles, &handle->link);
|
wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
|
||||||
|
seat_client, wlr_seat_client_resource_destroy);
|
||||||
|
wl_list_insert(&wlr_seat->clients, &seat_client->link);
|
||||||
if (version >= WL_SEAT_NAME_SINCE_VERSION) {
|
if (version >= WL_SEAT_NAME_SINCE_VERSION) {
|
||||||
wl_seat_send_name(handle->wl_resource, wlr_seat->name);
|
wl_seat_send_name(seat_client->wl_resource, wlr_seat->name);
|
||||||
}
|
}
|
||||||
wl_seat_send_capabilities(handle->wl_resource, wlr_seat->capabilities);
|
wl_seat_send_capabilities(seat_client->wl_resource, wlr_seat->capabilities);
|
||||||
wl_signal_emit(&wlr_seat->events.client_bound, handle);
|
wl_signal_emit(&wlr_seat->events.client_bound, seat_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void default_pointer_enter(struct wlr_seat_pointer_grab *grab,
|
static void default_pointer_enter(struct wlr_seat_pointer_grab *grab,
|
||||||
|
@ -321,7 +327,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
||||||
wlr_seat->wl_global = wl_global;
|
wlr_seat->wl_global = wl_global;
|
||||||
wlr_seat->display = display;
|
wlr_seat->display = display;
|
||||||
wlr_seat->name = strdup(name);
|
wlr_seat->name = strdup(name);
|
||||||
wl_list_init(&wlr_seat->handles);
|
wl_list_init(&wlr_seat->clients);
|
||||||
|
|
||||||
wl_signal_init(&wlr_seat->events.client_bound);
|
wl_signal_init(&wlr_seat->events.client_bound);
|
||||||
wl_signal_init(&wlr_seat->events.client_unbound);
|
wl_signal_init(&wlr_seat->events.client_unbound);
|
||||||
|
@ -343,10 +349,10 @@ void wlr_seat_destroy(struct wlr_seat *wlr_seat) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat_handle *handle, *tmp;
|
struct wlr_seat_client *client, *tmp;
|
||||||
wl_list_for_each_safe(handle, tmp, &wlr_seat->handles, link) {
|
wl_list_for_each_safe(client, tmp, &wlr_seat->clients, link) {
|
||||||
// will destroy other resources as well
|
// will destroy other resources as well
|
||||||
wl_resource_destroy(handle->wl_resource);
|
wl_resource_destroy(client->wl_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_global_destroy(wlr_seat->wl_global);
|
wl_global_destroy(wlr_seat->wl_global);
|
||||||
|
@ -357,13 +363,13 @@ void wlr_seat_destroy(struct wlr_seat *wlr_seat) {
|
||||||
free(wlr_seat);
|
free(wlr_seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat_handle *wlr_seat_handle_for_client(struct wlr_seat *wlr_seat,
|
struct wlr_seat_client *wlr_seat_client_for_wl_client(struct wlr_seat *wlr_seat,
|
||||||
struct wl_client *client) {
|
struct wl_client *wl_client) {
|
||||||
assert(wlr_seat);
|
assert(wlr_seat);
|
||||||
struct wlr_seat_handle *handle;
|
struct wlr_seat_client *seat_client;
|
||||||
wl_list_for_each(handle, &wlr_seat->handles, link) {
|
wl_list_for_each(seat_client, &wlr_seat->clients, link) {
|
||||||
if (wl_resource_get_client(handle->wl_resource) == client) {
|
if (seat_client->client == wl_client) {
|
||||||
return handle;
|
return seat_client;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -372,18 +378,18 @@ struct wlr_seat_handle *wlr_seat_handle_for_client(struct wlr_seat *wlr_seat,
|
||||||
void wlr_seat_set_capabilities(struct wlr_seat *wlr_seat,
|
void wlr_seat_set_capabilities(struct wlr_seat *wlr_seat,
|
||||||
uint32_t capabilities) {
|
uint32_t capabilities) {
|
||||||
wlr_seat->capabilities = capabilities;
|
wlr_seat->capabilities = capabilities;
|
||||||
struct wlr_seat_handle *handle;
|
struct wlr_seat_client *client;
|
||||||
wl_list_for_each(handle, &wlr_seat->handles, link) {
|
wl_list_for_each(client, &wlr_seat->clients, link) {
|
||||||
wl_seat_send_capabilities(handle->wl_resource, capabilities);
|
wl_seat_send_capabilities(client->wl_resource, capabilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_seat_set_name(struct wlr_seat *wlr_seat, const char *name) {
|
void wlr_seat_set_name(struct wlr_seat *wlr_seat, const char *name) {
|
||||||
free(wlr_seat->name);
|
free(wlr_seat->name);
|
||||||
wlr_seat->name = strdup(name);
|
wlr_seat->name = strdup(name);
|
||||||
struct wlr_seat_handle *handle;
|
struct wlr_seat_client *client;
|
||||||
wl_list_for_each(handle, &wlr_seat->handles, link) {
|
wl_list_for_each(client, &wlr_seat->clients, link) {
|
||||||
wl_seat_send_name(handle->wl_resource, name);
|
wl_seat_send_name(client->wl_resource, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,8 +419,8 @@ static void pointer_resource_destroy_notify(struct wl_listener *listener,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_seat_pointer_has_focus_resource(struct wlr_seat *wlr_seat) {
|
static bool wlr_seat_pointer_has_focus_resource(struct wlr_seat *wlr_seat) {
|
||||||
return wlr_seat->pointer_state.focused_handle &&
|
return wlr_seat->pointer_state.focused_client &&
|
||||||
wlr_seat->pointer_state.focused_handle->pointer;
|
wlr_seat->pointer_state.focused_client->pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
||||||
|
@ -426,32 +432,32 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat_handle *handle = NULL;
|
struct wlr_seat_client *client = NULL;
|
||||||
|
|
||||||
if (surface) {
|
if (surface) {
|
||||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
struct wl_client *wl_client = wl_resource_get_client(surface->resource);
|
||||||
handle = wlr_seat_handle_for_client(wlr_seat, client);
|
client = wlr_seat_client_for_wl_client(wlr_seat, wl_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat_handle *focused_handle =
|
struct wlr_seat_client *focused_client =
|
||||||
wlr_seat->pointer_state.focused_handle;
|
wlr_seat->pointer_state.focused_client;
|
||||||
struct wlr_surface *focused_surface =
|
struct wlr_surface *focused_surface =
|
||||||
wlr_seat->pointer_state.focused_surface;
|
wlr_seat->pointer_state.focused_surface;
|
||||||
|
|
||||||
// leave the previously entered surface
|
// leave the previously entered surface
|
||||||
if (focused_handle && focused_handle->pointer && focused_surface) {
|
if (focused_client && focused_client->pointer && focused_surface) {
|
||||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||||
wl_pointer_send_leave(focused_handle->pointer, serial,
|
wl_pointer_send_leave(focused_client->pointer, serial,
|
||||||
focused_surface->resource);
|
focused_surface->resource);
|
||||||
pointer_send_frame(focused_handle->pointer);
|
pointer_send_frame(focused_client->pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enter the current surface
|
// enter the current surface
|
||||||
if (handle && handle->pointer) {
|
if (client && client->pointer) {
|
||||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||||
wl_pointer_send_enter(handle->pointer, serial, surface->resource,
|
wl_pointer_send_enter(client->pointer, serial, surface->resource,
|
||||||
wl_fixed_from_double(sx), wl_fixed_from_double(sy));
|
wl_fixed_from_double(sx), wl_fixed_from_double(sy));
|
||||||
pointer_send_frame(handle->pointer);
|
pointer_send_frame(client->pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reinitialize the focus destroy events
|
// reinitialize the focus destroy events
|
||||||
|
@ -470,7 +476,7 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
||||||
pointer_surface_destroy_notify;
|
pointer_surface_destroy_notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_seat->pointer_state.focused_handle = handle;
|
wlr_seat->pointer_state.focused_client = client;
|
||||||
wlr_seat->pointer_state.focused_surface = surface;
|
wlr_seat->pointer_state.focused_surface = surface;
|
||||||
|
|
||||||
// TODO: send focus change event
|
// TODO: send focus change event
|
||||||
|
@ -486,9 +492,9 @@ void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_pointer_send_motion(wlr_seat->pointer_state.focused_handle->pointer,
|
wl_pointer_send_motion(wlr_seat->pointer_state.focused_client->pointer,
|
||||||
time, wl_fixed_from_double(sx), wl_fixed_from_double(sy));
|
time, wl_fixed_from_double(sx), wl_fixed_from_double(sy));
|
||||||
pointer_send_frame(wlr_seat->pointer_state.focused_handle->pointer);
|
pointer_send_frame(wlr_seat->pointer_state.focused_client->pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
|
uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
|
@ -498,9 +504,9 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||||
wl_pointer_send_button(wlr_seat->pointer_state.focused_handle->pointer,
|
wl_pointer_send_button(wlr_seat->pointer_state.focused_client->pointer,
|
||||||
serial, time, button, state);
|
serial, time, button, state);
|
||||||
pointer_send_frame(wlr_seat->pointer_state.focused_handle->pointer);
|
pointer_send_frame(wlr_seat->pointer_state.focused_client->pointer);
|
||||||
return serial;
|
return serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +517,7 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_resource *pointer =
|
struct wl_resource *pointer =
|
||||||
wlr_seat->pointer_state.focused_handle->pointer;
|
wlr_seat->pointer_state.focused_client->pointer;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
wl_pointer_send_axis(pointer, time, orientation,
|
wl_pointer_send_axis(pointer, time, orientation,
|
||||||
|
@ -582,22 +588,22 @@ void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
|
|
||||||
void wlr_seat_keyboard_send_key(struct wlr_seat *wlr_seat, uint32_t time,
|
void wlr_seat_keyboard_send_key(struct wlr_seat *wlr_seat, uint32_t time,
|
||||||
uint32_t key, uint32_t state) {
|
uint32_t key, uint32_t state) {
|
||||||
struct wlr_seat_handle *handle = wlr_seat->keyboard_state.focused_handle;
|
struct wlr_seat_client *client = wlr_seat->keyboard_state.focused_client;
|
||||||
if (!handle || !handle->keyboard) {
|
if (!client || !client->keyboard) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||||
wl_keyboard_send_key(handle->keyboard, serial,
|
wl_keyboard_send_key(client->keyboard, serial,
|
||||||
time, key, state);
|
time, key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_keyboard_keymap(struct wl_listener *listener, void *data) {
|
static void handle_keyboard_keymap(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_seat_keyboard_state *state =
|
struct wlr_seat_keyboard_state *state =
|
||||||
wl_container_of(listener, state, keyboard_keymap);
|
wl_container_of(listener, state, keyboard_keymap);
|
||||||
struct wlr_seat_handle *handle;
|
struct wlr_seat_client *client;
|
||||||
wl_list_for_each(handle, &state->wlr_seat->handles, link) {
|
wl_list_for_each(client, &state->wlr_seat->clients, link) {
|
||||||
seat_handle_send_keymap(handle, state->keyboard);
|
seat_client_send_keymap(client, state->keyboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,9 +638,9 @@ void wlr_seat_set_keyboard(struct wlr_seat *seat,
|
||||||
&seat->keyboard_state.keyboard_keymap);
|
&seat->keyboard_state.keyboard_keymap);
|
||||||
seat->keyboard_state.keyboard_keymap.notify = handle_keyboard_keymap;
|
seat->keyboard_state.keyboard_keymap.notify = handle_keyboard_keymap;
|
||||||
|
|
||||||
struct wlr_seat_handle *handle;
|
struct wlr_seat_client *client;
|
||||||
wl_list_for_each(handle, &seat->handles, link) {
|
wl_list_for_each(client, &seat->clients, link) {
|
||||||
seat_handle_send_keymap(handle, device->keyboard);
|
seat_client_send_keymap(client, device->keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
seat->keyboard_state.keyboard = device->keyboard;
|
seat->keyboard_state.keyboard = device->keyboard;
|
||||||
|
@ -681,14 +687,14 @@ static void keyboard_resource_destroy_notify(struct wl_listener *listener,
|
||||||
void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
|
void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
|
||||||
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
|
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
|
||||||
uint32_t group) {
|
uint32_t group) {
|
||||||
struct wlr_seat_handle *handle = seat->keyboard_state.focused_handle;
|
struct wlr_seat_client *client = seat->keyboard_state.focused_client;
|
||||||
if (!handle || !handle->keyboard) {
|
if (!client || !client->keyboard) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t serial = wl_display_next_serial(seat->display);
|
uint32_t serial = wl_display_next_serial(seat->display);
|
||||||
|
|
||||||
wl_keyboard_send_modifiers(handle->keyboard, serial,
|
wl_keyboard_send_modifiers(client->keyboard, serial,
|
||||||
mods_depressed, mods_latched,
|
mods_depressed, mods_latched,
|
||||||
mods_locked, group);
|
mods_locked, group);
|
||||||
}
|
}
|
||||||
|
@ -700,35 +706,35 @@ void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat_handle *handle = NULL;
|
struct wlr_seat_client *client = NULL;
|
||||||
|
|
||||||
if (surface) {
|
if (surface) {
|
||||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
struct wl_client *wl_client = wl_resource_get_client(surface->resource);
|
||||||
handle = wlr_seat_handle_for_client(wlr_seat, client);
|
client = wlr_seat_client_for_wl_client(wlr_seat, wl_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_seat_handle *focused_handle =
|
struct wlr_seat_client *focused_client =
|
||||||
wlr_seat->keyboard_state.focused_handle;
|
wlr_seat->keyboard_state.focused_client;
|
||||||
struct wlr_surface *focused_surface =
|
struct wlr_surface *focused_surface =
|
||||||
wlr_seat->keyboard_state.focused_surface;
|
wlr_seat->keyboard_state.focused_surface;
|
||||||
|
|
||||||
// leave the previously entered surface
|
// leave the previously entered surface
|
||||||
if (focused_handle && focused_handle->keyboard && focused_surface) {
|
if (focused_client && focused_client->keyboard && focused_surface) {
|
||||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||||
wl_keyboard_send_leave(focused_handle->keyboard, serial,
|
wl_keyboard_send_leave(focused_client->keyboard, serial,
|
||||||
focused_surface->resource);
|
focused_surface->resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enter the current surface
|
// enter the current surface
|
||||||
if (handle && handle->keyboard) {
|
if (client && client->keyboard) {
|
||||||
// TODO: read the currently pressed keys out of the active keyboard and
|
// TODO: read the currently pressed keys out of the active keyboard and
|
||||||
// put them in this array
|
// put them in this array
|
||||||
struct wl_array keys;
|
struct wl_array keys;
|
||||||
wl_array_init(&keys);
|
wl_array_init(&keys);
|
||||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||||
wl_keyboard_send_enter(handle->keyboard, serial,
|
wl_keyboard_send_enter(client->keyboard, serial,
|
||||||
surface->resource, &keys);
|
surface->resource, &keys);
|
||||||
wlr_seat_handle_send_selection(handle);
|
wlr_seat_client_send_selection(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reinitialize the focus destroy events
|
// reinitialize the focus destroy events
|
||||||
|
@ -747,7 +753,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
|
||||||
keyboard_surface_destroy_notify;
|
keyboard_surface_destroy_notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_seat->keyboard_state.focused_handle = handle;
|
wlr_seat->keyboard_state.focused_client = client;
|
||||||
wlr_seat->keyboard_state.focused_surface = surface;
|
wlr_seat->keyboard_state.focused_surface = surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -315,12 +315,12 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
|
||||||
uint32_t serial, struct wl_resource *parent_resource, int32_t x,
|
uint32_t serial, struct wl_resource *parent_resource, int32_t x,
|
||||||
int32_t y, enum wl_shell_surface_transient flags) {
|
int32_t y, enum wl_shell_surface_transient flags) {
|
||||||
struct wlr_wl_shell_surface *surface = wl_resource_get_user_data(resource);
|
struct wlr_wl_shell_surface *surface = wl_resource_get_user_data(resource);
|
||||||
struct wlr_seat_handle *seat_handle =
|
struct wlr_seat_client *seat_client =
|
||||||
wl_resource_get_user_data(seat_resource);
|
wl_resource_get_user_data(seat_resource);
|
||||||
struct wlr_surface *parent =
|
struct wlr_surface *parent =
|
||||||
wl_resource_get_user_data(parent_resource);
|
wl_resource_get_user_data(parent_resource);
|
||||||
struct wlr_wl_shell_popup_grab *grab =
|
struct wlr_wl_shell_popup_grab *grab =
|
||||||
shell_popup_grab_from_seat(surface->shell, seat_handle->wlr_seat);
|
shell_popup_grab_from_seat(surface->shell, seat_client->wlr_seat);
|
||||||
if (!grab) {
|
if (!grab) {
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
|
@ -335,7 +335,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
|
||||||
shell_surface_popup_set_parent(surface, wl_parent);
|
shell_surface_popup_set_parent(surface, wl_parent);
|
||||||
grab->client = surface->client;
|
grab->client = surface->client;
|
||||||
surface->popup_mapped = true;
|
surface->popup_mapped = true;
|
||||||
wlr_seat_pointer_start_grab(seat_handle->wlr_seat, &grab->pointer_grab);
|
wlr_seat_pointer_start_grab(seat_client->wlr_seat, &grab->pointer_grab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
popup_state->seat = seat_handle->wlr_seat;
|
popup_state->seat = seat_client->wlr_seat;
|
||||||
popup_state->serial = serial;
|
popup_state->serial = serial;
|
||||||
|
|
||||||
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_POPUP,
|
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_POPUP,
|
||||||
|
@ -366,7 +366,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
|
||||||
grab->client = surface->client;
|
grab->client = surface->client;
|
||||||
wl_list_insert(&grab->popups, &surface->grab_link);
|
wl_list_insert(&grab->popups, &surface->grab_link);
|
||||||
surface->popup_mapped = true;
|
surface->popup_mapped = true;
|
||||||
wlr_seat_pointer_start_grab(seat_handle->wlr_seat, &grab->pointer_grab);
|
wlr_seat_pointer_start_grab(seat_client->wlr_seat, &grab->pointer_grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shell_surface_protocol_set_maximized(struct wl_client *client,
|
static void shell_surface_protocol_set_maximized(struct wl_client *client,
|
||||||
|
|
|
@ -357,7 +357,7 @@ static void xdg_popup_protocol_grab(struct wl_client *client,
|
||||||
struct wl_resource *resource, struct wl_resource *seat_resource,
|
struct wl_resource *resource, struct wl_resource *seat_resource,
|
||||||
uint32_t serial) {
|
uint32_t serial) {
|
||||||
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(seat_resource);
|
struct wlr_seat_client *seat_client = wl_resource_get_user_data(seat_resource);
|
||||||
|
|
||||||
if (surface->popup_state->committed) {
|
if (surface->popup_state->committed) {
|
||||||
wl_resource_post_error(surface->popup_state->resource,
|
wl_resource_post_error(surface->popup_state->resource,
|
||||||
|
@ -368,7 +368,7 @@ static void xdg_popup_protocol_grab(struct wl_client *client,
|
||||||
|
|
||||||
struct wlr_xdg_popup_grab_v6 *popup_grab =
|
struct wlr_xdg_popup_grab_v6 *popup_grab =
|
||||||
xdg_shell_popup_grab_from_seat(surface->client->shell,
|
xdg_shell_popup_grab_from_seat(surface->client->shell,
|
||||||
handle->wlr_seat);
|
seat_client->wlr_seat);
|
||||||
|
|
||||||
struct wlr_xdg_surface_v6 *topmost = xdg_popup_grab_get_topmost(popup_grab);
|
struct wlr_xdg_surface_v6 *topmost = xdg_popup_grab_get_topmost(popup_grab);
|
||||||
bool parent_is_toplevel =
|
bool parent_is_toplevel =
|
||||||
|
@ -383,12 +383,14 @@ static void xdg_popup_protocol_grab(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
popup_grab->client = surface->client->client;
|
popup_grab->client = surface->client->client;
|
||||||
surface->popup_state->seat = handle->wlr_seat;
|
surface->popup_state->seat = seat_client->wlr_seat;
|
||||||
|
|
||||||
wl_list_insert(&popup_grab->popups, &surface->popup_state->grab_link);
|
wl_list_insert(&popup_grab->popups, &surface->popup_state->grab_link);
|
||||||
|
|
||||||
wlr_seat_pointer_start_grab(handle->wlr_seat, &popup_grab->pointer_grab);
|
wlr_seat_pointer_start_grab(seat_client->wlr_seat,
|
||||||
wlr_seat_keyboard_start_grab(handle->wlr_seat, &popup_grab->keyboard_grab);
|
&popup_grab->pointer_grab);
|
||||||
|
wlr_seat_keyboard_start_grab(seat_client->wlr_seat,
|
||||||
|
&popup_grab->keyboard_grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zxdg_popup_v6_interface zxdg_popup_v6_implementation = {
|
static const struct zxdg_popup_v6_interface zxdg_popup_v6_implementation = {
|
||||||
|
|
Loading…
Reference in a new issue