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

@ -173,7 +173,7 @@ struct rcxml {
bool show;
bool preview;
bool outlines;
uint32_t criteria;
enum lab_view_criteria criteria;
struct wl_list fields; /* struct window_switcher_field.link */
} window_switcher;

View file

@ -48,7 +48,16 @@ enum lab_tristate {
LAB_STATE_DISABLED
};
/* All criteria is applied in AND logic */
/*
* This enum type is a set of bit flags where each set bit makes the
* criteria more restrictive. For example:
*
* (LAB_VIEW_CRITERIA_FULLSCREEN | LAB_VIEW_CRITERIA_CURRENT_WORKSPACE)
* matches only fullscreen views on the current workspace, while
*
* (LAB_VIEW_CRITERIA_ALWAYS_ON_TOP | LAB_VIEW_CRITERIA_NO_ALWAYS_ON_TOP)
* would be contradictory and match nothing at all.
*/
enum lab_view_criteria {
/* No filter -> all focusable views */
LAB_VIEW_CRITERIA_NONE = 0,
@ -79,6 +88,7 @@ enum lab_view_criteria {
* to make them available even in builds with xwayland support disabled.
*/
enum lab_window_type {
LAB_WINDOW_TYPE_INVALID = -1,
LAB_WINDOW_TYPE_DESKTOP = 0,
LAB_WINDOW_TYPE_DOCK,
LAB_WINDOW_TYPE_TOOLBAR,