Skip to content

Commit aa05b2a

Browse files
committed
chore: remove unused stuff and refactor some things
1 parent e318637 commit aa05b2a

18 files changed

Lines changed: 95 additions & 217 deletions

include/config.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ bool keybind_matches(const keybind_t *kb, uint32_t modifiers, xkb_keysym_t keysy
161161
uint32_t keycode);
162162
void execute_keybind(const keybind_t *kb);
163163
void execute_bell_bind(void);
164-
int get_hotkey_watch_fd(void);
165164
void setup_hotkey_event_listener(struct wl_event_loop *event_loop);
166165
void enter_submap(const char *name);
167166
void exit_submap(void);
@@ -171,12 +170,10 @@ void set_keyboard_grouping(keyboard_grouping_t grouping);
171170

172171
bool gesturebind_matches(const gesturebind_t *gb, enum gesture_type type, uint8_t fingers);
173172
void execute_gesturebind(const gesturebind_t *gb);
174-
void reload_gesturebinds(void);
175173

176174
bool hotcornerbind_matches(const hotcornerbind_t *hc, int corner_x, int corner_y);
177175
hotcornerbind_t *hotcorner_bind_match(int corner_x, int corner_y);
178176
void execute_hotcornerbind(const hotcornerbind_t *hc);
179-
void reload_hotcornerbinds(void);
180177

181178
void execute_bind(bind_t b);
182179
void execute_bind_action(bind_action_t action);

include/effects_backend.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ struct be_blur_params {
5353
float refraction_rgb_fringing;
5454
int refraction_texture_repeat_mode;
5555
float refraction_offset;
56-
float refraction_noise_strength;
57-
float refraction_noise_scale;
5856
};
5957

