diff options
author | David96 <david@hameipe.de> | 2020-05-02 15:09:36 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-05-02 18:25:47 +0200 |
commit | e3343cf7d1e0d8c429046887b4fc90be35b9cfba (patch) | |
tree | 621588112455260aeb9615cf54d69bf0a8817210 | |
parent | 11e94c406bb75c9a8990ce99489798411deb110c (diff) |
Add wlr_surface_accepts_touch
-rw-r--r-- | include/wlr/types/wlr_seat.h | 5 | ||||
-rw-r--r-- | types/seat/wlr_seat_touch.c | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 1b912875..949cd419 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -678,4 +678,9 @@ struct wlr_seat_client *wlr_seat_client_from_resource( struct wlr_seat_client *wlr_seat_client_from_pointer_resource( struct wl_resource *resource); +/** + * Check whether a surface has bound to touch events. + */ +bool wlr_surface_accepts_touch(struct wlr_seat *wlr_seat, struct wlr_surface *surface); + #endif diff --git a/types/seat/wlr_seat_touch.c b/types/seat/wlr_seat_touch.c index b0228976..f0dee5da 100644 --- a/types/seat/wlr_seat_touch.c +++ b/types/seat/wlr_seat_touch.c @@ -403,3 +403,12 @@ bool wlr_seat_validate_touch_grab_serial(struct wlr_seat *seat, "invalid origin surface"); return false; } + +bool wlr_surface_accepts_touch(struct wlr_seat *wlr_seat, struct wlr_surface *surface) { + struct wl_client *client = wl_resource_get_client(surface->resource); + struct wlr_seat_client *seat_client = wlr_seat_client_for_wl_client(wlr_seat, client); + if (!seat_client) { + return false; + } + return !wl_list_empty(&seat_client->touches); +} |