[wip] convert to wlr_fbox

This commit is contained in:
Consolatis 2022-07-04 01:09:13 +02:00
parent 7585c7c26a
commit aa6e80d9a1
6 changed files with 22 additions and 22 deletions

View file

@ -5,7 +5,7 @@
struct view; struct view;
struct server; struct server;
struct wl_list; struct wl_list;
struct wlr_box; struct wlr_fbox;
struct action { struct action {
struct wl_list link; /* struct keybinding.actions, struct wl_list link; /* struct keybinding.actions,
@ -18,7 +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); struct wlr_fbox *action_arg_add_fbox(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);

View file

@ -435,7 +435,7 @@ void view_adjust_for_layout_change(struct view *view);
void view_discover_output(struct view *view); void view_discover_output(struct view *view);
void view_move_to_edge(struct view *view, const char *direction); void view_move_to_edge(struct view *view, const char *direction);
void view_snap_to_edge(struct view *view, const char *direction); void view_snap_to_edge(struct view *view, const char *direction);
void view_rel_move_resize_to(struct view *view, struct wlr_box *rel_box); void view_rel_move_resize_to(struct view *view, struct wlr_fbox *rel_box);
const char *view_get_string_prop(struct view *view, const char *prop); const char *view_get_string_prop(struct view *view, const char *prop);
void view_update_title(struct view *view); void view_update_title(struct view *view);

View file

@ -7,7 +7,7 @@
enum action_arg_type { enum action_arg_type {
LAB_ACTION_ARG_STR = 0, LAB_ACTION_ARG_STR = 0,
LAB_ACTION_ARG_BOX, LAB_ACTION_ARG_FBOX,
}; };
struct action_arg { struct action_arg {
@ -22,9 +22,9 @@ struct action_arg_str {
char *value; char *value;
}; };
struct action_arg_box { struct action_arg_fbox {
struct action_arg base; struct action_arg base;
struct wlr_box value; struct wlr_fbox value;
}; };
#endif /* __LABWC_PRIVATE_ACTION_H */ #endif /* __LABWC_PRIVATE_ACTION_H */

View file

@ -76,11 +76,11 @@ 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 * static struct wlr_fbox *
action_box_from_arg(struct action_arg *arg) action_fbox_from_arg(struct action_arg *arg)
{ {
assert(arg->type == LAB_ACTION_ARG_BOX); assert(arg->type == LAB_ACTION_ARG_FBOX);
return &((struct action_arg_box *)arg)->value; return &((struct action_arg_fbox *)arg)->value;
} }
static struct action_arg * static struct action_arg *
@ -345,7 +345,7 @@ actions_run(struct view *activator, struct server *server,
break; break;
} }
if (view) { if (view) {
struct wlr_box *box = action_box_from_arg(arg); struct wlr_fbox *box = action_fbox_from_arg(arg);
view_rel_move_resize_to(view, box); view_rel_move_resize_to(view, box);
} }
break; break;
@ -378,11 +378,11 @@ action_arg_add_str(struct action *action, char *key, const char *value)
wl_list_insert(action->args.prev, &arg->base.link); wl_list_insert(action->args.prev, &arg->base.link);
} }
struct wlr_box * struct wlr_fbox *
action_arg_add_box(struct action *action, char *name) action_arg_add_fbox(struct action *action, char *name)
{ {
struct action_arg_box *arg = calloc(1, sizeof(*arg)); struct action_arg_fbox *arg = calloc(1, sizeof(*arg));
arg->base.type = LAB_ACTION_ARG_BOX; arg->base.type = LAB_ACTION_ARG_FBOX;
if (name) { if (name) {
arg->base.key = strdup(name); arg->base.key = strdup(name);
} }

View file

@ -32,7 +32,7 @@ static struct libinput_category *current_libinput_category;
static const char *current_mouse_context; static const char *current_mouse_context;
static struct action *current_keybind_action; static struct action *current_keybind_action;
static struct action *current_mousebind_action; static struct action *current_mousebind_action;
static struct wlr_box *current_action_box; static struct wlr_fbox *current_action_box;
enum font_place { enum font_place {
FONT_PLACE_UNKNOWN = 0, FONT_PLACE_UNKNOWN = 0,
@ -49,13 +49,13 @@ fill_geo(char *key, char *content)
{ {
assert(current_action_box); assert(current_action_box);
if (!strcmp(key, "x.action")) { if (!strcmp(key, "x.action")) {
current_action_box->x = atoi(content); current_action_box->x = atof(content);
} else if (!strcmp(key, "y.action")) { } else if (!strcmp(key, "y.action")) {
current_action_box->y = atoi(content); current_action_box->y = atof(content);
} else if (!strcmp(key, "width.action")) { } else if (!strcmp(key, "width.action")) {
current_action_box->width = atoi(content); current_action_box->width = atof(content);
} else if (!strcmp(key, "height.action")) { } else if (!strcmp(key, "height.action")) {
current_action_box->height = atoi(content); current_action_box->height = atof(content);
} }
} }
@ -85,7 +85,7 @@ fill_keybind(char *nodename, char *content)
wl_list_insert(current_keybind->actions.prev, wl_list_insert(current_keybind->actions.prev,
&current_keybind_action->link); &current_keybind_action->link);
if (!strcmp(content, "MoveResizeTo")) { if (!strcmp(content, "MoveResizeTo")) {
current_action_box = action_arg_add_box( current_action_box = action_arg_add_fbox(
current_keybind_action, NULL); current_keybind_action, NULL);
} else { } else {
current_action_box = NULL; current_action_box = NULL;

View file

@ -661,7 +661,7 @@ view_edge_parse(const char *direction)
/* Move and resize view based on percent output local values in rel_box */ /* Move and resize view based on percent output local values in rel_box */
void void
view_rel_move_resize_to(struct view *view, struct wlr_box *rel_box) view_rel_move_resize_to(struct view *view, struct wlr_fbox *rel_box)
{ {
assert(view); assert(view);
assert(rel_box); assert(rel_box);