mirror of
https://github.com/labwc/labwc.git
synced 2026-03-03 01:40:37 -05: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
|
|
@ -19,8 +19,8 @@
|
|||
#include "theme.h"
|
||||
#include "view.h"
|
||||
|
||||
struct osd_thumbnail_item {
|
||||
struct osd_item base;
|
||||
struct cycle_osd_thumbnail_item {
|
||||
struct cycle_osd_item base;
|
||||
struct scaled_font_buffer *normal_label;
|
||||
struct scaled_font_buffer *active_label;
|
||||
struct lab_scene_rect *active_bg;
|
||||
|
|
@ -102,7 +102,7 @@ create_label(struct wlr_scene_tree *parent, struct view *view,
|
|||
const float *text_color, const float *bg_color, int y)
|
||||
{
|
||||
struct buf buf = BUF_INIT;
|
||||
osd_field_set_custom(&buf, view,
|
||||
cycle_osd_field_set_custom(&buf, view,
|
||||
rc.window_switcher.thumbnail_label_format);
|
||||
struct scaled_font_buffer *buffer =
|
||||
scaled_font_buffer_create(parent);
|
||||
|
|
@ -115,7 +115,7 @@ create_label(struct wlr_scene_tree *parent, struct view *view,
|
|||
return buffer;
|
||||
}
|
||||
|
||||
static struct osd_thumbnail_item *
|
||||
static struct cycle_osd_thumbnail_item *
|
||||
create_item_scene(struct wlr_scene_tree *parent, struct view *view,
|
||||
struct output *output)
|
||||
{
|
||||
|
|
@ -136,10 +136,10 @@ create_item_scene(struct wlr_scene_tree *parent, struct view *view,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct osd_thumbnail_item *item = znew(*item);
|
||||
wl_list_append(&output->osd_scene.items, &item->base.link);
|
||||
struct cycle_osd_thumbnail_item *item = znew(*item);
|
||||
wl_list_append(&output->cycle_osd.items, &item->base.link);
|
||||
struct wlr_scene_tree *tree = wlr_scene_tree_create(parent);
|
||||
node_descriptor_create(&tree->node, LAB_NODE_OSD_ITEM, NULL, item);
|
||||
node_descriptor_create(&tree->node, LAB_NODE_CYCLE_OSD_ITEM, NULL, item);
|
||||
item->base.tree = tree;
|
||||
item->base.view = view;
|
||||
|
||||
|
|
@ -226,9 +226,9 @@ get_items_geometry(struct output *output, struct theme *theme,
|
|||
}
|
||||
|
||||
static void
|
||||
osd_thumbnail_create(struct output *output, struct wl_array *views)
|
||||
cycle_osd_thumbnail_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;
|
||||
|
|
@ -236,7 +236,7 @@ osd_thumbnail_create(struct output *output, struct wl_array *views)
|
|||
&theme->osd_window_switcher_thumbnail;
|
||||
int padding = theme->osd_border_width + switcher_theme->padding;
|
||||
|
||||
output->osd_scene.tree = wlr_scene_tree_create(output->osd_tree);
|
||||
output->cycle_osd.tree = wlr_scene_tree_create(output->cycle_osd_tree);
|
||||
|
||||
int nr_views = wl_array_len(views);
|
||||
assert(nr_views > 0);
|
||||
|
|
@ -247,8 +247,8 @@ osd_thumbnail_create(struct output *output, struct wl_array *views)
|
|||
struct view **view;
|
||||
int index = 0;
|
||||
wl_array_for_each(view, views) {
|
||||
struct osd_thumbnail_item *item = create_item_scene(
|
||||
output->osd_scene.tree, *view, output);
|
||||
struct cycle_osd_thumbnail_item *item = create_item_scene(
|
||||
output->cycle_osd.tree, *view, output);
|
||||
if (!item) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ osd_thumbnail_create(struct output *output, struct wl_array *views)
|
|||
.height = nr_rows * switcher_theme->item_height + 2 * padding,
|
||||
};
|
||||
struct lab_scene_rect *bg =
|
||||
lab_scene_rect_create(output->osd_scene.tree, &bg_opts);
|
||||
lab_scene_rect_create(output->cycle_osd.tree, &bg_opts);
|
||||
wlr_scene_node_lower_to_bottom(&bg->tree->node);
|
||||
|
||||
/* center */
|
||||
|
|
@ -277,15 +277,15 @@ osd_thumbnail_create(struct output *output, struct wl_array *views)
|
|||
&output_box);
|
||||
int lx = output_box.x + (output_box.width - bg_opts.width) / 2;
|
||||
int ly = output_box.y + (output_box.height - bg_opts.height) / 2;
|
||||
wlr_scene_node_set_position(&output->osd_scene.tree->node, lx, ly);
|
||||
wlr_scene_node_set_position(&output->cycle_osd.tree->node, lx, ly);
|
||||
}
|
||||
|
||||
static void
|
||||
osd_thumbnail_update(struct output *output)
|
||||
cycle_osd_thumbnail_update(struct output *output)
|
||||
{
|
||||
struct osd_thumbnail_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_thumbnail_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->active_bg->tree->node, active);
|
||||
wlr_scene_node_set_enabled(
|
||||
&item->active_label->scene_buffer->node, active);
|
||||
|
|
@ -294,7 +294,7 @@ osd_thumbnail_update(struct output *output)
|
|||
}
|
||||
}
|
||||
|
||||
struct osd_impl osd_thumbnail_impl = {
|
||||
.create = osd_thumbnail_create,
|
||||
.update = osd_thumbnail_update,
|
||||
struct cycle_osd_impl cycle_osd_thumbnail_impl = {
|
||||
.create = cycle_osd_thumbnail_create,
|
||||
.update = cycle_osd_thumbnail_update,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue