mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-25 01:40:56 -05:00
seat: expose more from_resource() functions
This commit is contained in:
parent
fb739b8293
commit
c22bc0b386
3 changed files with 24 additions and 13 deletions
|
|
@ -627,10 +627,21 @@ bool wlr_seat_validate_touch_grab_serial(struct wlr_seat *seat,
|
||||||
struct wlr_seat_client *wlr_seat_client_from_resource(
|
struct wlr_seat_client *wlr_seat_client_from_resource(
|
||||||
struct wl_resource *resource);
|
struct wl_resource *resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a seat client from a keyboard resource. Returns NULL if inert.
|
||||||
|
*/
|
||||||
|
struct wlr_seat_client *wlr_seat_client_from_keyboard_resource(
|
||||||
|
struct wl_resource *resource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a seat client from a pointer resource. Returns NULL if inert.
|
* Get a seat client from a pointer resource. Returns NULL if inert.
|
||||||
*/
|
*/
|
||||||
struct wlr_seat_client *wlr_seat_client_from_pointer_resource(
|
struct wlr_seat_client *wlr_seat_client_from_pointer_resource(
|
||||||
struct wl_resource *resource);
|
struct wl_resource *resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a seat client from a touch resource. Returns NULL if inert.
|
||||||
|
*/
|
||||||
|
struct wlr_seat_client *wlr_seat_client_from_touch_resource(
|
||||||
|
struct wl_resource *resource);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ static const struct wl_keyboard_interface keyboard_impl = {
|
||||||
.release = keyboard_release,
|
.release = keyboard_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wlr_seat_client *seat_client_from_keyboard_resource(
|
struct wlr_seat_client *wlr_seat_client_from_keyboard_resource(
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
assert(wl_resource_instance_of(resource, &wl_keyboard_interface,
|
assert(wl_resource_instance_of(resource, &wl_keyboard_interface,
|
||||||
&keyboard_impl));
|
&keyboard_impl));
|
||||||
|
|
@ -75,7 +75,7 @@ void wlr_seat_keyboard_send_key(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);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &client->keyboards) {
|
wl_resource_for_each(resource, &client->keyboards) {
|
||||||
if (seat_client_from_keyboard_resource(resource) == NULL) {
|
if (wlr_seat_client_from_keyboard_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,7 +204,7 @@ void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
|
||||||
uint32_t serial = wl_display_next_serial(seat->display);
|
uint32_t serial = wl_display_next_serial(seat->display);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &client->keyboards) {
|
wl_resource_for_each(resource, &client->keyboards) {
|
||||||
if (seat_client_from_keyboard_resource(resource) == NULL) {
|
if (wlr_seat_client_from_keyboard_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,7 +243,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
||||||
uint32_t serial = wl_display_next_serial(seat->display);
|
uint32_t serial = wl_display_next_serial(seat->display);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &focused_client->keyboards) {
|
wl_resource_for_each(resource, &focused_client->keyboards) {
|
||||||
if (seat_client_from_keyboard_resource(resource) == NULL) {
|
if (wlr_seat_client_from_keyboard_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wl_keyboard_send_leave(resource, serial, focused_surface->resource);
|
wl_keyboard_send_leave(resource, serial, focused_surface->resource);
|
||||||
|
|
@ -266,7 +266,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
||||||
uint32_t serial = wl_display_next_serial(seat->display);
|
uint32_t serial = wl_display_next_serial(seat->display);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &client->keyboards) {
|
wl_resource_for_each(resource, &client->keyboards) {
|
||||||
if (seat_client_from_keyboard_resource(resource) == NULL) {
|
if (wlr_seat_client_from_keyboard_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wl_keyboard_send_enter(resource, serial, surface->resource, &keys);
|
wl_keyboard_send_enter(resource, serial, surface->resource, &keys);
|
||||||
|
|
@ -344,7 +344,7 @@ static void seat_client_send_keymap(struct wlr_seat_client *client,
|
||||||
// keyboard
|
// keyboard
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &client->keyboards) {
|
wl_resource_for_each(resource, &client->keyboards) {
|
||||||
if (seat_client_from_keyboard_resource(resource) == NULL) {
|
if (wlr_seat_client_from_keyboard_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -381,7 +381,7 @@ static void seat_client_send_repeat_info(struct wlr_seat_client *client,
|
||||||
|
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &client->keyboards) {
|
wl_resource_for_each(resource, &client->keyboards) {
|
||||||
if (seat_client_from_keyboard_resource(resource) == NULL) {
|
if (wlr_seat_client_from_keyboard_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -415,7 +415,7 @@ void seat_client_create_keyboard(struct wlr_seat_client *seat_client,
|
||||||
|
|
||||||
void seat_client_destroy_keyboard(struct wl_resource *resource) {
|
void seat_client_destroy_keyboard(struct wl_resource *resource) {
|
||||||
struct wlr_seat_client *seat_client =
|
struct wlr_seat_client *seat_client =
|
||||||
seat_client_from_keyboard_resource(resource);
|
wlr_seat_client_from_keyboard_resource(resource);
|
||||||
if (seat_client == NULL) {
|
if (seat_client == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ static void touch_handle_resource_destroy(struct wl_resource *resource) {
|
||||||
seat_client_destroy_touch(resource);
|
seat_client_destroy_touch(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_seat_client *seat_client_from_touch_resource(
|
struct wlr_seat_client *wlr_seat_client_from_touch_resource(
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
assert(wl_resource_instance_of(resource, &wl_touch_interface,
|
assert(wl_resource_instance_of(resource, &wl_touch_interface,
|
||||||
&touch_impl));
|
&touch_impl));
|
||||||
|
|
@ -281,7 +281,7 @@ uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
|
||||||
uint32_t serial = wl_display_next_serial(seat->display);
|
uint32_t serial = wl_display_next_serial(seat->display);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &point->client->touches) {
|
wl_resource_for_each(resource, &point->client->touches) {
|
||||||
if (seat_client_from_touch_resource(resource) == NULL) {
|
if (wlr_seat_client_from_touch_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wl_touch_send_down(resource, serial, time, surface->resource,
|
wl_touch_send_down(resource, serial, time, surface->resource,
|
||||||
|
|
@ -302,7 +302,7 @@ void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time, int32_t touch_
|
||||||
uint32_t serial = wl_display_next_serial(seat->display);
|
uint32_t serial = wl_display_next_serial(seat->display);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &point->client->touches) {
|
wl_resource_for_each(resource, &point->client->touches) {
|
||||||
if (seat_client_from_touch_resource(resource) == NULL) {
|
if (wlr_seat_client_from_touch_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wl_touch_send_up(resource, serial, time, touch_id);
|
wl_touch_send_up(resource, serial, time, touch_id);
|
||||||
|
|
@ -320,7 +320,7 @@ void wlr_seat_touch_send_motion(struct wlr_seat *seat, uint32_t time, int32_t to
|
||||||
|
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &point->client->touches) {
|
wl_resource_for_each(resource, &point->client->touches) {
|
||||||
if (seat_client_from_touch_resource(resource) == NULL) {
|
if (wlr_seat_client_from_touch_resource(resource) == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wl_touch_send_motion(resource, time, touch_id, wl_fixed_from_double(sx),
|
wl_touch_send_motion(resource, time, touch_id, wl_fixed_from_double(sx),
|
||||||
|
|
@ -353,7 +353,7 @@ void seat_client_create_touch(struct wlr_seat_client *seat_client,
|
||||||
|
|
||||||
void seat_client_destroy_touch(struct wl_resource *resource) {
|
void seat_client_destroy_touch(struct wl_resource *resource) {
|
||||||
struct wlr_seat_client *seat_client =
|
struct wlr_seat_client *seat_client =
|
||||||
seat_client_from_touch_resource(resource);
|
wlr_seat_client_from_touch_resource(resource);
|
||||||
if (seat_client == NULL) {
|
if (seat_client == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue