mirror of
https://github.com/labwc/labwc.git
synced 2025-11-07 13:30:06 -05:00
theme: move some variables into theme->window
For example, variables: `theme->window_inactive_border_color` `theme->window_active_border_color` are converted to: `theme->window[THEME_INACTIVE].border_color` `theme->window[THEME_ACTIVE].border_color`
This commit is contained in:
parent
720ae1fc87
commit
d916a78aca
6 changed files with 137 additions and 201 deletions
|
|
@ -27,6 +27,7 @@ ssd_border_create(struct ssd *ssd)
|
|||
float *color;
|
||||
struct wlr_scene_tree *parent;
|
||||
struct ssd_sub_tree *subtree;
|
||||
int active;
|
||||
|
||||
ssd->border.tree = wlr_scene_tree_create(ssd->tree);
|
||||
wlr_scene_node_set_position(&ssd->border.tree->node, -theme->border_width, 0);
|
||||
|
|
@ -34,12 +35,11 @@ ssd_border_create(struct ssd *ssd)
|
|||
FOR_EACH_STATE(ssd, subtree) {
|
||||
subtree->tree = wlr_scene_tree_create(ssd->border.tree);
|
||||
parent = subtree->tree;
|
||||
if (subtree == &ssd->border.active) {
|
||||
color = theme->window_active_border_color;
|
||||
} else {
|
||||
color = theme->window_inactive_border_color;
|
||||
wlr_scene_node_set_enabled(&parent->node, false);
|
||||
}
|
||||
active = (subtree == &ssd->border.active) ?
|
||||
THEME_ACTIVE : THEME_INACTIVE;
|
||||
wlr_scene_node_set_enabled(&parent->node, active);
|
||||
color = theme->window[active].border_color;
|
||||
|
||||
wl_list_init(&subtree->parts);
|
||||
add_scene_rect(&subtree->parts, LAB_SSD_PART_LEFT, parent,
|
||||
theme->border_width, height, 0, 0, color);
|
||||
|
|
|
|||
|
|
@ -181,10 +181,9 @@ set_shadow_geometry(struct ssd *ssd)
|
|||
continue;
|
||||
}
|
||||
|
||||
bool active = subtree == &ssd->shadow.active;
|
||||
int visible_shadow_width = active
|
||||
? theme->window_active_shadow_size
|
||||
: theme->window_inactive_shadow_size;
|
||||
int active = (subtree == &ssd->shadow.active) ?
|
||||
THEME_ACTIVE : THEME_INACTIVE;
|
||||
int visible_shadow_width = theme->window[active].shadow_size;
|
||||
/* inset as a proportion of shadow width */
|
||||
double inset_proportion = SSD_SHADOW_INSET;
|
||||
/* inset in actual pixels */
|
||||
|
|
@ -195,9 +194,8 @@ set_shadow_geometry(struct ssd *ssd)
|
|||
* portion. Top and bottom are the same size (only the cutout
|
||||
* is different). The buffers are square so width == height.
|
||||
*/
|
||||
int corner_size = active
|
||||
? theme->shadow_corner_top_active->logical_height
|
||||
: theme->shadow_corner_top_inactive->logical_height;
|
||||
int corner_size =
|
||||
theme->window[active].shadow_corner_top->logical_height;
|
||||
|
||||
wl_list_for_each(part, &subtree->parts, link) {
|
||||
set_shadow_part_geometry(part, width, height,
|
||||
|
|
@ -239,6 +237,7 @@ ssd_shadow_create(struct ssd *ssd)
|
|||
struct wlr_buffer *edge_buffer;
|
||||
struct ssd_sub_tree *subtree;
|
||||
struct wlr_scene_tree *parent;
|
||||
int active;
|
||||
|
||||
FOR_EACH_STATE(ssd, subtree) {
|
||||
wl_list_init(&subtree->parts);
|
||||
|
|
@ -246,29 +245,19 @@ ssd_shadow_create(struct ssd *ssd)
|
|||
if (!rc.shadows_enabled) {
|
||||
/* Shadows are globally disabled */
|
||||
continue;
|
||||
} else if (subtree == &ssd->shadow.active) {
|
||||
if (theme->window_active_shadow_size == 0) {
|
||||
/* Active window shadows are disabled */
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (theme->window_inactive_shadow_size == 0) {
|
||||
/* Inactive window shadows are disabled */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
active = (subtree == &ssd->shadow.active) ?
|
||||
THEME_ACTIVE : THEME_INACTIVE;
|
||||
if (theme->window[active].shadow_size == 0) {
|
||||
/* Window shadows are disabled */
|
||||
continue;
|
||||
}
|
||||
|
||||
subtree->tree = wlr_scene_tree_create(ssd->shadow.tree);
|
||||
parent = subtree->tree;
|
||||
if (subtree == &ssd->shadow.active) {
|
||||
corner_top_buffer = &theme->shadow_corner_top_active->base;
|
||||
corner_bottom_buffer = &theme->shadow_corner_bottom_active->base;
|
||||
edge_buffer = &theme->shadow_edge_active->base;
|
||||
} else {
|
||||
corner_top_buffer = &theme->shadow_corner_top_inactive->base;
|
||||
corner_bottom_buffer = &theme->shadow_corner_bottom_inactive->base;
|
||||
edge_buffer = &theme->shadow_edge_inactive->base;
|
||||
}
|
||||
corner_top_buffer = &theme->window[active].shadow_corner_top->base;
|
||||
corner_bottom_buffer = &theme->window[active].shadow_corner_bottom->base;
|
||||
edge_buffer = &theme->window[active].shadow_edge->base;
|
||||
|
||||
make_shadow(&subtree->parts,
|
||||
LAB_SSD_PART_CORNER_BOTTOM_RIGHT, parent,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
struct wlr_scene_tree *parent;
|
||||
struct wlr_buffer *corner_top_left;
|
||||
struct wlr_buffer *corner_top_right;
|
||||
int active;
|
||||
|
||||
ssd->titlebar.tree = wlr_scene_tree_create(ssd->tree);
|
||||
|
||||
|
|
@ -45,18 +46,13 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
FOR_EACH_STATE(ssd, subtree) {
|
||||
subtree->tree = wlr_scene_tree_create(ssd->titlebar.tree);
|
||||
parent = subtree->tree;
|
||||
active = (subtree == &ssd->titlebar.active) ?
|
||||
THEME_ACTIVE : THEME_INACTIVE;
|
||||
color = theme->window[active].title_bg_color;
|
||||
corner_top_left = &theme->window[active].corner_top_left_normal->base;
|
||||
corner_top_right = &theme->window[active].corner_top_right_normal->base;
|
||||
wlr_scene_node_set_enabled(&parent->node, active);
|
||||
wlr_scene_node_set_position(&parent->node, 0, -theme->title_height);
|
||||
if (subtree == &ssd->titlebar.active) {
|
||||
color = theme->window_active_title_bg_color;
|
||||
corner_top_left = &theme->corner_top_left_active_normal->base;
|
||||
corner_top_right = &theme->corner_top_right_active_normal->base;
|
||||
} else {
|
||||
color = theme->window_inactive_title_bg_color;
|
||||
corner_top_left = &theme->corner_top_left_inactive_normal->base;
|
||||
corner_top_right = &theme->corner_top_right_inactive_normal->base;
|
||||
|
||||
wlr_scene_node_set_enabled(&parent->node, false);
|
||||
}
|
||||
wl_list_init(&subtree->parts);
|
||||
|
||||
/* Background */
|
||||
|
|
@ -69,9 +65,6 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
corner_top_right, width - corner_width,
|
||||
-rc.theme->border_width);
|
||||
|
||||
int active = (subtree == &ssd->titlebar.active) ?
|
||||
THEME_ACTIVE : THEME_INACTIVE;
|
||||
|
||||
/* Buttons */
|
||||
struct title_button *b;
|
||||
int x = theme->window_titlebar_padding_width;
|
||||
|
|
@ -474,23 +467,19 @@ ssd_update_title(struct ssd *ssd)
|
|||
struct ssd_part *part;
|
||||
struct ssd_sub_tree *subtree;
|
||||
struct ssd_state_title_width *dstate;
|
||||
int active;
|
||||
|
||||
int offset_left, offset_right;
|
||||
get_title_offsets(ssd, &offset_left, &offset_right);
|
||||
int title_bg_width = view->current.width - offset_left - offset_right;
|
||||
|
||||
FOR_EACH_STATE(ssd, subtree) {
|
||||
if (subtree == &ssd->titlebar.active) {
|
||||
dstate = &state->active;
|
||||
text_color = theme->window_active_label_text_color;
|
||||
bg_color = theme->window_active_title_bg_color;
|
||||
font = &rc.font_activewindow;
|
||||
} else {
|
||||
dstate = &state->inactive;
|
||||
text_color = theme->window_inactive_label_text_color;
|
||||
bg_color = theme->window_inactive_title_bg_color;
|
||||
font = &rc.font_inactivewindow;
|
||||
}
|
||||
active = (subtree == &ssd->titlebar.active) ?
|
||||
THEME_ACTIVE : THEME_INACTIVE;
|
||||
dstate = active ? &state->active : &state->inactive;
|
||||
text_color = theme->window[active].label_text_color;
|
||||
bg_color = theme->window[active].title_bg_color;
|
||||
font = &rc.font_activewindow;
|
||||
|
||||
if (title_bg_width <= 0) {
|
||||
dstate->truncated = true;
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ ssd_enable_keybind_inhibit_indicator(struct ssd *ssd, bool enable)
|
|||
|
||||
float *color = enable
|
||||
? rc.theme->window_toggled_keybinds_color
|
||||
: rc.theme->window_active_border_color;
|
||||
: rc.theme->window[THEME_ACTIVE].border_color;
|
||||
|
||||
struct ssd_part *part = ssd_get_part(&ssd->border.active.parts, LAB_SSD_PART_TOP);
|
||||
struct wlr_scene_rect *rect = wlr_scene_rect_from_node(part->node);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue