2022-01-05 09:11:24 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2023-05-13 16:10:33 +03:00
|
|
|
#ifndef LABWC_ACTION_H
|
|
|
|
|
#define LABWC_ACTION_H
|
2022-01-05 09:11:24 +01:00
|
|
|
|
2024-04-22 04:58:57 +09:00
|
|
|
#include <stdbool.h>
|
2024-12-20 10:14:32 +01:00
|
|
|
#include <sys/types.h>
|
2022-11-22 11:59:54 -05:00
|
|
|
#include <wayland-util.h>
|
|
|
|
|
|
2022-01-05 21:27:47 +00:00
|
|
|
struct view;
|
2022-06-10 19:42:34 +02:00
|
|
|
struct server;
|
2024-09-21 01:11:27 +09:00
|
|
|
struct cursor_context;
|
2022-01-05 21:27:47 +00:00
|
|
|
|
2022-01-05 09:11:24 +01:00
|
|
|
struct action {
|
2022-11-03 19:58:21 +00:00
|
|
|
struct wl_list link; /*
|
|
|
|
|
* struct keybinding.actions
|
|
|
|
|
* struct mousebinding.actions
|
|
|
|
|
* struct menuitem.actions
|
|
|
|
|
*/
|
2022-06-10 19:42:34 +02:00
|
|
|
|
|
|
|
|
uint32_t type; /* enum action_type */
|
|
|
|
|
struct wl_list args; /* struct action_arg.link */
|
2022-01-05 09:11:24 +01:00
|
|
|
};
|
|
|
|
|
|
2022-01-05 21:23:01 +00:00
|
|
|
struct action *action_create(const char *action_name);
|
2023-03-26 10:57:53 +01:00
|
|
|
|
2023-05-13 15:57:37 +02:00
|
|
|
bool action_is_valid(struct action *action);
|
2025-02-08 01:32:35 +09:00
|
|
|
bool action_is_show_menu(struct action *action);
|
2023-05-13 15:57:37 +02:00
|
|
|
|
2023-05-12 14:33:12 +02:00
|
|
|
void action_arg_add_str(struct action *action, const char *key, const char *value);
|
2023-08-28 19:14:04 +03:00
|
|
|
void action_arg_add_actionlist(struct action *action, const char *key);
|
|
|
|
|
void action_arg_add_querylist(struct action *action, const char *key);
|
|
|
|
|
|
|
|
|
|
struct wl_list *action_get_actionlist(struct action *action, const char *key);
|
|
|
|
|
struct wl_list *action_get_querylist(struct action *action, const char *key);
|
2023-03-26 10:57:53 +01:00
|
|
|
|
2023-08-06 10:26:04 +02:00
|
|
|
void action_arg_from_xml_node(struct action *action, const char *nodename, const char *content);
|
2022-12-10 15:28:25 +01:00
|
|
|
|
2023-03-03 18:16:46 +01:00
|
|
|
bool actions_contain_toggle_keybinds(struct wl_list *action_list);
|
|
|
|
|
|
2024-09-21 01:11:27 +09:00
|
|
|
/**
|
|
|
|
|
* actions_run() - Run actions.
|
|
|
|
|
* @activator: Target view to apply actions (e.g. Maximize, Focus etc.).
|
|
|
|
|
* NULL is allowed, in which case the focused/hovered view is used.
|
|
|
|
|
* @ctx: Set for action invocations via mousebindings. Used to get the
|
|
|
|
|
* direction of resize or the position of the window menu button for ShowMenu
|
|
|
|
|
* action.
|
|
|
|
|
*/
|
2022-02-24 02:16:19 +01:00
|
|
|
void actions_run(struct view *activator, struct server *server,
|
2024-09-21 01:11:27 +09:00
|
|
|
struct wl_list *actions, struct cursor_context *ctx);
|
2023-05-13 16:27:46 +02:00
|
|
|
|
2024-12-20 10:14:32 +01:00
|
|
|
bool action_check_prompt_result(pid_t pid, int exit_code);
|
|
|
|
|
|
2023-05-13 16:27:46 +02:00
|
|
|
void action_free(struct action *action);
|
2022-06-10 19:42:34 +02:00
|
|
|
void action_list_free(struct wl_list *action_list);
|
2022-01-05 21:27:47 +00:00
|
|
|
|
2023-05-13 16:10:33 +03:00
|
|
|
#endif /* LABWC_ACTION_H */
|