From a05965afe5121095f5a2e23b80121a2cf48a8677 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 8 Apr 2024 19:59:44 +0200 Subject: [PATCH] ext-image-capture-source-v1: add source pointer cursors --- .../wlr_ext_image_capture_source_v1.h | 7 +++++++ .../types/wlr_ext_image_capture_source_v1.h | 20 +++++++++++++++++++ types/ext_image_capture_source_v1/base.c | 11 ++++++++++ 3 files changed, 38 insertions(+) diff --git a/include/wlr/interfaces/wlr_ext_image_capture_source_v1.h b/include/wlr/interfaces/wlr_ext_image_capture_source_v1.h index 239e515c..49737ac3 100644 --- a/include/wlr/interfaces/wlr_ext_image_capture_source_v1.h +++ b/include/wlr/interfaces/wlr_ext_image_capture_source_v1.h @@ -13,12 +13,15 @@ #include struct wlr_ext_image_copy_capture_frame_v1; +struct wlr_seat; struct wlr_ext_image_capture_source_v1_interface { void (*schedule_frame)(struct wlr_ext_image_capture_source_v1 *source); void (*copy_frame)(struct wlr_ext_image_capture_source_v1 *source, struct wlr_ext_image_copy_capture_frame_v1 *dst_frame, struct wlr_ext_image_capture_source_v1_frame_event *frame_event); + struct wlr_ext_image_capture_source_v1_cursor *(*get_pointer_cursor)( + struct wlr_ext_image_capture_source_v1 *source, struct wlr_seat *seat); }; void wlr_ext_image_capture_source_v1_init(struct wlr_ext_image_capture_source_v1 *source, @@ -27,4 +30,8 @@ void wlr_ext_image_capture_source_v1_finish(struct wlr_ext_image_capture_source_ bool wlr_ext_image_capture_source_v1_create_resource(struct wlr_ext_image_capture_source_v1 *source, struct wl_client *client, uint32_t new_id); +void wlr_ext_image_capture_source_v1_cursor_init(struct wlr_ext_image_capture_source_v1_cursor *source_cursor, + const struct wlr_ext_image_capture_source_v1_interface *impl); +void wlr_ext_image_capture_source_v1_cursor_finish(struct wlr_ext_image_capture_source_v1_cursor *source_cursor); + #endif diff --git a/include/wlr/types/wlr_ext_image_capture_source_v1.h b/include/wlr/types/wlr_ext_image_capture_source_v1.h index 5405bf01..4247dd29 100644 --- a/include/wlr/types/wlr_ext_image_capture_source_v1.h +++ b/include/wlr/types/wlr_ext_image_capture_source_v1.h @@ -48,6 +48,26 @@ struct wlr_ext_image_capture_source_v1_frame_event { const pixman_region32_t *damage; }; +/** + * A cursor capture source. + * + * Provides additional cursor-specific functionality on top of + * struct wlr_ext_image_capture_source_v1. + */ +struct wlr_ext_image_capture_source_v1_cursor { + struct wlr_ext_image_capture_source_v1 base; + + bool entered; + int32_t x, y; + struct { + int32_t x, y; + } hotspot; + + struct { + struct wl_signal update; + } events; +}; + /** * Obtain a struct wlr_ext_image_capture_source_v1 from an ext_image_capture_source_v1 * resource. diff --git a/types/ext_image_capture_source_v1/base.c b/types/ext_image_capture_source_v1/base.c index 1b45da75..9c15ea0b 100644 --- a/types/ext_image_capture_source_v1/base.c +++ b/types/ext_image_capture_source_v1/base.c @@ -65,3 +65,14 @@ bool wlr_ext_image_capture_source_v1_create_resource(struct wlr_ext_image_captur } return true; } + +void wlr_ext_image_capture_source_v1_cursor_init(struct wlr_ext_image_capture_source_v1_cursor *source_cursor, + const struct wlr_ext_image_capture_source_v1_interface *impl) { + *source_cursor = (struct wlr_ext_image_capture_source_v1_cursor){0}; + wlr_ext_image_capture_source_v1_init(&source_cursor->base, impl); + wl_signal_init(&source_cursor->events.update); +} + +void wlr_ext_image_capture_source_v1_cursor_finish(struct wlr_ext_image_capture_source_v1_cursor *source_cursor) { + wlr_ext_image_capture_source_v1_finish(&source_cursor->base); +}