seat: expose more from_resource() functions

This commit is contained in:
random human 2019-06-14 19:02:13 +00:00
parent fb739b8293
commit c22bc0b386
No known key found for this signature in database
GPG key ID: 73E5A60444CC77A3
3 changed files with 24 additions and 13 deletions

View file

@ -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 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.
*/
struct wlr_seat_client *wlr_seat_client_from_pointer_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

View file

@ -52,7 +52,7 @@ static const struct wl_keyboard_interface keyboard_impl = {
.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) {
assert(wl_resource_instance_of(resource, &wl_keyboard_interface,
&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);
struct wl_resource *resource;
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;
}
@ -204,7 +204,7 @@ void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
uint32_t serial = wl_display_next_serial(seat->display);
struct wl_resource *resource;
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;
}
@ -243,7 +243,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
uint32_t serial = wl_display_next_serial(seat->display);
struct wl_resource *resource;
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;
}
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);
struct wl_resource *resource;
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;
}
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
struct wl_resource *resource;
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;
}
@ -381,7 +381,7 @@ static void seat_client_send_repeat_info(struct wlr_seat_client *client,
struct wl_resource *resource;
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;
}
@ -415,7 +415,7 @@ void seat_client_create_keyboard(struct wlr_seat_client *seat_client,
void seat_client_destroy_keyboard(struct wl_resource *resource) {
struct wlr_seat_client *seat_client =
seat_client_from_keyboard_resource(resource);
wlr_seat_client_from_keyboard_resource(resource);
if (seat_client == NULL) {
return;
}

View file

@ -60,7 +60,7 @@ static void touch_handle_resource_destroy(struct wl_resource *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) {
assert(wl_resource_instance_of(resource, &wl_touch_interface,
&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);
struct wl_resource *resource;
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;
}
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);
struct wl_resource *resource;
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;
}
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;
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;
}
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) {
struct wlr_seat_client *seat_client =
seat_client_from_touch_resource(resource);
wlr_seat_client_from_touch_resource(resource);
if (seat_client == NULL) {
return;
}