format code

This commit is contained in:
DreamMaoMao 2025-06-14 21:45:06 +08:00
parent 247463a1dd
commit 20d132de3f
2 changed files with 87 additions and 90 deletions

View file

@ -686,7 +686,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
} else if (strcmp(func_name, "focusmon") == 0) {
func = focusmon;
(*arg).i = parse_direction(arg_value);
if((*arg).i == UNDIR) {
if ((*arg).i == UNDIR) {
(*arg).v = strdup(arg_value);
}
} else if (strcmp(func_name, "tagmon") == 0) {

View file

@ -1132,9 +1132,11 @@ void apply_border(Client *c) {
// These values will be positive when window is outside the monitor
int outside_left = GEZERO(c->mon->m.x - c->animation.current.x);
int outside_top = GEZERO(c->mon->m.y - c->animation.current.y);
int outside_right = GEZERO((c->animation.current.x + c->animation.current.width) -
int outside_right =
GEZERO((c->animation.current.x + c->animation.current.width) -
(c->mon->m.x + c->mon->m.width));
int outside_bottom = GEZERO((c->animation.current.y + c->animation.current.height) -
int outside_bottom =
GEZERO((c->animation.current.y + c->animation.current.height) -
(c->mon->m.y + c->mon->m.height));
// Initialize border dimensions
@ -1158,7 +1160,8 @@ void apply_border(Client *c) {
int right_y = bw;
// Adjust borders when window is outside monitor
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted || c->animation.tagouting) {
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted ||
c->animation.tagouting) {
// Top border - reduce height when window goes above monitor
if (outside_top > 0) {
top_height = GEZERO(bw - outside_top);
@ -1192,13 +1195,10 @@ void apply_border(Client *c) {
top_width = top_width - outside_right;
bottom_width = bottom_width - outside_right;
}
}
// Position the surface within the borders
wlr_scene_node_set_position(&c->scene_surface->node,
bw,
bw);
wlr_scene_node_set_position(&c->scene_surface->node, bw, bw);
// Set border sizes
set_rect_size(c->border[0], top_width, top_height); // Top
@ -1207,12 +1207,10 @@ void apply_border(Client *c) {
set_rect_size(c->border[3], right_width, right_height); // Right
// Position borders with offsets
wlr_scene_node_set_position(&c->border[0]->node, top_x, top_y );
wlr_scene_node_set_position(&c->border[0]->node, top_x, top_y);
wlr_scene_node_set_position(&c->border[1]->node, bottom_x, bottom_y);
wlr_scene_node_set_position(&c->border[2]->node, left_x , left_y);
wlr_scene_node_set_position(&c->border[2]->node, left_x, left_y);
wlr_scene_node_set_position(&c->border[3]->node, right_x, right_y);
}
struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
@ -1236,9 +1234,8 @@ struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
clip_box->width = clip_box->width - offsetx;
} else if (c->animation.current.x + c->animation.current.width >
c->mon->m.x + c->mon->m.width) {
clip_box->width =
clip_box->width -
(c->animation.current.x + c->animation.current.width -
clip_box->width = clip_box->width - (c->animation.current.x +
c->animation.current.width -
c->mon->m.x - c->mon->m.width);
}
@ -4083,12 +4080,12 @@ void focusmon(const Arg *arg) {
do /* don't switch to disabled mons */
selmon = dirtomon(arg->i);
while (!selmon->wlr_output->enabled && i++ < nmons);
} else if(arg->v) {
} else if (arg->v) {
wl_list_for_each(m, &mons, link) {
if (!m->wlr_output->enabled) {
continue;
}
if(regex_match(arg->v, m->wlr_output->name)) {
if (regex_match(arg->v, m->wlr_output->name)) {
selmon = m;
break;
}