mirror of
https://github.com/labwc/labwc.git
synced 2026-04-10 08:21:07 -04:00
[wip] src/action.c: Add action_arg_box
This commit is contained in:
parent
9b49f19a73
commit
a0e22d5e07
3 changed files with 27 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
struct view;
|
struct view;
|
||||||
struct server;
|
struct server;
|
||||||
struct wl_list;
|
struct wl_list;
|
||||||
|
struct wlr_box;
|
||||||
|
|
||||||
struct action {
|
struct action {
|
||||||
struct wl_list link; /* struct keybinding.actions,
|
struct wl_list link; /* struct keybinding.actions,
|
||||||
|
|
@ -17,6 +18,7 @@ struct action {
|
||||||
|
|
||||||
struct action *action_create(const char *action_name);
|
struct action *action_create(const char *action_name);
|
||||||
void action_arg_add_str(struct action *action, char *key, const char *value);
|
void action_arg_add_str(struct action *action, char *key, const char *value);
|
||||||
|
struct wlr_box *action_arg_add_box(struct action *action, char *name);
|
||||||
void actions_run(struct view *activator, struct server *server,
|
void actions_run(struct view *activator, struct server *server,
|
||||||
struct wl_list *actions, uint32_t resize_edges);
|
struct wl_list *actions, uint32_t resize_edges);
|
||||||
void action_list_free(struct wl_list *action_list);
|
void action_list_free(struct wl_list *action_list);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
enum action_arg_type {
|
enum action_arg_type {
|
||||||
LAB_ACTION_ARG_STR = 0,
|
LAB_ACTION_ARG_STR = 0,
|
||||||
|
LAB_ACTION_ARG_BOX,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct action_arg {
|
struct action_arg {
|
||||||
|
|
@ -21,4 +22,9 @@ struct action_arg_str {
|
||||||
char *value;
|
char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct action_arg_box {
|
||||||
|
struct action_arg base;
|
||||||
|
struct wlr_box value;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* __LABWC_PRIVATE_ACTION_H */
|
#endif /* __LABWC_PRIVATE_ACTION_H */
|
||||||
|
|
|
||||||
19
src/action.c
19
src/action.c
|
|
@ -73,6 +73,13 @@ action_str_from_arg(struct action_arg *arg)
|
||||||
return ((struct action_arg_str *)arg)->value;
|
return ((struct action_arg_str *)arg)->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct wlr_box *
|
||||||
|
action_box_from_arg(struct action_arg *arg)
|
||||||
|
{
|
||||||
|
assert(arg->type == LAB_ACTION_ARG_BOX);
|
||||||
|
return &((struct action_arg_box *)arg)->value;
|
||||||
|
}
|
||||||
|
|
||||||
static struct action_arg *
|
static struct action_arg *
|
||||||
action_get_first_arg(struct action *action)
|
action_get_first_arg(struct action *action)
|
||||||
{
|
{
|
||||||
|
|
@ -357,3 +364,15 @@ action_arg_add_str(struct action *action, char *key, const char *value)
|
||||||
arg->value = strdup(value);
|
arg->value = strdup(value);
|
||||||
wl_list_insert(action->args.prev, &arg->base.link);
|
wl_list_insert(action->args.prev, &arg->base.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_box *
|
||||||
|
action_arg_add_box(struct action *action, char *name)
|
||||||
|
{
|
||||||
|
struct action_arg_box *arg = calloc(1, sizeof(*arg));
|
||||||
|
arg->base.type = LAB_ACTION_ARG_BOX;
|
||||||
|
if (name) {
|
||||||
|
arg->base.key = strdup(name);
|
||||||
|
}
|
||||||
|
wl_list_insert(action->args.prev, &arg->base.link);
|
||||||
|
return &arg->value;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue