tree-wide: use rc.theme instead of server.theme

Having two global pointers to the same struct is redundant.
This commit is contained in:
John Lindgren 2026-03-21 22:47:22 -04:00 committed by Consolatis
parent 9550bccef2
commit d4ad27e636
18 changed files with 46 additions and 52 deletions

View file

@ -4,7 +4,7 @@
#include <wlr/types/wlr_scene.h>
#include "common/macros.h"
#include "common/scene-helpers.h"
#include "labwc.h"
#include "config/rcxml.h"
#include "ssd.h"
#include "ssd-internal.h"
#include "theme.h"
@ -17,7 +17,7 @@ ssd_border_create(struct ssd *ssd)
assert(!ssd->border.tree);
struct view *view = ssd->view;
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int width = view->current.width;
int height = view_effective_height(view, /* use_pending */ false);
int full_width = width + 2 * theme->border_width;
@ -90,7 +90,7 @@ ssd_border_update(struct ssd *ssd)
ssd->margin = ssd_thickness(ssd->view);
}
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int width = view->current.width;
int height = view_effective_height(view, /* use_pending */ false);

View file

@ -14,7 +14,7 @@ void
ssd_extents_create(struct ssd *ssd)
{
struct view *view = ssd->view;
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int border_width = MAX(0, MAX(rc.resize_minimum_area, theme->border_width));
@ -100,7 +100,7 @@ ssd_extents_update(struct ssd *ssd)
return;
}
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int width = view->current.width;
int height = view_effective_height(view, /* use_pending */ false);

View file

@ -145,7 +145,7 @@ static void
set_shadow_geometry(struct ssd *ssd)
{
struct view *view = ssd->view;
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int titlebar_height = ssd->titlebar.height;
int width = view->current.width;
int height = view_effective_height(view, false) + titlebar_height;
@ -203,7 +203,7 @@ ssd_shadow_create(struct ssd *ssd)
ssd->shadow.tree = lab_wlr_scene_tree_create(ssd->tree);
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
struct view *view = ssd->view;
enum ssd_active_state active;
@ -256,7 +256,7 @@ ssd_shadow_update(struct ssd *ssd)
assert(ssd->shadow.tree);
struct view *view = ssd->view;
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
bool maximized = view->maximized == VIEW_AXIS_BOTH;
bool tiled_shadows = false;
if (rc.shadows_on_tiled) {

View file

@ -27,7 +27,7 @@ void
ssd_titlebar_create(struct ssd *ssd)
{
struct view *view = ssd->view;
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int width = view->current.width;
int corner_width = ssd_get_corner_width();
@ -160,7 +160,7 @@ set_squared_corners(struct ssd *ssd, bool enable)
struct view *view = ssd->view;
int width = view->current.width;
int corner_width = ssd_get_corner_width();
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int x = enable ? 0 : corner_width;
@ -220,7 +220,7 @@ static void
update_visible_buttons(struct ssd *ssd)
{
struct view *view = ssd->view;
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int width = MAX(view->current.width - 2 * theme->window_titlebar_padding_width, 0);
int button_width = theme->window_button_width;
int button_spacing = theme->window_button_spacing;
@ -273,7 +273,7 @@ ssd_titlebar_update(struct ssd *ssd)
struct view *view = ssd->view;
int width = view->current.width;
int corner_width = ssd_get_corner_width();
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
bool maximized = view->maximized == VIEW_AXIS_BOTH;
bool squared = ssd_should_be_squared(ssd);
@ -365,7 +365,7 @@ static void
ssd_update_title_positions(struct ssd *ssd, int offset_left, int offset_right)
{
struct view *view = ssd->view;
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
int width = view->current.width;
int title_bg_width = width - offset_left - offset_right;
@ -413,9 +413,9 @@ static void
get_title_offsets(struct ssd *ssd, int *offset_left, int *offset_right)
{
struct ssd_titlebar_subtree *subtree = &ssd->titlebar.subtrees[SSD_ACTIVE];
int button_width = server.theme->window_button_width;
int button_spacing = server.theme->window_button_spacing;
int padding_width = server.theme->window_titlebar_padding_width;
int button_width = rc.theme->window_button_width;
int button_spacing = rc.theme->window_button_spacing;
int padding_width = rc.theme->window_titlebar_padding_width;
*offset_left = padding_width;
*offset_right = padding_width;
@ -443,7 +443,7 @@ ssd_update_title(struct ssd *ssd)
/* view->title is never NULL (instead it can be an empty string) */
assert(view->title);
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
struct ssd_state_title *state = &ssd->state.title;
bool title_unchanged = state->text && !strcmp(view->title, state->text);

View file

@ -39,7 +39,7 @@ ssd_thickness(struct view *view)
return (struct border){ 0 };
}
struct theme *theme = server.theme;
struct theme *theme = rc.theme;
if (view->maximized == VIEW_AXIS_BOTH) {
struct border thickness = { 0 };
@ -101,7 +101,7 @@ ssd_get_resizing_type(const struct ssd *ssd, struct wlr_cursor *cursor)
if (view_titlebar_visible(view)) {
/* If the titlebar is visible, consider it part of the view */
int titlebar_height = server.theme->titlebar_height;
int titlebar_height = rc.theme->titlebar_height;
view_box.y -= titlebar_height;
view_box.height += titlebar_height;
}
@ -156,7 +156,7 @@ ssd_create(struct view *view, bool active)
LAB_NODE_SSD_ROOT, view, /*data*/ NULL);
wlr_scene_node_lower_to_bottom(&ssd->tree->node);
ssd->titlebar.height = server.theme->titlebar_height;
ssd->titlebar.height = rc.theme->titlebar_height;
ssd_shadow_create(ssd);
ssd_extents_create(ssd);
/*
@ -257,7 +257,7 @@ ssd_set_titlebar(struct ssd *ssd, bool enabled)
return;
}
wlr_scene_node_set_enabled(&ssd->titlebar.tree->node, enabled);
ssd->titlebar.height = enabled ? server.theme->titlebar_height : 0;
ssd->titlebar.height = enabled ? rc.theme->titlebar_height : 0;
ssd_border_update(ssd);
ssd_extents_update(ssd);
ssd_shadow_update(ssd);