mirror of
https://github.com/labwc/labwc.git
synced 2026-03-11 05:33:49 -04:00
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:
parent
65cc2e40ba
commit
4fcb873f6f
21 changed files with 265 additions and 266 deletions
|
|
@ -20,8 +20,8 @@
|
|||
#include "theme.h"
|
||||
#include "workspaces.h"
|
||||
|
||||
struct osd_classic_item {
|
||||
struct osd_item base;
|
||||
struct cycle_osd_classic_item {
|
||||
struct cycle_osd_item base;
|
||||
struct wlr_scene_tree *normal_tree, *active_tree;
|
||||
};
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ create_fields_scene(struct server *server, struct view *view,
|
|||
struct window_switcher_classic_theme *switcher_theme =
|
||||
&theme->osd_window_switcher_classic;
|
||||
|
||||
struct window_switcher_field *field;
|
||||
struct cycle_osd_field *field;
|
||||
wl_list_for_each(field, &rc.window_switcher.fields, link) {
|
||||
int field_width = field_widths_sum * field->width / 100.0;
|
||||
struct wlr_scene_node *node = NULL;
|
||||
|
|
@ -51,7 +51,7 @@ create_fields_scene(struct server *server, struct view *view,
|
|||
height = icon_size;
|
||||
} else {
|
||||
struct buf buf = BUF_INIT;
|
||||
osd_field_get_content(field, &buf, view);
|
||||
cycle_osd_field_get_content(field, &buf, view);
|
||||
|
||||
if (!string_null_or_empty(buf.data)) {
|
||||
struct scaled_font_buffer *font_buffer =
|
||||
|
|
@ -76,9 +76,9 @@ create_fields_scene(struct server *server, struct view *view,
|
|||
}
|
||||
|
||||
static void
|
||||
osd_classic_create(struct output *output, struct wl_array *views)
|
||||
cycle_osd_classic_create(struct output *output, struct wl_array *views)
|
||||
{
|
||||
assert(!output->osd_scene.tree && wl_list_empty(&output->osd_scene.items));
|
||||
assert(!output->cycle_osd.tree && wl_list_empty(&output->cycle_osd.items));
|
||||
|
||||
struct server *server = output->server;
|
||||
struct theme *theme = server->theme;
|
||||
|
|
@ -102,7 +102,7 @@ osd_classic_create(struct output *output, struct wl_array *views)
|
|||
h += switcher_theme->item_height;
|
||||
}
|
||||
|
||||
output->osd_scene.tree = wlr_scene_tree_create(output->osd_tree);
|
||||
output->cycle_osd.tree = wlr_scene_tree_create(output->cycle_osd_tree);
|
||||
|
||||
float *text_color = theme->osd_label_text_color;
|
||||
float *bg_color = theme->osd_bg_color;
|
||||
|
|
@ -116,7 +116,7 @@ osd_classic_create(struct output *output, struct wl_array *views)
|
|||
.width = w,
|
||||
.height = h,
|
||||
};
|
||||
lab_scene_rect_create(output->osd_scene.tree, &bg_opts);
|
||||
lab_scene_rect_create(output->cycle_osd.tree, &bg_opts);
|
||||
|
||||
int y = padding;
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ osd_classic_create(struct output *output, struct wl_array *views)
|
|||
}
|
||||
|
||||
struct scaled_font_buffer *font_buffer =
|
||||
scaled_font_buffer_create(output->osd_scene.tree);
|
||||
scaled_font_buffer_create(output->cycle_osd.tree);
|
||||
wlr_scene_node_set_position(&font_buffer->scene_buffer->node,
|
||||
x, y + (switcher_theme->item_height - font_height(&font)) / 2);
|
||||
scaled_font_buffer_update(font_buffer, workspace_name, 0,
|
||||
|
|
@ -157,12 +157,12 @@ osd_classic_create(struct output *output, struct wl_array *views)
|
|||
/* Draw text for each node */
|
||||
struct view **view;
|
||||
wl_array_for_each(view, views) {
|
||||
struct osd_classic_item *item = znew(*item);
|
||||
wl_list_append(&output->osd_scene.items, &item->base.link);
|
||||
struct cycle_osd_classic_item *item = znew(*item);
|
||||
wl_list_append(&output->cycle_osd.items, &item->base.link);
|
||||
item->base.view = *view;
|
||||
item->base.tree = wlr_scene_tree_create(output->osd_scene.tree);
|
||||
item->base.tree = wlr_scene_tree_create(output->cycle_osd.tree);
|
||||
node_descriptor_create(&item->base.tree->node,
|
||||
LAB_NODE_OSD_ITEM, NULL, item);
|
||||
LAB_NODE_CYCLE_OSD_ITEM, NULL, item);
|
||||
/*
|
||||
* OSD border
|
||||
* +---------------------------------+
|
||||
|
|
@ -218,23 +218,23 @@ osd_classic_create(struct output *output, struct wl_array *views)
|
|||
|
||||
error:;
|
||||
/* Center OSD */
|
||||
wlr_scene_node_set_position(&output->osd_scene.tree->node,
|
||||
wlr_scene_node_set_position(&output->cycle_osd.tree->node,
|
||||
output_box.x + (output_box.width - w) / 2,
|
||||
output_box.y + (output_box.height - h) / 2);
|
||||
}
|
||||
|
||||
static void
|
||||
osd_classic_update(struct output *output)
|
||||
cycle_osd_classic_update(struct output *output)
|
||||
{
|
||||
struct osd_classic_item *item;
|
||||
wl_list_for_each(item, &output->osd_scene.items, base.link) {
|
||||
bool active = item->base.view == output->server->osd_state.cycle_view;
|
||||
struct cycle_osd_classic_item *item;
|
||||
wl_list_for_each(item, &output->cycle_osd.items, base.link) {
|
||||
bool active = item->base.view == output->server->cycle.selected_view;
|
||||
wlr_scene_node_set_enabled(&item->normal_tree->node, !active);
|
||||
wlr_scene_node_set_enabled(&item->active_tree->node, active);
|
||||
}
|
||||
}
|
||||
|
||||
struct osd_impl osd_classic_impl = {
|
||||
.create = osd_classic_create,
|
||||
.update = osd_classic_update,
|
||||
struct cycle_osd_impl cycle_osd_classic_impl = {
|
||||
.create = cycle_osd_classic_create,
|
||||
.update = cycle_osd_classic_update,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue