Use "cycle" instead of "osd" across the codebase

We were using the word "osd" to describe the window switcher, but it can
be used with on-screen display (OSD) disabled by
`<windowSwitcher><osd show="false">`. Let's use "cycle" instead to avoid
confusion.
This commit is contained in:
tokyo4j 2025-11-29 02:41:54 +09:00 committed by Hiroaki Yamamoto
parent 65cc2e40ba
commit 4fcb873f6f
21 changed files with 265 additions and 266 deletions

View file

@ -47,7 +47,7 @@ enum lab_node_type {
LAB_NODE_FRAME,
LAB_NODE_ROOT,
LAB_NODE_MENUITEM,
LAB_NODE_OSD_ITEM,
LAB_NODE_CYCLE_OSD_ITEM,
LAB_NODE_LAYER_SURFACE,
LAB_NODE_UNMANAGED,
LAB_NODE_ALL,

View file

@ -182,8 +182,8 @@ struct rcxml {
bool unshade;
enum lab_view_criteria criteria;
struct wl_list fields; /* struct window_switcher_field.link */
enum window_switcher_style style;
enum osd_output_criteria output_criteria;
enum cycle_osd_style style;
enum cycle_osd_output_criteria output_criteria;
char *thumbnail_label_format;
} window_switcher;

View file

@ -107,15 +107,15 @@ enum lab_window_type {
LAB_WINDOW_TYPE_LEN
};
enum window_switcher_style {
WINDOW_SWITCHER_CLASSIC,
WINDOW_SWITCHER_THUMBNAIL,
enum cycle_osd_style {
CYCLE_OSD_STYLE_CLASSIC,
CYCLE_OSD_STYLE_THUMBNAIL,
};
enum osd_output_criteria {
OSD_OUTPUT_ALL,
OSD_OUTPUT_POINTER,
OSD_OUTPUT_KEYBOARD,
enum cycle_osd_output_criteria {
CYCLE_OSD_OUTPUT_ALL,
CYCLE_OSD_OUTPUT_POINTER,
CYCLE_OSD_OUTPUT_KEYBOARD,
};
#endif /* LABWC_CONFIG_TYPES_H */

View file

@ -14,7 +14,7 @@ enum lab_cycle_dir {
};
/* TODO: add field with keyboard layout? */
enum window_switcher_field_content {
enum cycle_osd_field_content {
LAB_FIELD_NONE = 0,
LAB_FIELD_TYPE,
LAB_FIELD_TYPE_SHORT,
@ -35,8 +35,8 @@ enum window_switcher_field_content {
LAB_FIELD_COUNT
};
struct window_switcher_field {
enum window_switcher_field_content content;
struct cycle_osd_field {
enum cycle_osd_field_content content;
int width;
char *format;
struct wl_list link; /* struct rcxml.window_switcher.fields */
@ -48,54 +48,54 @@ struct server;
struct wlr_scene_node;
/* Begin window switcher */
void osd_begin(struct server *server, enum lab_cycle_dir direction);
void cycle_begin(struct server *server, enum lab_cycle_dir direction);
/* Cycle the selected view in the window switcher */
void osd_cycle(struct server *server, enum lab_cycle_dir direction);
void cycle_step(struct server *server, enum lab_cycle_dir direction);
/* Closes the OSD */
void osd_finish(struct server *server, bool switch_focus);
void cycle_finish(struct server *server, bool switch_focus);
/* Notify OSD about a destroying view */
void osd_on_view_destroy(struct view *view);
void cycle_on_view_destroy(struct view *view);
/* Focus the clicked window and close OSD */
void osd_on_cursor_release(struct server *server, struct wlr_scene_node *node);
void cycle_on_cursor_release(struct server *server, struct wlr_scene_node *node);
/* Used by osd.c internally to render window switcher fields */
void osd_field_get_content(struct window_switcher_field *field,
void cycle_osd_field_get_content(struct cycle_osd_field *field,
struct buf *buf, struct view *view);
/* Sets view info to buf according to format */
void osd_field_set_custom(struct buf *buf, struct view *view,
void cycle_osd_field_set_custom(struct buf *buf, struct view *view,
const char *format);
/* Used by rcxml.c when parsing the config */
void osd_field_arg_from_xml_node(struct window_switcher_field *field,
void cycle_osd_field_arg_from_xml_node(struct cycle_osd_field *field,
const char *nodename, const char *content);
bool osd_field_is_valid(struct window_switcher_field *field);
void osd_field_free(struct window_switcher_field *field);
bool cycle_osd_field_is_valid(struct cycle_osd_field *field);
void cycle_osd_field_free(struct cycle_osd_field *field);
/* Internal API */
struct osd_item {
struct cycle_osd_item {
struct view *view;
struct wlr_scene_tree *tree;
struct wl_list link;
};
struct osd_impl {
struct cycle_osd_impl {
/*
* Create a scene-tree of OSD for an output.
* This sets output->osd_scene.{items,tree}.
* This sets output->cycle_osd.{items,tree}.
*/
void (*create)(struct output *output, struct wl_array *views);
/*
* Update output->osd_scene.tree to highlight
* server->osd_state.cycle_view.
* Update output->cycle_osd.tree to highlight
* server->cycle_state.selected_view.
*/
void (*update)(struct output *output);
};
extern struct osd_impl osd_classic_impl;
extern struct osd_impl osd_thumbnail_impl;
extern struct cycle_osd_impl cycle_osd_classic_impl;
extern struct cycle_osd_impl cycle_osd_thumbnail_impl;
#endif // LABWC_CYCLE_H

View file

@ -18,7 +18,7 @@ enum input_mode {
LAB_INPUT_STATE_MOVE,
LAB_INPUT_STATE_RESIZE,
LAB_INPUT_STATE_MENU,
LAB_INPUT_STATE_WINDOW_SWITCHER,
LAB_INPUT_STATE_CYCLE, /* a.k.a. window switching */
};
struct seat {
@ -302,15 +302,15 @@ struct server {
struct wlr_security_context_manager_v1 *security_context_manager_v1;
/* Set when in cycle (alt-tab) mode */
struct osd_state {
struct view *cycle_view;
struct cycle_state {
struct view *selected_view;
bool preview_was_shaded;
bool preview_was_enabled;
struct wlr_scene_node *preview_node;
struct wlr_scene_tree *preview_parent;
struct wlr_scene_node *preview_anchor;
struct lab_scene_rect *preview_outline;
} osd_state;
} cycle;
struct theme *theme;

View file

@ -53,10 +53,10 @@ struct menuitem *node_menuitem_from_node(
struct wlr_scene_node *wlr_scene_node);
/**
* node_osd_item_from_node - return osd item struct from node
* node_cycle_osd_item_from_node - return cycle OSD item struct from node
* @wlr_scene_node: wlr_scene_node from which to return data
*/
struct osd_item *node_osd_item_from_node(
struct cycle_osd_item *node_cycle_osd_item_from_node(
struct wlr_scene_node *wlr_scene_node);
/**

View file

@ -15,14 +15,14 @@ struct output {
struct wlr_scene_output *scene_output;
struct wlr_scene_tree *layer_tree[LAB_NR_LAYERS];
struct wlr_scene_tree *layer_popup_tree;
struct wlr_scene_tree *osd_tree;
struct wlr_scene_tree *cycle_osd_tree;
struct wlr_scene_tree *session_lock_tree;
struct wlr_scene_buffer *workspace_osd;
struct osd_scene {
struct wl_list items; /* struct osd_item */
struct cycle_osd_scene {
struct wl_list items; /* struct cycle_osd_item */
struct wlr_scene_tree *tree;
} osd_scene;
} cycle_osd;
/* In output-relative scene coordinates */
struct wlr_box usable_area;