action-binder-v1: update protocol

Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
This commit is contained in:
Anna (navi) Figueiredo Gomes 2024-03-03 21:56:50 +01:00
parent 44a2cff3b3
commit 52d0f4d6ca
4 changed files with 12 additions and 10 deletions

View file

@ -115,7 +115,6 @@ struct sway_server {
struct wlr_action_binder_v1 *action_binder; struct wlr_action_binder_v1 *action_binder;
struct wl_listener action_binder_bind; struct wl_listener action_binder_bind;
struct wl_listener action_binder_unbind;
struct wl_listener action_binder_destroy; struct wl_listener action_binder_destroy;
struct wl_list pending_launcher_ctxs; // launcher_ctx::link struct wl_list pending_launcher_ctxs; // launcher_ctx::link

View file

@ -1,15 +1,15 @@
#include <wlr/types/wlr_action_binder_v1.h> #include <wlr/types/wlr_action_binder_v1.h>
#include "stringop.h"
void action_binder_v1_bind(struct wl_listener *listener, void *data) { void action_binder_v1_bind(struct wl_listener *listener, void *data) {
struct wlr_action_binder_v1_state *state = data; struct wlr_action_binder_v1_state *state = data;
struct wlr_action_binding_v1 *binding = NULL, *tmp = NULL; struct wlr_action_binding_v1 *binding = NULL, *tmp = NULL;
wl_list_for_each_safe(binding, tmp, &state->bind_queue, link) { wl_list_for_each_safe(binding, tmp, &state->bind_queue, link) {
wlr_action_binder_v1_bind(binding, ""); char *msg = format_str("User defined trigger for %s:%s in the config file.",
binding->namespace, binding->name);
wlr_action_binding_v1_bind(binding, msg ? msg : "");
} }
} }
void action_binder_v1_unbind(struct wl_listener *listener, void *data) {
}
void action_binder_v1_delete(struct wl_listener *listener, void *data) { void action_binder_v1_delete(struct wl_listener *listener, void *data) {
} }

View file

@ -11,8 +11,13 @@ struct cmd_results *cmd_action(int argc, char **argv) {
return error; return error;
} }
wlr_action_binder_v1_trigger(server.action_binder, argv[0], argv[1], struct wlr_action_binder_v1_state *state = NULL;
EXT_ACTION_BINDING_V1_TRIGGER_TYPE_ONE_SHOT); struct wlr_action_binding_v1 *binding = NULL;
wl_list_for_each(state, &server.action_binder->states, link) {
wl_list_for_each(binding, &state->binds, link) {
wlr_action_binding_v1_trigger(binding, EXT_ACTION_BINDING_V1_TRIGGER_TYPE_ONE_SHOT, 0);
}
}
return cmd_results_new(CMD_SUCCESS, NULL); return cmd_results_new(CMD_SUCCESS, NULL);
} }

View file

@ -9,6 +9,7 @@
#include <wlr/config.h> #include <wlr/config.h>
#include <wlr/render/allocator.h> #include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_action_binder_v1.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_content_type_v1.h> #include <wlr/types/wlr_content_type_v1.h>
#include <wlr/types/wlr_cursor_shape_v1.h> #include <wlr/types/wlr_cursor_shape_v1.h>
@ -354,9 +355,6 @@ bool server_init(struct sway_server *server) {
server->action_binder_bind.notify = action_binder_v1_bind; server->action_binder_bind.notify = action_binder_v1_bind;
wl_signal_add(&server->action_binder->events.bind, wl_signal_add(&server->action_binder->events.bind,
&server->action_binder_bind); &server->action_binder_bind);
server->action_binder_unbind.notify = action_binder_v1_unbind;
wl_signal_add(&server->action_binder->events.unbind,
&server->action_binder_unbind);
server->action_binder_destroy.notify = action_binder_v1_delete; server->action_binder_destroy.notify = action_binder_v1_delete;
wl_signal_add(&server->action_binder->events.destroy, wl_signal_add(&server->action_binder->events.destroy,
&server->action_binder_destroy); &server->action_binder_destroy);