tree-wide: use enum types/constants where appropriate

- add LAB_WINDOW_TYPE_INVALID in place of literal -1
- document more clearly that enum lab_view_criteria is a bitset
- other one-off replacements of integer values/types for consistency

Note: variables of type enum lab_view_criteria are already used
extensively throughout the code to contain combinations of the declared
enum values. I am not introducing any new usage here, just changing the
single uint32_t to be consistent with all the other usages.
This commit is contained in:
John Lindgren 2025-08-26 23:48:05 -04:00 committed by Hiroaki Yamamoto
parent ef766d16f0
commit 80b28f16c7
10 changed files with 27 additions and 17 deletions

View file

@ -56,11 +56,11 @@ enum font_place {
static void load_default_key_bindings(void);
static void load_default_mouse_bindings(void);
static int
static enum lab_window_type
parse_window_type(const char *type)
{
if (!type) {
return -1;
return LAB_WINDOW_TYPE_INVALID;
}
if (!strcasecmp(type, "desktop")) {
return LAB_WINDOW_TYPE_DESKTOP;
@ -91,7 +91,7 @@ parse_window_type(const char *type)
} else if (!strcasecmp(type, "normal")) {
return LAB_WINDOW_TYPE_NORMAL;
} else {
return -1;
return LAB_WINDOW_TYPE_INVALID;
}
}
@ -258,7 +258,7 @@ static void
fill_window_rule(xmlNode *node)
{
struct window_rule *window_rule = znew(*window_rule);
window_rule->window_type = -1; // Window types are >= 0
window_rule->window_type = LAB_WINDOW_TYPE_INVALID;
wl_list_append(&rc.window_rules, &window_rule->link);
wl_list_init(&window_rule->actions);
@ -1406,7 +1406,7 @@ rcxml_init(void)
rc.tablet.force_mouse_emulation = false;
rc.tablet.output_name = NULL;
rc.tablet.rotation = 0;
rc.tablet.rotation = LAB_ROTATE_NONE;
rc.tablet.box = (struct wlr_fbox){0};
tablet_load_default_button_mappings();
rc.tablet_tool.motion = LAB_MOTION_ABSOLUTE;