From d1b979d9bd858c45e9ee23a418a390e0ea4ed0cc Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Mon, 9 Oct 2023 22:12:46 +0100 Subject: ext-action-binder-v1: new protocol implementation Signed-off-by: Anna (navi) Figueiredo Gomes --- include/wlr/types/wlr_action_binder_v1.h | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 include/wlr/types/wlr_action_binder_v1.h (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_action_binder_v1.h b/include/wlr/types/wlr_action_binder_v1.h new file mode 100644 index 00000000..d93f6dc4 --- /dev/null +++ b/include/wlr/types/wlr_action_binder_v1.h @@ -0,0 +1,64 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + +#ifndef WLR_TYPES_WLR_ACTION_BINDER_V1_H +#define WLR_TYPES_WLR_ACTION_BINDER_V1_H + +#include +#include +#include "ext-action-binder-v1-protocol.h" + +struct wlr_action_binder_v1 { + struct wl_global *global; + struct wl_list states; // wlr_action_binder_v1_state.link + struct wl_listener display_destroy; + + struct { + struct wl_signal bind; + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_action_binder_v1_state { + struct wl_list binds; // wlr_action_binding_v1.link + struct wl_list bind_queue; // wlr_action_binding_v1.link + struct wlr_action_binder_v1 *binder; + struct wl_resource *resource; + + struct wl_list link; +}; + +struct wlr_action_binding_v1 { + struct wl_resource *resource; + struct wlr_action_binder_v1_state *state; + + char *namespace, *name; + + char *description; // may be NULL when the client doesn't set a description + char *trigger_kind, *trigger; // may be NULL when the client doesn't set a trigger hint + char *app_id; // may be NULL when the client doesn't set an app_id + struct wlr_seat *seat; // may be NULL when the client doesn't set a seat + struct wl_listener seat_destroy; + + struct { + struct wl_signal destroy; + } events; + + bool bound; + struct wl_list link; +}; + +struct wlr_action_binder_v1 *wlr_action_binder_v1_create(struct wl_display *display); +void wlr_action_binding_v1_bind(struct wlr_action_binding_v1 *bind, const char *trigger); +void wlr_action_binding_v1_reject(struct wlr_action_binding_v1 *bind); +void wlr_action_binding_v1_trigger(struct wlr_action_binding_v1 *binding, uint32_t trigger_type, uint32_t time_msec); +void wlr_action_binding_v1_trigger_now(struct wlr_action_binding_v1 *binding, uint32_t trigger_type); + +#endif -- cgit v1.2.3