6058
struct be_shadow_params {

include/master_stack.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ extern stack_layout_t master_stack_layout;
2727
void master_stack_arrange(struct output_t *m, desktop_t *d, struct wlr_box available);
2828

2929
int master_stack_collect(desktop_t *d, node_t ***out_nodes);
30-
int master_stack_find_index(desktop_t *d, const node_t *n);
3130

3231
bool master_stack_focus_south(desktop_t *d);
3332
bool master_stack_focus_north(desktop_t *d);

include/surface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,5 @@ void surface_client_set_border_radius(struct client_t *client, float radius);
134134
void surface_client_set_shadow(struct client_t *client, bool enabled);
135135

136136
void surface_set_opacity(struct wlr_scene_node *node, float opacity);
137+
void rounded_mark_border_size(struct surface_rounded_t *rounded, int content_w, int content_h,
138+
int border_w, float scale);

include/toplevel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ typedef struct toplevel_t {
7777

7878
// helper functions
7979
void focus_toplevel(toplevel_t *toplevel);
80-
void toplevel_apply_geometry(toplevel_t *toplevel);
8180
bool toplevel_is_ready(toplevel_t *toplevel);
8281
void update_foreign_toplevel_state(toplevel_t *toplevel);
8382
void toplevel_center_and_clip_surface(toplevel_t *toplevel);

include/tree.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ node_t *second_extrema(node_t *n);
4141
node_t *next_leaf(node_t *n, node_t *r);
4242
node_t *prev_leaf(node_t *n, node_t *r);
4343

44+
// Iterate over every leaf of the tree rooted at r. `it` is declared by the
45+
// macro and must be a fresh identifier (some callers break out of the loop).
46+
#define FOR_EACH_LEAF(it, r) \
47+
for (node_t *it = first_extrema(r); it != NULL; it = next_leaf(it, r))
48+
#define FOR_EACH_LEAF_EXCLUDE_ROOT(it, r) \
49+
for (node_t *it = first_extrema(r); it != NULL && it != (r); it = next_leaf(it, r))
50+
4451
// focus management
4552
bool focus_node(struct output_t *m, desktop_t *d, node_t *n);
4653
bool activate_node(struct output_t *m, desktop_t *d, node_t *n);
@@ -50,6 +57,7 @@ bool is_adjacent(node_t *a, node_t *b, direction_t dir);
5057
// node manipulation
5158
void swap_nodes(struct output_t *m1, desktop_t *d1, node_t *n1, struct output_t *m2, desktop_t *d2,
5259
node_t *n2);
60+
int collect_tiled_leaves(desktop_t *d, node_t ***out_nodes);
5361
bool set_state(struct output_t *m, desktop_t *d, node_t *n, client_state_t s);
5462
void set_floating(struct output_t *m, desktop_t *d, node_t *n, bool value);
5563
void enter_fullscreen(struct output_t *m, desktop_t *d, node_t *n);
@@ -67,7 +75,6 @@ void equalize_tree(node_t *n);
6775
void balance_tree(node_t *n);
6876

6977
// geometry
70-
struct wlr_box get_rectangle(struct output_t *m, node_t *n);
7178
unsigned int node_area(node_t *n);
7279

7380
// Transaction helpers
@@ -81,7 +88,6 @@ void node_set_pending_hidden(node_t *n, bool hidden);
8188
void parse_color(const char *hex, float *color);
8289

8390
// Debug helpers
84-
void print_tree(node_t *n, int depth);
8591
void validate_tree(const char *context, desktop_t *d);
8692

8793
struct wlr_scene_tree *client_get_scene_tree(client_t *client);

src/config.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,10 +1295,6 @@ void execute_bell_bind(void) {
12951295
execute_keybind(&bell_bind);
12961296
}
12971297

1298-
int get_hotkey_watch_fd(void) {
1299-
return hotkey_watch_fd;
1300-
}
1301-
13021298
void setup_hotkey_event_listener(struct wl_event_loop *event_loop) {
13031299
hotkey_event_loop = event_loop;
13041300
add_hotkey_listener_to_event_loop();
@@ -1377,10 +1373,6 @@ void execute_gesturebind(const gesturebind_t *gb) {
13771373
execute_bind(bind);
13781374
}
13791375

1380-
void reload_gesturebinds(void) {
1381-
num_gesturebinds = 0;
1382-
}
1383-
13841376
bool hotcornerbind_matches(const hotcornerbind_t *hc, int corner_x, int corner_y) {
13851377
if (!hc)
13861378
return false;
@@ -1409,10 +1401,6 @@ void execute_hotcornerbind(const hotcornerbind_t *hc) {
14091401
execute_bind(bind);
14101402
}
14111403

1412-
void reload_hotcornerbinds(void) {
1413-
num_hotcornerbinds = 0;
1414-
}
1415-
14161404
const char *bind_action_name(bind_action_t action) {
14171405
static const char *names[] = {
14181406
"none",

src/cursor.c

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void apply_leaf_positions(desktop_t *d) {
165165
if (!d || !d->root)
166166
return;
167167

168-
for (node_t *n = first_extrema(d->root); n; n = next_leaf(n, d->root)) {
168+
FOR_EACH_LEAF(n, d->root) {
169169
if (!n->client)
170170
continue;
171171

@@ -202,19 +202,10 @@ static void apply_leaf_positions(desktop_t *d) {
202202
if (n->client->border_radius > 0.0f) {
203203
surface_rounded_t *rounded = client_get_rounded(n->client);
204204
if (rounded) {
205-
int new_fw = r.width + 2 * (int)bw;
206-
int new_fh = r.height + 2 * (int)bw;
207-
if (new_fw > 0 && new_fh > 0) {
208-
float scale = n->client->toplevel && n->client->toplevel->node &&
209-
n->client->toplevel->node->output ? n->client->toplevel->node->output->wlr_output->scale :
210-
1.0f;
211-
int pfw = (int)((double)new_fw * scale + 0.5);
212-
int pfh = (int)((double)new_fh * scale + 0.5);
213-
if (rounded->border_shader_buf_w != pfw || rounded->border_shader_buf_h != pfh) {
214-
rounded->border_dirty = true;
215-
rounded->corner_mask_dirty = true;
216-
}
217-
}
205+
rounded_mark_border_size(rounded, r.width, r.height, (int)bw,
206+
n->client->toplevel && n->client->toplevel->node &&
207+
n->client->toplevel->node->output ?
208+
n->client->toplevel->node->output->wlr_output->scale : 1.0f);
218209
}
219210
}
220211
}
@@ -493,19 +484,8 @@ static void process_cursor_resize(void) {
493484
update_borders(toplevel->border_tree, toplevel->border_rects, geo, bw);
494485
update_border_colors(client);
495486
if (client->border_radius > 0.0f && toplevel->rounded) {
496-
int new_fw = new_width + 2 * (int)bw;
497-
int new_fh = new_height + 2 * (int)bw;
498-
if (new_fw > 0 && new_fh > 0) {
499-
float scale = toplevel->node &&
500-
toplevel->node->output ? toplevel->node->output->wlr_output->scale : 1.0f;
501-
int pfw = (int)((double)new_fw * scale + 0.5);
502-
int pfh = (int)((double)new_fh * scale + 0.5);
503-
if (toplevel->rounded->border_shader_buf_w != pfw ||
504-
toplevel->rounded->border_shader_buf_h != pfh) {
505-
toplevel->rounded->border_dirty = true;
506-
toplevel->rounded->corner_mask_dirty = true;
507-
}
508-
}
487+
rounded_mark_border_size(toplevel->rounded, new_width, new_height, (int)bw,
488+
toplevel->node && toplevel->node->output ? toplevel->node->output->wlr_output->scale : 1.0f);
509489
}
510490
}
511491
}

src/effects.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ float refraction_normal_pow = 6.0f;
9292
float refraction_rgb_fringing = 22.0f / 30.0f;
9393
int refraction_texture_repeat_mode = 1;
9494
float refraction_offset = 1.0f;
95-
float refraction_noise_strength = 0.03f;
96-
float refraction_noise_scale = 1.0f;
9795

9896
float shadow_size = 8.0f;
9997
float shadow_offset_x = 0.0f;
@@ -771,8 +769,6 @@ static bool rebuild_live_blur(output_t *output, uint64_t shared_blurred, pixman_
771769
.refraction_rgb_fringing = refraction_rgb_fringing,
772770
.refraction_texture_repeat_mode = refraction_texture_repeat_mode,
773771
.refraction_offset = refraction_offset,
774-
.refraction_noise_strength = refraction_noise_strength,
775-
.refraction_noise_scale = refraction_noise_scale,
776772
};
777773

778774
bool keep_blur = ctx->blur_buf && ctx->blur_native[0] && ctx->blur_gen == ctx->backdrop_gen;

src/effects_gles2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ struct gles2_data {
117117
GLint screen_shader_u_tex;
118118
GLint screen_shader_u_resolution;
119119
GLint screen_shader_u_time;
120-
struct timespec screen_shader_start_time;
121120

122121
GLuint vbo;
123122
GLint attr_pos;
@@ -1185,7 +1184,6 @@ static bool gles2_compile_screen_shader(const char *frag_src) {
11851184
g->screen_shader_u_tex = glGetUniformLocation(prog, "tex");
11861185
g->screen_shader_u_resolution = glGetUniformLocation(prog, "resolution");
11871186
g->screen_shader_u_time = glGetUniformLocation(prog, "time");
1188-
clock_gettime(CLOCK_MONOTONIC, &g->screen_shader_start_time);
11891187
return true;
11901188
}
11911189

0 commit comments

Comments
 (0)