src/action.c: Convert action->arg to a list of action_arg

In preperation for Actions that require multiple arguments
This commit is contained in:
Consolatis 2022-06-10 19:42:34 +02:00 committed by Johan Malm
parent baaee26937
commit 9b49f19a73
8 changed files with 142 additions and 61 deletions

View file

@ -2,19 +2,23 @@
#ifndef __LABWC_ACTION_H
#define __LABWC_ACTION_H
struct server;
struct view;
struct server;
struct wl_list;
struct action {
uint32_t type;
char *arg;
struct wl_list link;
struct wl_list link; /* struct keybinding.actions,
* struct mousebinding.actions,
* struct menuitem.actions */
uint32_t type; /* enum action_type */
struct wl_list args; /* struct action_arg.link */
};
struct action *action_create(const char *action_name);
void action_list_free(struct wl_list *action_list);
void action_arg_add_str(struct action *action, char *key, const char *value);
void actions_run(struct view *activator, struct server *server,
struct wl_list *actions, uint32_t resize_edges);
void action_list_free(struct wl_list *action_list);
#endif
#endif /* __LABWC_ACTION_H */

View file

@ -11,8 +11,8 @@ struct keybind {
uint32_t modifiers;
xkb_keysym_t *keysyms;
size_t keysyms_len;
struct wl_list actions;
struct wl_list link;
struct wl_list actions; /* struct action.link */
struct wl_list link; /* struct rcxml.keybinds */
};
/**

View file

@ -26,9 +26,9 @@ struct mousebind {
/* ex: doubleclick, press, drag */
enum mouse_event mouse_event;
struct wl_list actions;
struct wl_list actions; /* struct action.link */
struct wl_list link; /* rcxml::mousebinds */
struct wl_list link; /* struct rcxml.mousebinds */
bool pressed_in_context; /* used in click events */
};

View file

@ -37,11 +37,11 @@ struct rcxml {
/* keyboard */
int repeat_rate;
int repeat_delay;
struct wl_list keybinds;
struct wl_list keybinds; /* struct keybind.link */
/* mouse */
long doubleclick_time; /* in ms */
struct wl_list mousebinds;
long doubleclick_time; /* in ms */
struct wl_list mousebinds; /* struct mousebind.link */
/* libinput */
struct wl_list libinput_categories;

24
include/private/action.h Normal file
View file

@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __LABWC_PRIVATE_ACTION_H
#define __LABWC_PRIVATE_ACTION_H
/* Don't include ourself as search path starts at current directory */
#include "../action.h"
enum action_arg_type {
LAB_ACTION_ARG_STR = 0,
};
struct action_arg {
struct wl_list link; /* struct action.args */
const char *key; /* May be NULL if there is just one arg */
enum action_arg_type type;
};
struct action_arg_str {
struct action_arg base;
char *value;
};
#endif /* __LABWC_PRIVATE_ACTION_H */