feat: add dispatch toggle_render_border

This commit is contained in:
DreamMaoMao 2025-05-05 14:22:56 +08:00
parent 20f05bcdcc
commit f115f87241
3 changed files with 19 additions and 1 deletions

View file

@ -491,6 +491,8 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, char *arg_v
func = restore_minized; func = restore_minized;
} else if (strcmp(func_name, "toggle_scratchpad") == 0) { } else if (strcmp(func_name, "toggle_scratchpad") == 0) {
func = toggle_scratchpad; func = toggle_scratchpad;
} else if (strcmp(func_name, "toggle_render_border") == 0) {
func = toggle_render_border;
} else if (strcmp(func_name, "focusmon") == 0) { } else if (strcmp(func_name, "focusmon") == 0) {
func = focusmon; func = focusmon;
(*arg).i = parse_direction(arg_value); (*arg).i = parse_direction(arg_value);

View file

@ -53,4 +53,5 @@ void togglefakefullscreen(const Arg *arg);
void toggleoverlay(const Arg *arg); void toggleoverlay(const Arg *arg);
void movewin(const Arg *arg); void movewin(const Arg *arg);
void resizewin(const Arg *arg); void resizewin(const Arg *arg);
void toggle_named_scratch(const Arg *arg); void toggle_named_scratch(const Arg *arg);
void toggle_render_border(const Arg *arg);

View file

@ -702,6 +702,8 @@ static uint32_t swipe_fingers = 0;
static double swipe_dx = 0; static double swipe_dx = 0;
static double swipe_dy = 0; static double swipe_dy = 0;
bool render_border = true;
/* global event handlers */ /* global event handlers */
static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = { static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = {
.release = dwl_ipc_manager_release, .release = dwl_ipc_manager_release,
@ -1056,6 +1058,14 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
if (c->iskilling || !client_surface(c)->mapped) if (c->iskilling || !client_surface(c)->mapped)
return; return;
if(!render_border) {
set_rect_size(c->border[0], 0, 0);
set_rect_size(c->border[1], 0, 0);
set_rect_size(c->border[2], 0, 0);
set_rect_size(c->border[3], 0, 0);
return;
}
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw); wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
set_rect_size(c->border[0], clip_box.width, c->bw); set_rect_size(c->border[0], clip_box.width, c->bw);
set_rect_size(c->border[1], clip_box.width, c->bw); set_rect_size(c->border[1], clip_box.width, c->bw);
@ -1450,6 +1460,11 @@ bool switch_scratch_client_state(Client *c) {
return false; return false;
} }
void toggle_render_border(const Arg *arg) {
render_border = !render_border;
arrange(selmon, false);
}
void toggle_named_scratch(const Arg *arg) { void toggle_named_scratch(const Arg *arg) {
Client *c = NULL; Client *c = NULL;
Client *target_client = NULL; Client *target_client = NULL;