mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-05 06:47:12 -04:00
Merge branch 'main' into tag-to-silent
This commit is contained in:
commit
0162b0011a
62 changed files with 5229 additions and 1539 deletions
|
|
@ -10,20 +10,21 @@ void set_rect_size(struct wlr_scene_rect *rect, int32_t width, int32_t height) {
|
|||
|
||||
enum corner_location set_client_corner_location(Client *c) {
|
||||
enum corner_location current_corner_location = CORNER_LOCATION_ALL;
|
||||
struct wlr_box target_geom = animations ? c->animation.current : c->geom;
|
||||
if (target_geom.x + border_radius <= c->mon->m.x) {
|
||||
current_corner_location &= ~CORNER_LOCATION_LEFT; // 清除左标志位
|
||||
struct wlr_box target_geom =
|
||||
config.animations ? c->animation.current : c->geom;
|
||||
if (target_geom.x + config.border_radius <= c->mon->m.x) {
|
||||
current_corner_location &= ~CORNER_LOCATION_LEFT;
|
||||
}
|
||||
if (target_geom.x + target_geom.width - border_radius >=
|
||||
if (target_geom.x + target_geom.width - config.border_radius >=
|
||||
c->mon->m.x + c->mon->m.width) {
|
||||
current_corner_location &= ~CORNER_LOCATION_RIGHT; // 清除右标志位
|
||||
current_corner_location &= ~CORNER_LOCATION_RIGHT;
|
||||
}
|
||||
if (target_geom.y + border_radius <= c->mon->m.y) {
|
||||
current_corner_location &= ~CORNER_LOCATION_TOP; // 清除上标志位
|
||||
if (target_geom.y + config.border_radius <= c->mon->m.y) {
|
||||
current_corner_location &= ~CORNER_LOCATION_TOP;
|
||||
}
|
||||
if (target_geom.y + target_geom.height - border_radius >=
|
||||
if (target_geom.y + target_geom.height - config.border_radius >=
|
||||
c->mon->m.y + c->mon->m.height) {
|
||||
current_corner_location &= ~CORNER_LOCATION_BOTTOM; // 清除下标志位
|
||||
current_corner_location &= ~CORNER_LOCATION_BOTTOM;
|
||||
}
|
||||
return current_corner_location;
|
||||
}
|
||||
|
|
@ -54,15 +55,16 @@ int32_t is_special_animation_rule(Client *c) {
|
|||
} else if (c->mon->visible_tiling_clients == 1 && !c->isfloating) {
|
||||
return DOWN;
|
||||
} else if (c->mon->visible_tiling_clients == 2 && !c->isfloating &&
|
||||
!new_is_master && is_horizontal_stack_layout(c->mon)) {
|
||||
!config.new_is_master && is_horizontal_stack_layout(c->mon)) {
|
||||
return RIGHT;
|
||||
} else if (!c->isfloating && new_is_master &&
|
||||
} else if (!c->isfloating && config.new_is_master &&
|
||||
is_horizontal_stack_layout(c->mon)) {
|
||||
return LEFT;
|
||||
} else if (c->mon->visible_tiling_clients == 2 && !c->isfloating &&
|
||||
!new_is_master && is_horizontal_right_stack_layout(c->mon)) {
|
||||
!config.new_is_master &&
|
||||
is_horizontal_right_stack_layout(c->mon)) {
|
||||
return LEFT;
|
||||
} else if (!c->isfloating && new_is_master &&
|
||||
} else if (!c->isfloating && config.new_is_master &&
|
||||
is_horizontal_right_stack_layout(c->mon)) {
|
||||
return RIGHT;
|
||||
} else {
|
||||
|
|
@ -77,7 +79,8 @@ void set_client_open_animation(Client *c, struct wlr_box geo) {
|
|||
int32_t special_direction;
|
||||
int32_t center_x, center_y;
|
||||
|
||||
if ((!c->animation_type_open && strcmp(animation_type_open, "fade") == 0) ||
|
||||
if ((!c->animation_type_open &&
|
||||
strcmp(config.animation_type_open, "fade") == 0) ||
|
||||
(c->animation_type_open &&
|
||||
strcmp(c->animation_type_open, "fade") == 0)) {
|
||||
c->animainit_geom.width = geo.width;
|
||||
|
|
@ -86,11 +89,11 @@ void set_client_open_animation(Client *c, struct wlr_box geo) {
|
|||
c->animainit_geom.y = geo.y;
|
||||
return;
|
||||
} else if ((!c->animation_type_open &&
|
||||
strcmp(animation_type_open, "zoom") == 0) ||
|
||||
strcmp(config.animation_type_open, "zoom") == 0) ||
|
||||
(c->animation_type_open &&
|
||||
strcmp(c->animation_type_open, "zoom") == 0)) {
|
||||
c->animainit_geom.width = geo.width * zoom_initial_ratio;
|
||||
c->animainit_geom.height = geo.height * zoom_initial_ratio;
|
||||
c->animainit_geom.width = geo.width * config.zoom_initial_ratio;
|
||||
c->animainit_geom.height = geo.height * config.zoom_initial_ratio;
|
||||
c->animainit_geom.x = geo.x + (geo.width - c->animainit_geom.width) / 2;
|
||||
c->animainit_geom.y =
|
||||
geo.y + (geo.height - c->animainit_geom.height) / 2;
|
||||
|
|
@ -223,7 +226,7 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int32_t sx,
|
|||
if (wlr_xdg_popup_try_from_wlr_surface(surface) != NULL)
|
||||
return;
|
||||
|
||||
wlr_scene_buffer_set_corner_radius(buffer, border_radius,
|
||||
wlr_scene_buffer_set_corner_radius(buffer, config.border_radius,
|
||||
buffer_data->corner_location);
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +244,7 @@ void buffer_set_effect(Client *c, BufferData data) {
|
|||
data.should_scale = false;
|
||||
|
||||
if (c->isnoradius || c->isfullscreen ||
|
||||
(no_radius_when_single && c->mon &&
|
||||
(config.no_radius_when_single && c->mon &&
|
||||
c->mon->visible_tiling_clients == 1)) {
|
||||
data.corner_location = CORNER_LOCATION_NONE;
|
||||
}
|
||||
|
|
@ -255,7 +258,7 @@ void client_draw_shadow(Client *c) {
|
|||
if (c->iskilling || !client_surface(c)->mapped || c->isnoshadow)
|
||||
return;
|
||||
|
||||
if (!shadows || (!c->isfloating && shadow_only_floating)) {
|
||||
if (!config.shadows || (!c->isfloating && config.shadow_only_floating)) {
|
||||
if (c->shadow->node.enabled)
|
||||
wlr_scene_node_set_enabled(&c->shadow->node, false);
|
||||
return;
|
||||
|
|
@ -266,7 +269,7 @@ void client_draw_shadow(Client *c) {
|
|||
|
||||
bool hit_no_border = check_hit_no_border(c);
|
||||
enum corner_location current_corner_location =
|
||||
c->isfullscreen || (no_radius_when_single && c->mon &&
|
||||
c->isfullscreen || (config.no_radius_when_single && c->mon &&
|
||||
c->mon->visible_tiling_clients == 1)
|
||||
? CORNER_LOCATION_NONE
|
||||
: CORNER_LOCATION_ALL;
|
||||
|
|
@ -276,9 +279,8 @@ void client_draw_shadow(Client *c) {
|
|||
int32_t width, height;
|
||||
client_actual_size(c, &width, &height);
|
||||
|
||||
int32_t delta = shadows_size + (int32_t)c->bw - bwoffset;
|
||||
int32_t delta = config.shadows_size + (int32_t)c->bw - bwoffset;
|
||||
|
||||
/* we calculate where to clip the shadow */
|
||||
struct wlr_box client_box = {
|
||||
.x = bwoffset,
|
||||
.y = bwoffset,
|
||||
|
|
@ -287,22 +289,20 @@ void client_draw_shadow(Client *c) {
|
|||
};
|
||||
|
||||
struct wlr_box shadow_box = {
|
||||
.x = shadows_position_x + bwoffset,
|
||||
.y = shadows_position_y + bwoffset,
|
||||
.x = config.shadows_position_x + bwoffset,
|
||||
.y = config.shadows_position_y + bwoffset,
|
||||
.width = width + 2 * delta,
|
||||
.height = height + 2 * delta,
|
||||
};
|
||||
|
||||
struct wlr_box intersection_box;
|
||||
wlr_box_intersection(&intersection_box, &client_box, &shadow_box);
|
||||
/* clipped region takes shadow relative coords, so we translate everything
|
||||
* by its position */
|
||||
intersection_box.x -= shadows_position_x + bwoffset;
|
||||
intersection_box.y -= shadows_position_y + bwoffset;
|
||||
intersection_box.x -= config.shadows_position_x + bwoffset;
|
||||
intersection_box.y -= config.shadows_position_y + bwoffset;
|
||||
|
||||
struct clipped_region clipped_region = {
|
||||
.area = intersection_box,
|
||||
.corner_radius = border_radius,
|
||||
.corner_radius = config.border_radius,
|
||||
.corners = current_corner_location,
|
||||
};
|
||||
|
||||
|
|
@ -356,23 +356,23 @@ void apply_border(Client *c) {
|
|||
|
||||
bool hit_no_border = check_hit_no_border(c);
|
||||
enum corner_location current_corner_location;
|
||||
if (c->isfullscreen || (no_radius_when_single && c->mon &&
|
||||
if (c->isfullscreen || (config.no_radius_when_single && c->mon &&
|
||||
c->mon->visible_tiling_clients == 1)) {
|
||||
current_corner_location = CORNER_LOCATION_NONE;
|
||||
} else {
|
||||
current_corner_location = set_client_corner_location(c);
|
||||
}
|
||||
|
||||
if (hit_no_border && smartgaps) {
|
||||
if (hit_no_border && config.smartgaps) {
|
||||
c->bw = 0;
|
||||
c->fake_no_border = true;
|
||||
} else if (hit_no_border && !smartgaps) {
|
||||
} else if (hit_no_border && !config.smartgaps) {
|
||||
wlr_scene_rect_set_size(c->border, 0, 0);
|
||||
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
||||
c->fake_no_border = true;
|
||||
return;
|
||||
} else if (!c->isfullscreen && VISIBLEON(c, c->mon)) {
|
||||
c->bw = c->isnoborder ? 0 : borderpx;
|
||||
c->bw = c->isnoborder ? 0 : config.borderpx;
|
||||
c->fake_no_border = false;
|
||||
}
|
||||
|
||||
|
|
@ -434,14 +434,14 @@ void apply_border(Client *c) {
|
|||
struct clipped_region clipped_region = {
|
||||
.area = {inner_surface_x, inner_surface_y, inner_surface_width,
|
||||
inner_surface_height},
|
||||
.corner_radius = border_radius,
|
||||
.corner_radius = config.border_radius,
|
||||
.corners = current_corner_location,
|
||||
};
|
||||
|
||||
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
||||
wlr_scene_rect_set_size(c->border, rect_width, rect_height);
|
||||
wlr_scene_node_set_position(&c->border->node, rect_x, rect_y);
|
||||
wlr_scene_rect_set_corner_radius(c->border, border_radius,
|
||||
wlr_scene_rect_set_corner_radius(c->border, config.border_radius,
|
||||
current_corner_location);
|
||||
wlr_scene_rect_set_clipped_region(c->border, clipped_region);
|
||||
}
|
||||
|
|
@ -523,7 +523,7 @@ void client_apply_clip(Client *c, float factor) {
|
|||
enum corner_location current_corner_location =
|
||||
set_client_corner_location(c);
|
||||
|
||||
if (!animations) {
|
||||
if (!config.animations) {
|
||||
c->animation.running = false;
|
||||
c->need_output_flush = false;
|
||||
c->animainit_geom = c->current = c->pending = c->animation.current =
|
||||
|
|
@ -655,19 +655,19 @@ void fadeout_client_animation_next_tick(Client *c) {
|
|||
double opacity_eased_progress =
|
||||
find_animation_curve_at(animation_passed, OPAFADEOUT);
|
||||
|
||||
double percent = fadeout_begin_opacity -
|
||||
(opacity_eased_progress * fadeout_begin_opacity);
|
||||
double percent = config.fadeout_begin_opacity -
|
||||
(opacity_eased_progress * config.fadeout_begin_opacity);
|
||||
|
||||
double opacity = MAX(percent, 0);
|
||||
|
||||
if (animation_fade_out && !c->nofadeout)
|
||||
if (config.animation_fade_out && !c->nofadeout)
|
||||
wlr_scene_node_for_each_buffer(&c->scene->node,
|
||||
scene_buffer_apply_opacity, &opacity);
|
||||
|
||||
if ((c->animation_type_close &&
|
||||
strcmp(c->animation_type_close, "zoom") == 0) ||
|
||||
(!c->animation_type_close &&
|
||||
strcmp(animation_type_close, "zoom") == 0)) {
|
||||
strcmp(config.animation_type_close, "zoom") == 0)) {
|
||||
|
||||
buffer_data.width = width;
|
||||
buffer_data.height = height;
|
||||
|
|
@ -723,6 +723,8 @@ void client_animation_next_tick(Client *c) {
|
|||
|
||||
c->is_pending_open_animation = false;
|
||||
|
||||
client_apply_clip(c, factor);
|
||||
|
||||
if (animation_passed >= 1.0) {
|
||||
|
||||
// clear the open action state
|
||||
|
|
@ -752,8 +754,6 @@ void client_animation_next_tick(Client *c) {
|
|||
// end flush in next frame, not the current frame
|
||||
c->need_output_flush = false;
|
||||
}
|
||||
|
||||
client_apply_clip(c, factor);
|
||||
}
|
||||
|
||||
void init_fadeout_client(Client *c) {
|
||||
|
|
@ -768,14 +768,14 @@ void init_fadeout_client(Client *c) {
|
|||
if ((c->animation_type_close &&
|
||||
strcmp(c->animation_type_close, "none") == 0) ||
|
||||
(!c->animation_type_close &&
|
||||
strcmp(animation_type_close, "none") == 0)) {
|
||||
strcmp(config.animation_type_close, "none") == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Client *fadeout_client = ecalloc(1, sizeof(*fadeout_client));
|
||||
|
||||
wlr_scene_node_set_enabled(&c->scene->node, true);
|
||||
client_set_border_color(c, bordercolor);
|
||||
client_set_border_color(c, config.bordercolor);
|
||||
fadeout_client->scene =
|
||||
wlr_scene_tree_snapshot(&c->scene->node, layers[LyrFadeOut]);
|
||||
wlr_scene_node_set_enabled(&c->scene->node, false);
|
||||
|
|
@ -785,7 +785,7 @@ void init_fadeout_client(Client *c) {
|
|||
return;
|
||||
}
|
||||
|
||||
fadeout_client->animation.duration = animation_duration_close;
|
||||
fadeout_client->animation.duration = config.animation_duration_close;
|
||||
fadeout_client->geom = fadeout_client->current =
|
||||
fadeout_client->animainit_geom = fadeout_client->animation.initial =
|
||||
c->animation.current;
|
||||
|
|
@ -802,7 +802,7 @@ void init_fadeout_client(Client *c) {
|
|||
fadeout_client->animation.initial.y = 0;
|
||||
|
||||
if ((!c->animation_type_close &&
|
||||
strcmp(animation_type_close, "fade") == 0) ||
|
||||
strcmp(config.animation_type_close, "fade") == 0) ||
|
||||
(c->animation_type_close &&
|
||||
strcmp(c->animation_type_close, "fade") == 0)) {
|
||||
fadeout_client->current.x = 0;
|
||||
|
|
@ -812,7 +812,7 @@ void init_fadeout_client(Client *c) {
|
|||
} else if ((c->animation_type_close &&
|
||||
strcmp(c->animation_type_close, "slide") == 0) ||
|
||||
(!c->animation_type_close &&
|
||||
strcmp(animation_type_close, "slide") == 0)) {
|
||||
strcmp(config.animation_type_close, "slide") == 0)) {
|
||||
fadeout_client->current.y =
|
||||
c->geom.y + c->geom.height / 2 > c->mon->m.y + c->mon->m.height / 2
|
||||
? c->mon->m.height -
|
||||
|
|
@ -822,16 +822,16 @@ void init_fadeout_client(Client *c) {
|
|||
} else {
|
||||
fadeout_client->current.y =
|
||||
(fadeout_client->geom.height -
|
||||
fadeout_client->geom.height * zoom_end_ratio) /
|
||||
fadeout_client->geom.height * config.zoom_end_ratio) /
|
||||
2;
|
||||
fadeout_client->current.x =
|
||||
(fadeout_client->geom.width -
|
||||
fadeout_client->geom.width * zoom_end_ratio) /
|
||||
fadeout_client->geom.width * config.zoom_end_ratio) /
|
||||
2;
|
||||
fadeout_client->current.width =
|
||||
fadeout_client->geom.width * zoom_end_ratio;
|
||||
fadeout_client->geom.width * config.zoom_end_ratio;
|
||||
fadeout_client->current.height =
|
||||
fadeout_client->geom.height * zoom_end_ratio;
|
||||
fadeout_client->geom.height * config.zoom_end_ratio;
|
||||
}
|
||||
|
||||
fadeout_client->animation.time_started = get_now_in_ms();
|
||||
|
|
@ -866,12 +866,11 @@ void client_set_pending_state(Client *c) {
|
|||
if (!c || c->iskilling)
|
||||
return;
|
||||
|
||||
// 判断是否需要动画
|
||||
if (!animations) {
|
||||
if (!config.animations) {
|
||||
c->animation.should_animate = false;
|
||||
} else if (animations && c->animation.tagining) {
|
||||
} else if (config.animations && c->animation.tagining) {
|
||||
c->animation.should_animate = true;
|
||||
} else if (!animations || c == grabc ||
|
||||
} else if (!config.animations || c == grabc ||
|
||||
(!c->is_pending_open_animation &&
|
||||
wlr_box_equal(&c->current, &c->pending))) {
|
||||
c->animation.should_animate = false;
|
||||
|
|
@ -882,7 +881,7 @@ void client_set_pending_state(Client *c) {
|
|||
if (((c->animation_type_open &&
|
||||
strcmp(c->animation_type_open, "none") == 0) ||
|
||||
(!c->animation_type_open &&
|
||||
strcmp(animation_type_open, "none") == 0)) &&
|
||||
strcmp(config.animation_type_open, "none") == 0)) &&
|
||||
c->animation.action == OPEN) {
|
||||
c->animation.duration = 0;
|
||||
}
|
||||
|
|
@ -951,16 +950,16 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
|||
!c->animation.tagouting && wlr_box_equal(&c->geom, &c->current)) {
|
||||
c->animation.action = c->animation.action;
|
||||
} else if (c->animation.tagouting) {
|
||||
c->animation.duration = animation_duration_tag;
|
||||
c->animation.duration = config.animation_duration_tag;
|
||||
c->animation.action = TAG;
|
||||
} else if (c->animation.tagining) {
|
||||
c->animation.duration = animation_duration_tag;
|
||||
c->animation.duration = config.animation_duration_tag;
|
||||
c->animation.action = TAG;
|
||||
} else if (c->is_pending_open_animation) {
|
||||
c->animation.duration = animation_duration_open;
|
||||
c->animation.duration = config.animation_duration_open;
|
||||
c->animation.action = OPEN;
|
||||
} else {
|
||||
c->animation.duration = animation_duration_move;
|
||||
c->animation.duration = config.animation_duration_move;
|
||||
c->animation.action = MOVE;
|
||||
}
|
||||
|
||||
|
|
@ -981,7 +980,7 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
|||
}
|
||||
|
||||
bool hit_no_border = check_hit_no_border(c);
|
||||
if (hit_no_border && smartgaps) {
|
||||
if (hit_no_border && config.smartgaps) {
|
||||
c->bw = 0;
|
||||
c->fake_no_border = true;
|
||||
}
|
||||
|
|
@ -990,6 +989,10 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
|||
c->configure_serial = client_set_size(c, c->geom.width - 2 * c->bw,
|
||||
c->geom.height - 2 * c->bw);
|
||||
|
||||
if (c->configure_serial != 0) {
|
||||
c->mon->resizing_count_pending++;
|
||||
}
|
||||
|
||||
if (c == grabc) {
|
||||
c->animation.running = false;
|
||||
c->need_output_flush = false;
|
||||
|
|
@ -1044,12 +1047,12 @@ bool client_draw_fadeout_frame(Client *c) {
|
|||
void client_set_focused_opacity_animation(Client *c) {
|
||||
float *border_color = get_border_color(c);
|
||||
|
||||
if (!animations) {
|
||||
if (!config.animations) {
|
||||
setborder_color(c);
|
||||
return;
|
||||
}
|
||||
|
||||
c->opacity_animation.duration = animation_duration_focus;
|
||||
c->opacity_animation.duration = config.animation_duration_focus;
|
||||
memcpy(c->opacity_animation.target_border_color, border_color,
|
||||
sizeof(c->opacity_animation.target_border_color));
|
||||
c->opacity_animation.target_opacity = c->focused_opacity;
|
||||
|
|
@ -1063,15 +1066,14 @@ void client_set_focused_opacity_animation(Client *c) {
|
|||
}
|
||||
|
||||
void client_set_unfocused_opacity_animation(Client *c) {
|
||||
// Start border color animation to unfocused
|
||||
float *border_color = get_border_color(c);
|
||||
|
||||
if (!animations) {
|
||||
if (!config.animations) {
|
||||
setborder_color(c);
|
||||
return;
|
||||
}
|
||||
|
||||
c->opacity_animation.duration = animation_duration_focus;
|
||||
c->opacity_animation.duration = config.animation_duration_focus;
|
||||
memcpy(c->opacity_animation.target_border_color, border_color,
|
||||
sizeof(c->opacity_animation.target_border_color));
|
||||
// Start opacity animation to unfocused
|
||||
|
|
@ -1106,13 +1108,14 @@ bool client_apply_focus_opacity(Client *c) {
|
|||
double opacity_eased_progress =
|
||||
find_animation_curve_at(linear_progress, OPAFADEIN);
|
||||
|
||||
float percent =
|
||||
animation_fade_in && !c->nofadein ? opacity_eased_progress : 1.0;
|
||||
float percent = config.animation_fade_in && !c->nofadein
|
||||
? opacity_eased_progress
|
||||
: 1.0;
|
||||
float opacity =
|
||||
c == selmon->sel ? c->focused_opacity : c->unfocused_opacity;
|
||||
|
||||
float target_opacity =
|
||||
percent * (1.0 - fadein_begin_opacity) + fadein_begin_opacity;
|
||||
float target_opacity = percent * (1.0 - config.fadein_begin_opacity) +
|
||||
config.fadein_begin_opacity;
|
||||
if (target_opacity > opacity) {
|
||||
target_opacity = opacity;
|
||||
}
|
||||
|
|
@ -1122,7 +1125,7 @@ bool client_apply_focus_opacity(Client *c) {
|
|||
c->opacity_animation.current_opacity = target_opacity;
|
||||
client_set_opacity(c, target_opacity);
|
||||
client_set_border_color(c, c->opacity_animation.target_border_color);
|
||||
} else if (animations && c->opacity_animation.running) {
|
||||
} else if (config.animations && c->opacity_animation.running) {
|
||||
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
|
@ -1183,7 +1186,7 @@ bool client_draw_frame(Client *c) {
|
|||
return client_apply_focus_opacity(c);
|
||||
}
|
||||
|
||||
if (animations && c->animation.running) {
|
||||
if (config.animations && c->animation.running) {
|
||||
client_animation_next_tick(c);
|
||||
} else {
|
||||
wlr_scene_node_set_position(&c->scene->node, c->pending.x,
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@ struct dvec2 calculate_animation_curve_at(double t, int32_t type) {
|
|||
struct dvec2 point;
|
||||
double *animation_curve;
|
||||
if (type == MOVE) {
|
||||
animation_curve = animation_curve_move;
|
||||
animation_curve = config.animation_curve_move;
|
||||
} else if (type == OPEN) {
|
||||
animation_curve = animation_curve_open;
|
||||
animation_curve = config.animation_curve_open;
|
||||
} else if (type == TAG) {
|
||||
animation_curve = animation_curve_tag;
|
||||
animation_curve = config.animation_curve_tag;
|
||||
} else if (type == CLOSE) {
|
||||
animation_curve = animation_curve_close;
|
||||
animation_curve = config.animation_curve_close;
|
||||
} else if (type == FOCUS) {
|
||||
animation_curve = animation_curve_focus;
|
||||
animation_curve = config.animation_curve_focus;
|
||||
} else if (type == OPAFADEIN) {
|
||||
animation_curve = animation_curve_opafadein;
|
||||
animation_curve = config.animation_curve_opafadein;
|
||||
} else if (type == OPAFADEOUT) {
|
||||
animation_curve = animation_curve_opafadeout;
|
||||
animation_curve = config.animation_curve_opafadeout;
|
||||
} else {
|
||||
animation_curve = animation_curve_move;
|
||||
animation_curve = config.animation_curve_move;
|
||||
}
|
||||
|
||||
point.x = 3 * t * (1 - t) * (1 - t) * animation_curve[0] +
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ void layer_draw_shadow(LayerSurface *l) {
|
|||
if (!l->mapped || !l->shadow)
|
||||
return;
|
||||
|
||||
if (!shadows || !layer_shadows || l->noshadow) {
|
||||
if (!config.shadows || !config.layer_shadows || l->noshadow) {
|
||||
wlr_scene_shadow_set_size(l->shadow, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
|
@ -164,9 +164,8 @@ void layer_draw_shadow(LayerSurface *l) {
|
|||
int32_t width, height;
|
||||
layer_actual_size(l, &width, &height);
|
||||
|
||||
int32_t delta = shadows_size;
|
||||
int32_t delta = config.shadows_size;
|
||||
|
||||
/* we calculate where to clip the shadow */
|
||||
struct wlr_box layer_box = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
|
|
@ -175,23 +174,21 @@ void layer_draw_shadow(LayerSurface *l) {
|
|||
};
|
||||
|
||||
struct wlr_box shadow_box = {
|
||||
.x = shadows_position_x,
|
||||
.y = shadows_position_y,
|
||||
.x = config.shadows_position_x,
|
||||
.y = config.shadows_position_y,
|
||||
.width = width + 2 * delta,
|
||||
.height = height + 2 * delta,
|
||||
};
|
||||
|
||||
struct wlr_box intersection_box;
|
||||
wlr_box_intersection(&intersection_box, &layer_box, &shadow_box);
|
||||
/* clipped region takes shadow relative coords, so we translate everything
|
||||
* by its position */
|
||||
intersection_box.x -= shadows_position_x;
|
||||
intersection_box.y -= shadows_position_y;
|
||||
intersection_box.x -= config.shadows_position_x;
|
||||
intersection_box.y -= config.shadows_position_y;
|
||||
|
||||
struct clipped_region clipped_region = {
|
||||
.area = intersection_box,
|
||||
.corner_radius = border_radius,
|
||||
.corners = border_radius_location_default,
|
||||
.corner_radius = config.border_radius,
|
||||
.corners = config.border_radius_location_default,
|
||||
};
|
||||
|
||||
wlr_scene_node_set_position(&l->shadow->node, shadow_box.x, shadow_box.y);
|
||||
|
|
@ -261,7 +258,7 @@ void fadeout_layer_animation_next_tick(LayerSurface *l) {
|
|||
buffer_data.height = height;
|
||||
|
||||
if ((!l->animation_type_close &&
|
||||
strcmp(layer_animation_type_close, "zoom") == 0) ||
|
||||
strcmp(config.layer_animation_type_close, "zoom") == 0) ||
|
||||
(l->animation_type_close &&
|
||||
strcmp(l->animation_type_close, "zoom") == 0)) {
|
||||
wlr_scene_node_for_each_buffer(&l->scene->node,
|
||||
|
|
@ -279,12 +276,12 @@ void fadeout_layer_animation_next_tick(LayerSurface *l) {
|
|||
double opacity_eased_progress =
|
||||
find_animation_curve_at(animation_passed, OPAFADEOUT);
|
||||
|
||||
double percent = fadeout_begin_opacity -
|
||||
(opacity_eased_progress * fadeout_begin_opacity);
|
||||
double percent = config.fadeout_begin_opacity -
|
||||
(opacity_eased_progress * config.fadeout_begin_opacity);
|
||||
|
||||
double opacity = MAX(percent, 0.0f);
|
||||
|
||||
if (animation_fade_out)
|
||||
if (config.animation_fade_out)
|
||||
wlr_scene_node_for_each_buffer(&l->scene->node,
|
||||
scene_buffer_apply_opacity, &opacity);
|
||||
|
||||
|
|
@ -327,11 +324,11 @@ void layer_animation_next_tick(LayerSurface *l) {
|
|||
find_animation_curve_at(animation_passed, OPAFADEIN);
|
||||
|
||||
double opacity =
|
||||
MIN(fadein_begin_opacity +
|
||||
opacity_eased_progress * (1.0 - fadein_begin_opacity),
|
||||
MIN(config.fadein_begin_opacity +
|
||||
opacity_eased_progress * (1.0 - config.fadein_begin_opacity),
|
||||
1.0f);
|
||||
|
||||
if (animation_fade_in)
|
||||
if (config.animation_fade_in)
|
||||
wlr_scene_node_for_each_buffer(&l->scene->node,
|
||||
scene_buffer_apply_opacity, &opacity);
|
||||
|
||||
|
|
@ -347,7 +344,7 @@ void layer_animation_next_tick(LayerSurface *l) {
|
|||
}
|
||||
|
||||
if ((!l->animation_type_open &&
|
||||
strcmp(layer_animation_type_open, "zoom") == 0) ||
|
||||
strcmp(config.layer_animation_type_open, "zoom") == 0) ||
|
||||
(l->animation_type_open &&
|
||||
strcmp(l->animation_type_open, "zoom") == 0)) {
|
||||
wlr_scene_node_for_each_buffer(
|
||||
|
|
@ -370,7 +367,7 @@ void layer_animation_next_tick(LayerSurface *l) {
|
|||
|
||||
void init_fadeout_layers(LayerSurface *l) {
|
||||
|
||||
if (!animations || !layer_animations || l->noanim) {
|
||||
if (!config.animations || !config.layer_animations || l->noanim) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -380,7 +377,7 @@ void init_fadeout_layers(LayerSurface *l) {
|
|||
if ((l->animation_type_close &&
|
||||
strcmp(l->animation_type_close, "none") == 0) ||
|
||||
(!l->animation_type_close &&
|
||||
strcmp(layer_animation_type_close, "none") == 0)) {
|
||||
strcmp(config.layer_animation_type_close, "none") == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -403,7 +400,7 @@ void init_fadeout_layers(LayerSurface *l) {
|
|||
return;
|
||||
}
|
||||
|
||||
fadeout_layer->animation.duration = animation_duration_close;
|
||||
fadeout_layer->animation.duration = config.animation_duration_close;
|
||||
fadeout_layer->geom = fadeout_layer->current =
|
||||
fadeout_layer->animainit_geom = fadeout_layer->animation.initial =
|
||||
l->animation.current;
|
||||
|
|
@ -419,14 +416,14 @@ void init_fadeout_layers(LayerSurface *l) {
|
|||
fadeout_layer->animation.initial.y = 0;
|
||||
|
||||
if ((!l->animation_type_close &&
|
||||
strcmp(layer_animation_type_close, "zoom") == 0) ||
|
||||
strcmp(config.layer_animation_type_close, "zoom") == 0) ||
|
||||
(l->animation_type_close &&
|
||||
strcmp(l->animation_type_close, "zoom") == 0)) {
|
||||
// 算出要设置的绝对坐标和大小
|
||||
fadeout_layer->current.width =
|
||||
(float)l->animation.current.width * zoom_end_ratio;
|
||||
(float)l->animation.current.width * config.zoom_end_ratio;
|
||||
fadeout_layer->current.height =
|
||||
(float)l->animation.current.height * zoom_end_ratio;
|
||||
(float)l->animation.current.height * config.zoom_end_ratio;
|
||||
fadeout_layer->current.x = usable_area.x + usable_area.width / 2 -
|
||||
fadeout_layer->current.width / 2;
|
||||
fadeout_layer->current.y = usable_area.y + usable_area.height / 2 -
|
||||
|
|
@ -438,7 +435,7 @@ void init_fadeout_layers(LayerSurface *l) {
|
|||
fadeout_layer->current.y - l->animation.current.y;
|
||||
|
||||
} else if ((!l->animation_type_close &&
|
||||
strcmp(layer_animation_type_close, "slide") == 0) ||
|
||||
strcmp(config.layer_animation_type_close, "slide") == 0) ||
|
||||
(l->animation_type_close &&
|
||||
strcmp(l->animation_type_close, "slide") == 0)) {
|
||||
// 获取slide动画的结束绝对坐标和大小
|
||||
|
|
@ -483,17 +480,18 @@ void layer_set_pending_state(LayerSurface *l) {
|
|||
if (l->animation.action == OPEN && !l->animation.running) {
|
||||
|
||||
if ((!l->animation_type_open &&
|
||||
strcmp(layer_animation_type_open, "zoom") == 0) ||
|
||||
strcmp(config.layer_animation_type_open, "zoom") == 0) ||
|
||||
(l->animation_type_open &&
|
||||
strcmp(l->animation_type_open, "zoom") == 0)) {
|
||||
l->animainit_geom.width = l->geom.width * zoom_initial_ratio;
|
||||
l->animainit_geom.height = l->geom.height * zoom_initial_ratio;
|
||||
l->animainit_geom.width = l->geom.width * config.zoom_initial_ratio;
|
||||
l->animainit_geom.height =
|
||||
l->geom.height * config.zoom_initial_ratio;
|
||||
l->animainit_geom.x = usable_area.x + usable_area.width / 2 -
|
||||
l->animainit_geom.width / 2;
|
||||
l->animainit_geom.y = usable_area.y + usable_area.height / 2 -
|
||||
l->animainit_geom.height / 2;
|
||||
} else if ((!l->animation_type_open &&
|
||||
strcmp(layer_animation_type_open, "slide") == 0) ||
|
||||
strcmp(config.layer_animation_type_open, "slide") == 0) ||
|
||||
(l->animation_type_open &&
|
||||
strcmp(l->animation_type_open, "slide") == 0)) {
|
||||
|
||||
|
|
@ -507,8 +505,7 @@ void layer_set_pending_state(LayerSurface *l) {
|
|||
} else {
|
||||
l->animainit_geom = l->animation.current;
|
||||
}
|
||||
// 判断是否需要动画
|
||||
if (!animations || !layer_animations || l->noanim ||
|
||||
if (!config.animations || !config.layer_animations || l->noanim ||
|
||||
l->layer_surface->current.layer ==
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND ||
|
||||
l->layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) {
|
||||
|
|
@ -520,7 +517,7 @@ void layer_set_pending_state(LayerSurface *l) {
|
|||
if (((l->animation_type_open &&
|
||||
strcmp(l->animation_type_open, "none") == 0) ||
|
||||
(!l->animation_type_open &&
|
||||
strcmp(layer_animation_type_open, "none") == 0)) &&
|
||||
strcmp(config.layer_animation_type_open, "none") == 0)) &&
|
||||
l->animation.action == OPEN) {
|
||||
l->animation.should_animate = false;
|
||||
}
|
||||
|
|
@ -567,7 +564,8 @@ bool layer_draw_frame(LayerSurface *l) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (animations && layer_animations && l->animation.running && !l->noanim) {
|
||||
if (config.animations && config.layer_animations && l->animation.running &&
|
||||
!l->noanim) {
|
||||
layer_animation_next_tick(l);
|
||||
layer_draw_shadow(l);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ void set_tagin_animation(Monitor *m, Client *c) {
|
|||
|
||||
if (m->pertag->curtag > m->pertag->prevtag) {
|
||||
|
||||
c->animainit_geom.x = tag_animation_direction == VERTICAL
|
||||
c->animainit_geom.x = config.tag_animation_direction == VERTICAL
|
||||
? c->animation.current.x
|
||||
: MAX(c->mon->m.x + c->mon->m.width,
|
||||
c->geom.x + c->mon->m.width);
|
||||
c->animainit_geom.y = tag_animation_direction == VERTICAL
|
||||
c->animainit_geom.y = config.tag_animation_direction == VERTICAL
|
||||
? MAX(c->mon->m.y + c->mon->m.height,
|
||||
c->geom.y + c->mon->m.height)
|
||||
: c->animation.current.y;
|
||||
|
|
@ -19,11 +19,11 @@ void set_tagin_animation(Monitor *m, Client *c) {
|
|||
} else {
|
||||
|
||||
c->animainit_geom.x =
|
||||
tag_animation_direction == VERTICAL
|
||||
config.tag_animation_direction == VERTICAL
|
||||
? c->animation.current.x
|
||||
: MIN(m->m.x - c->geom.width, c->geom.x - c->mon->m.width);
|
||||
c->animainit_geom.y =
|
||||
tag_animation_direction == VERTICAL
|
||||
config.tag_animation_direction == VERTICAL
|
||||
? MIN(m->m.y - c->geom.height, c->geom.y - c->mon->m.height)
|
||||
: c->animation.current.y;
|
||||
}
|
||||
|
|
@ -39,7 +39,8 @@ void set_arrange_visible(Monitor *m, Client *c, bool want_animation) {
|
|||
client_set_suspended(c, false);
|
||||
|
||||
if (!c->animation.tag_from_rule && want_animation &&
|
||||
m->pertag->prevtag != 0 && m->pertag->curtag != 0 && animations) {
|
||||
m->pertag->prevtag != 0 && m->pertag->curtag != 0 &&
|
||||
config.animations) {
|
||||
c->animation.tagining = true;
|
||||
set_tagin_animation(m, c);
|
||||
} else {
|
||||
|
|
@ -57,10 +58,10 @@ void set_tagout_animation(Monitor *m, Client *c) {
|
|||
if (m->pertag->curtag > m->pertag->prevtag) {
|
||||
c->pending = c->geom;
|
||||
c->pending.x =
|
||||
tag_animation_direction == VERTICAL
|
||||
config.tag_animation_direction == VERTICAL
|
||||
? c->animation.current.x
|
||||
: MIN(c->mon->m.x - c->geom.width, c->geom.x - c->mon->m.width);
|
||||
c->pending.y = tag_animation_direction == VERTICAL
|
||||
c->pending.y = config.tag_animation_direction == VERTICAL
|
||||
? MIN(c->mon->m.y - c->geom.height,
|
||||
c->geom.y - c->mon->m.height)
|
||||
: c->animation.current.y;
|
||||
|
|
@ -68,11 +69,11 @@ void set_tagout_animation(Monitor *m, Client *c) {
|
|||
resize(c, c->geom, 0);
|
||||
} else {
|
||||
c->pending = c->geom;
|
||||
c->pending.x = tag_animation_direction == VERTICAL
|
||||
c->pending.x = config.tag_animation_direction == VERTICAL
|
||||
? c->animation.current.x
|
||||
: MAX(c->mon->m.x + c->mon->m.width,
|
||||
c->geom.x + c->mon->m.width);
|
||||
c->pending.y = tag_animation_direction == VERTICAL
|
||||
c->pending.y = config.tag_animation_direction == VERTICAL
|
||||
? MAX(c->mon->m.y + c->mon->m.height,
|
||||
c->geom.y + c->mon->m.height)
|
||||
: c->animation.current.y;
|
||||
|
|
@ -82,7 +83,8 @@ void set_tagout_animation(Monitor *m, Client *c) {
|
|||
|
||||
void set_arrange_hidden(Monitor *m, Client *c, bool want_animation) {
|
||||
if ((c->tags & (1 << (m->pertag->prevtag - 1))) &&
|
||||
m->pertag->prevtag != 0 && m->pertag->curtag != 0 && animations) {
|
||||
m->pertag->prevtag != 0 && m->pertag->curtag != 0 &&
|
||||
config.animations) {
|
||||
c->animation.tagouting = true;
|
||||
c->animation.tagining = false;
|
||||
set_tagout_animation(m, c);
|
||||
|
|
|
|||
|
|
@ -243,34 +243,6 @@ static inline int32_t client_is_rendered_on_mon(Client *c, Monitor *m) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int32_t client_is_stopped(Client *c) {
|
||||
int32_t pid;
|
||||
siginfo_t in = {0};
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
|
||||
if (waitid(P_PID, pid, &in, WNOHANG | WCONTINUED | WSTOPPED | WNOWAIT) <
|
||||
0) {
|
||||
/* This process is not our child process. We cannot determine its
|
||||
* stopped state; assume it is not stopped to avoid blocking frame skip.
|
||||
*/
|
||||
if (errno == ECHILD)
|
||||
return 0; // if not our child, assume not stopped
|
||||
/* Other errors, also assume not stopped. */
|
||||
return 0;
|
||||
} else if (in.si_pid) {
|
||||
if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED)
|
||||
return 1;
|
||||
if (in.si_code == CLD_CONTINUED)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int32_t client_is_unmanaged(Client *c) {
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
|
|
@ -322,9 +294,8 @@ static inline uint32_t client_set_size(Client *c, uint32_t width,
|
|||
uint32_t height) {
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
|
||||
struct wlr_surface_state *state =
|
||||
&c->surface.xwayland->surface->current;
|
||||
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||
struct wlr_surface_state *state = &surface->surface->current;
|
||||
|
||||
if ((int32_t)c->geom.width - 2 * (int32_t)c->bw ==
|
||||
(int32_t)state->width &&
|
||||
|
|
@ -337,6 +308,22 @@ static inline uint32_t client_set_size(Client *c, uint32_t width,
|
|||
return 0;
|
||||
}
|
||||
|
||||
xcb_size_hints_t *size_hints = surface->size_hints;
|
||||
int32_t width = c->geom.width - 2 * c->bw;
|
||||
int32_t height = c->geom.height - 2 * c->bw;
|
||||
|
||||
if (c->mon && c->mon->isoverview && size_hints &&
|
||||
c->geom.width - 2 * (int32_t)c->bw < size_hints->min_width &&
|
||||
c->geom.height - 2 * (int32_t)c->bw < size_hints->min_height)
|
||||
return 0;
|
||||
|
||||
if (size_hints &&
|
||||
c->geom.width - 2 * (int32_t)c->bw < size_hints->min_width)
|
||||
width = size_hints->min_width;
|
||||
if (size_hints &&
|
||||
c->geom.height - 2 * (int32_t)c->bw < size_hints->min_height)
|
||||
height = size_hints->min_height;
|
||||
|
||||
wlr_xwayland_surface_configure(c->surface.xwayland, c->geom.x + c->bw,
|
||||
c->geom.y + c->bw, width, height);
|
||||
return 1;
|
||||
|
|
@ -378,7 +365,7 @@ static inline void client_set_maximized(Client *c, bool maximized) {
|
|||
static inline void client_set_tiled(Client *c, uint32_t edges) {
|
||||
struct wlr_xdg_toplevel *toplevel;
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c) && c->force_maximize) {
|
||||
if (client_is_x11(c) && c->force_fakemaximize) {
|
||||
wlr_xwayland_surface_set_maximized(c->surface.xwayland,
|
||||
edges != WLR_EDGE_NONE,
|
||||
edges != WLR_EDGE_NONE);
|
||||
|
|
@ -393,7 +380,7 @@ static inline void client_set_tiled(Client *c, uint32_t edges) {
|
|||
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
|
||||
}
|
||||
|
||||
if (c->force_maximize) {
|
||||
if (c->force_fakemaximize) {
|
||||
wlr_xdg_toplevel_set_maximized(toplevel, edges != WLR_EDGE_NONE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,3 +92,85 @@ uint32_t get_now_in_ms(void) {
|
|||
uint32_t timespec_to_ms(struct timespec *ts) {
|
||||
return (uint32_t)ts->tv_sec * 1000 + (uint32_t)ts->tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
char *join_strings(char *arr[], const char *sep) {
|
||||
if (!arr || !arr[0]) {
|
||||
char *empty = malloc(1);
|
||||
if (empty)
|
||||
empty[0] = '\0';
|
||||
return empty;
|
||||
}
|
||||
|
||||
size_t total_len = 0;
|
||||
int count = 0;
|
||||
for (int i = 0; arr[i] != NULL; i++) {
|
||||
total_len += strlen(arr[i]);
|
||||
count++;
|
||||
}
|
||||
if (count > 0) {
|
||||
total_len += strlen(sep) * (count - 1);
|
||||
}
|
||||
|
||||
char *result = malloc(total_len + 1);
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
result[0] = '\0';
|
||||
for (int i = 0; arr[i] != NULL; i++) {
|
||||
if (i > 0)
|
||||
strcat(result, sep);
|
||||
strcat(result, arr[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
char *join_strings_with_suffix(char *arr[], const char *suffix,
|
||||
const char *sep) {
|
||||
if (!arr || !arr[0]) {
|
||||
char *empty = malloc(1);
|
||||
if (empty)
|
||||
empty[0] = '\0';
|
||||
return empty;
|
||||
}
|
||||
|
||||
size_t total_len = 0;
|
||||
int count = 0;
|
||||
for (int i = 0; arr[i] != NULL; i++) {
|
||||
total_len += strlen(arr[i]) + strlen(suffix);
|
||||
count++;
|
||||
}
|
||||
if (count > 0) {
|
||||
total_len += strlen(sep) * (count - 1);
|
||||
}
|
||||
|
||||
char *result = malloc(total_len + 1);
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
result[0] = '\0';
|
||||
for (int i = 0; arr[i] != NULL; i++) {
|
||||
if (i > 0)
|
||||
strcat(result, sep);
|
||||
strcat(result, arr[i]);
|
||||
strcat(result, suffix);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
char *string_printf(const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int len = vsnprintf(NULL, 0, fmt, args);
|
||||
va_end(args);
|
||||
if (len < 0)
|
||||
return NULL;
|
||||
|
||||
char *str = malloc(len + 1);
|
||||
if (!str)
|
||||
return NULL;
|
||||
|
||||
va_start(args, fmt);
|
||||
vsnprintf(str, len + 1, fmt, args);
|
||||
va_end(args);
|
||||
return str;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,8 @@ int32_t fd_set_nonblock(int32_t fd);
|
|||
int32_t regex_match(const char *pattern_mb, const char *str_mb);
|
||||
void wl_list_append(struct wl_list *list, struct wl_list *object);
|
||||
uint32_t get_now_in_ms(void);
|
||||
uint32_t timespec_to_ms(struct timespec *ts);
|
||||
uint32_t timespec_to_ms(struct timespec *ts);
|
||||
char *join_strings(char *arr[], const char *sep);
|
||||
char *join_strings_with_suffix(char *arr[], const char *suffix,
|
||||
const char *sep);
|
||||
char *string_printf(const char *fmt, ...);
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,132 +1,9 @@
|
|||
// TODO: remove this file in the future, replace all global variables with
|
||||
// config.xxx
|
||||
#define MODKEY WLR_MODIFIER_ALT
|
||||
|
||||
/* speedie's mango config */
|
||||
static const char *tags[] = {
|
||||
"1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||
};
|
||||
|
||||
#define COLOR(hex) \
|
||||
{((hex >> 24) & 0xFF) / 255.0f, ((hex >> 16) & 0xFF) / 255.0f, \
|
||||
((hex >> 8) & 0xFF) / 255.0f, (hex & 0xFF) / 255.0f}
|
||||
|
||||
/* animaion */
|
||||
char *animation_type_open = "slide"; // 是否启用动画 //slide,zoom
|
||||
char *animation_type_close = "slide"; // 是否启用动画 //slide,zoom
|
||||
char *layer_animation_type_open = "slide"; // 是否启用layer动画 //slide,zoom
|
||||
char *layer_animation_type_close = "slide"; // 是否启用layer动画 //slide,zoom
|
||||
int32_t animations = 1; // 是否启用动画
|
||||
int32_t layer_animations = 0; // 是否启用layer动画
|
||||
int32_t tag_animation_direction = HORIZONTAL; // 标签动画方向
|
||||
int32_t animation_fade_in = 1; // Enable animation fade in
|
||||
int32_t animation_fade_out = 1; // Enable animation fade out
|
||||
float zoom_initial_ratio = 0.3; // 动画起始窗口比例
|
||||
float zoom_end_ratio = 0.8; // 动画结束窗口比例
|
||||
float fadein_begin_opacity = 0.5; // Begin opac window ratio for animations
|
||||
float fadeout_begin_opacity = 0.5; // Begin opac window ratio for animations
|
||||
uint32_t animation_duration_move = 500; // Animation move speed
|
||||
uint32_t animation_duration_open = 400; // Animation open speed
|
||||
uint32_t animation_duration_tag = 300; // Animation tag speed
|
||||
uint32_t animation_duration_close = 300; // Animation close speed
|
||||
uint32_t animation_duration_focus = 0; // Animation focus opacity speed
|
||||
double animation_curve_move[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
double animation_curve_open[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
double animation_curve_tag[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
double animation_curve_close[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
double animation_curve_focus[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
double animation_curve_opafadein[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
double animation_curve_opafadeout[4] = {0.5, 0.5, 0.5, 0.5}; // 动画曲线
|
||||
|
||||
/* appearance */
|
||||
uint32_t axis_bind_apply_timeout = 100; // 滚轮绑定动作的触发的时间间隔
|
||||
uint32_t focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
|
||||
uint32_t new_is_master = 1; // 新窗口是否插在头部
|
||||
double default_mfact = 0.55f; // master 窗口比例
|
||||
uint32_t default_nmaster = 1; // 默认master数量
|
||||
int32_t center_master_overspread = 0; // 中心master时是否铺满
|
||||
int32_t center_when_single_stack = 1; // 单个stack时是否居中
|
||||
/* logging */
|
||||
int32_t log_level = WLR_ERROR;
|
||||
uint32_t numlockon = 0; // 是否打开右边小键盘
|
||||
uint32_t capslock = 0; // 是否启用快捷键
|
||||
|
||||
uint32_t ov_tab_mode = 0; // alt tab切换模式
|
||||
uint32_t hotarea_size = 10; // 热区大小,10x10
|
||||
uint32_t hotarea_corner = BOTTOM_LEFT;
|
||||
uint32_t enable_hotarea = 1; // 是否启用鼠标热区
|
||||
int32_t smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
int32_t sloppyfocus = 1; /* focus follows mouse */
|
||||
uint32_t gappih = 5; /* horiz inner gap between windows */
|
||||
uint32_t gappiv = 5; /* vert inner gap between windows */
|
||||
uint32_t gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||
uint32_t gappov = 10; /* vert outer gap between windows and screen edge */
|
||||
float scratchpad_width_ratio = 0.8;
|
||||
float scratchpad_height_ratio = 0.9;
|
||||
|
||||
int32_t scroller_structs = 20;
|
||||
float scroller_default_proportion = 0.9;
|
||||
float scroller_default_proportion_single = 1.0;
|
||||
int32_t scroller_ignore_proportion_single = 1;
|
||||
int32_t scroller_focus_center = 0;
|
||||
int32_t scroller_prefer_center = 0;
|
||||
int32_t scroller_prefer_overspread = 1;
|
||||
int32_t focus_cross_monitor = 0;
|
||||
int32_t focus_cross_tag = 0;
|
||||
int32_t exchange_cross_monitor = 0;
|
||||
int32_t scratchpad_cross_monitor = 0;
|
||||
int32_t view_current_to_back = 0;
|
||||
int32_t no_border_when_single = 0;
|
||||
int32_t no_radius_when_single = 0;
|
||||
int32_t snap_distance = 30;
|
||||
int32_t enable_floating_snap = 0;
|
||||
int32_t drag_tile_to_tile = 0;
|
||||
uint32_t cursor_size = 24;
|
||||
uint32_t cursor_hide_timeout = 0;
|
||||
|
||||
uint32_t swipe_min_threshold = 1;
|
||||
|
||||
int32_t idleinhibit_ignore_visible =
|
||||
0; /* 1 means idle inhibitors will disable idle tracking even if it's
|
||||
surface isn't visible */
|
||||
uint32_t borderpx = 4; /* border pixel of windows */
|
||||
float rootcolor[] = COLOR(0x323232ff);
|
||||
float bordercolor[] = COLOR(0x444444ff);
|
||||
float focuscolor[] = COLOR(0xc66b25ff);
|
||||
float maximizescreencolor[] = COLOR(0x89aa61ff);
|
||||
float urgentcolor[] = COLOR(0xad401fff);
|
||||
float scratchpadcolor[] = COLOR(0x516c93ff);
|
||||
float globalcolor[] = COLOR(0xb153a7ff);
|
||||
float overlaycolor[] = COLOR(0x14a57cff);
|
||||
// char *cursor_theme = "Bibata-Modern-Ice";
|
||||
|
||||
int32_t overviewgappi = 5; /* overview时 窗口与边缘 缝隙大小 */
|
||||
int32_t overviewgappo = 30; /* overview时 窗口与窗口 缝隙大小 */
|
||||
|
||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old
|
||||
* behavior */
|
||||
float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
|
||||
|
||||
int32_t warpcursor = 1;
|
||||
int32_t drag_corner = 3;
|
||||
int32_t drag_warp_cursor = 1;
|
||||
int32_t xwayland_persistence = 1; /* xwayland persistence */
|
||||
int32_t syncobj_enable = 0;
|
||||
int32_t allow_lock_transparent = 0;
|
||||
double drag_tile_refresh_interval = 16.0;
|
||||
double drag_floating_refresh_interval = 8.0;
|
||||
int32_t allow_tearing = TEARING_DISABLED;
|
||||
int32_t allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
||||
|
||||
/* keyboard */
|
||||
|
||||
/*
|
||||
only layout can modify after fisrt init
|
||||
other fields change will be ignored.
|
||||
*/
|
||||
char xkb_rules_rules[256];
|
||||
char xkb_rules_model[256];
|
||||
char xkb_rules_layout[256];
|
||||
char xkb_rules_variant[256];
|
||||
char xkb_rules_options[256];
|
||||
|
||||
/* keyboard */
|
||||
static const struct xkb_rule_names xkb_fallback_rules = {
|
||||
.layout = "us",
|
||||
.variant = NULL,
|
||||
|
|
@ -134,106 +11,3 @@ static const struct xkb_rule_names xkb_fallback_rules = {
|
|||
.rules = NULL,
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
static const struct xkb_rule_names xkb_default_rules = {
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
struct xkb_rule_names xkb_rules = {
|
||||
/* can specify fields: rules, model, layout, variant, options */
|
||||
/* example:
|
||||
.options = "ctrl:nocaps",
|
||||
*/
|
||||
.rules = xkb_rules_rules, .model = xkb_rules_model,
|
||||
.layout = xkb_rules_layout, .variant = xkb_rules_variant,
|
||||
.options = xkb_rules_options,
|
||||
};
|
||||
|
||||
int32_t repeat_rate = 25;
|
||||
int32_t repeat_delay = 600;
|
||||
|
||||
/* Trackpad */
|
||||
int32_t disable_trackpad = 0;
|
||||
int32_t tap_to_click = 1;
|
||||
int32_t tap_and_drag = 1;
|
||||
int32_t drag_lock = 1;
|
||||
int32_t mouse_natural_scrolling = 0;
|
||||
int32_t trackpad_natural_scrolling = 0;
|
||||
int32_t disable_while_typing = 1;
|
||||
int32_t left_handed = 0;
|
||||
int32_t middle_button_emulation = 0;
|
||||
int32_t single_scratchpad = 1;
|
||||
int32_t edge_scroller_pointer_focus = 1;
|
||||
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
|
||||
LIBINPUT_CONFIG_SCROLL_2FG
|
||||
LIBINPUT_CONFIG_SCROLL_EDGE
|
||||
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
|
||||
*/
|
||||
enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
|
||||
uint32_t scroll_button = 274;
|
||||
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_NONE
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
|
||||
*/
|
||||
enum libinput_config_click_method click_method =
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
||||
|
||||
double axis_scroll_factor = 1.0;
|
||||
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
|
||||
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED
|
||||
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE
|
||||
*/
|
||||
uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
|
||||
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
|
||||
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
||||
*/
|
||||
enum libinput_config_accel_profile accel_profile =
|
||||
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
||||
double accel_speed = 0.0;
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
|
||||
LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
||||
*/
|
||||
enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
||||
|
||||
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
|
||||
#define MODKEY WLR_MODIFIER_ALT
|
||||
|
||||
static const char *tags[] = {
|
||||
"1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||
};
|
||||
|
||||
float focused_opacity = 1.0;
|
||||
float unfocused_opacity = 1.0;
|
||||
|
||||
int32_t border_radius = 0;
|
||||
int32_t border_radius_location_default = CORNER_LOCATION_ALL;
|
||||
int32_t blur = 0;
|
||||
int32_t blur_layer = 0;
|
||||
int32_t blur_optimized = 1;
|
||||
|
||||
struct blur_data blur_params;
|
||||
|
||||
int32_t blur_params_num_passes = 1;
|
||||
int32_t blur_params_radius = 5;
|
||||
float blur_params_noise = 0.02;
|
||||
float blur_params_brightness = 0.9;
|
||||
float blur_params_contrast = 0.9;
|
||||
float blur_params_saturation = 1.2;
|
||||
|
||||
int32_t shadows = 0;
|
||||
int32_t shadow_only_floating = 1;
|
||||
int32_t layer_shadows = 0;
|
||||
uint32_t shadows_size = 10;
|
||||
double shadows_blur = 15;
|
||||
int32_t shadows_position_x = 0;
|
||||
int32_t shadows_position_y = 0;
|
||||
float shadowscolor[] = COLOR(0x000000ff);
|
||||
|
|
|
|||
|
|
@ -72,4 +72,5 @@ int32_t setoption(const Arg *arg);
|
|||
int32_t disable_monitor(const Arg *arg);
|
||||
int32_t enable_monitor(const Arg *arg);
|
||||
int32_t toggle_monitor(const Arg *arg);
|
||||
int32_t scroller_stack(const Arg *arg);
|
||||
int32_t scroller_stack(const Arg *arg);
|
||||
int32_t toggle_all_floating(const Arg *arg);
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
int32_t bind_to_view(const Arg *arg) {
|
||||
|
||||
if (!selmon)
|
||||
return 0;
|
||||
uint32_t target = arg->ui;
|
||||
|
||||
if (view_current_to_back && selmon->pertag->curtag &&
|
||||
if (config.view_current_to_back && selmon->pertag->curtag &&
|
||||
(target & TAGMASK) == (selmon->tagset[selmon->seltags])) {
|
||||
if (selmon->pertag->prevtag)
|
||||
target = 1 << (selmon->pertag->prevtag - 1);
|
||||
|
|
@ -10,13 +11,13 @@ int32_t bind_to_view(const Arg *arg) {
|
|||
target = 0;
|
||||
}
|
||||
|
||||
if (!view_current_to_back &&
|
||||
if (!config.view_current_to_back &&
|
||||
(target & TAGMASK) == (selmon->tagset[selmon->seltags])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((int32_t)target == INT_MIN && selmon->pertag->curtag == 0) {
|
||||
if (view_current_to_back && selmon->pertag->prevtag)
|
||||
if (config.view_current_to_back && selmon->pertag->prevtag)
|
||||
target = 1 << (selmon->pertag->prevtag - 1);
|
||||
else
|
||||
target = 0;
|
||||
|
|
@ -95,11 +96,13 @@ int32_t destroy_all_virtual_output(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t defaultgaps(const Arg *arg) {
|
||||
setgaps(gappoh, gappov, gappih, gappiv);
|
||||
setgaps(config.gappoh, config.gappov, config.gappih, config.gappiv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t exchange_client(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
Client *c = selmon->sel;
|
||||
if (!c || c->isfloating)
|
||||
return 0;
|
||||
|
|
@ -107,11 +110,16 @@ int32_t exchange_client(const Arg *arg) {
|
|||
if ((c->isfullscreen || c->ismaximizescreen) && !is_scroller_layout(c->mon))
|
||||
return 0;
|
||||
|
||||
exchange_two_client(c, direction_select(arg));
|
||||
Client *tc = direction_select(arg);
|
||||
tc = get_focused_stack_client(tc);
|
||||
exchange_two_client(c, tc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t exchange_stack_client(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
Client *c = selmon->sel;
|
||||
Client *tc = NULL;
|
||||
if (!c || c->isfloating || c->isfullscreen || c->ismaximizescreen)
|
||||
|
|
@ -132,7 +140,7 @@ int32_t focusdir(const Arg *arg) {
|
|||
c = get_focused_stack_client(c);
|
||||
if (c) {
|
||||
focusclient(c, 1);
|
||||
if (warpcursor)
|
||||
if (config.warpcursor)
|
||||
warp_cursor(c);
|
||||
} else {
|
||||
if (config.focus_cross_tag) {
|
||||
|
|
@ -188,7 +196,7 @@ int32_t focuslast(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t toggle_trackpad_enable(const Arg *arg) {
|
||||
disable_trackpad = !disable_trackpad;
|
||||
config.disable_trackpad = !config.disable_trackpad;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +212,7 @@ int32_t focusmon(const Arg *arg) {
|
|||
if (!m->wlr_output->enabled) {
|
||||
continue;
|
||||
}
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
tm = m;
|
||||
break;
|
||||
}
|
||||
|
|
@ -217,7 +225,7 @@ int32_t focusmon(const Arg *arg) {
|
|||
return 0;
|
||||
|
||||
selmon = tm;
|
||||
if (warpcursor) {
|
||||
if (config.warpcursor) {
|
||||
warp_cursor_to_selmon(selmon);
|
||||
}
|
||||
c = focustop(selmon);
|
||||
|
|
@ -250,7 +258,7 @@ int32_t focusstack(const Arg *arg) {
|
|||
return 0;
|
||||
|
||||
focusclient(tc, 1);
|
||||
if (warpcursor)
|
||||
if (config.warpcursor)
|
||||
warp_cursor(tc);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -265,42 +273,56 @@ int32_t incnmaster(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t incgaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
setgaps(selmon->gappoh + arg->i, selmon->gappov + arg->i,
|
||||
selmon->gappih + arg->i, selmon->gappiv + arg->i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t incigaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
setgaps(selmon->gappoh, selmon->gappov, selmon->gappih + arg->i,
|
||||
selmon->gappiv + arg->i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t incogaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
setgaps(selmon->gappoh + arg->i, selmon->gappov + arg->i, selmon->gappih,
|
||||
selmon->gappiv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t incihgaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
setgaps(selmon->gappoh, selmon->gappov, selmon->gappih + arg->i,
|
||||
selmon->gappiv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t incivgaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
setgaps(selmon->gappoh, selmon->gappov, selmon->gappih,
|
||||
selmon->gappiv + arg->i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t incohgaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
setgaps(selmon->gappoh + arg->i, selmon->gappov, selmon->gappih,
|
||||
selmon->gappiv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t incovgaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
setgaps(selmon->gappoh, selmon->gappov + arg->i, selmon->gappih,
|
||||
selmon->gappiv);
|
||||
return 0;
|
||||
|
|
@ -330,6 +352,8 @@ int32_t setmfact(const Arg *arg) {
|
|||
|
||||
int32_t killclient(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
c = selmon->sel;
|
||||
if (c) {
|
||||
pending_kill_client(c);
|
||||
|
|
@ -352,7 +376,11 @@ int32_t moveresize(const Arg *arg) {
|
|||
/* Float the window and tell motionnotify to grab it */
|
||||
if (grabc->isfloating == 0 && arg->ui == CurMove) {
|
||||
grabc->drag_to_tile = true;
|
||||
exit_scroller_stack(grabc);
|
||||
setfloating(grabc, 1);
|
||||
grabc->old_stack_inner_per = 0.0f;
|
||||
grabc->old_master_inner_per = 0.0f;
|
||||
set_size_per(grabc->mon, grabc);
|
||||
}
|
||||
|
||||
switch (cursor_mode = arg->ui) {
|
||||
|
|
@ -366,7 +394,7 @@ int32_t moveresize(const Arg *arg) {
|
|||
/* Doesn't work for X11 output - the next absolute motion event
|
||||
* returns the cursor to where it started */
|
||||
if (grabc->isfloating) {
|
||||
rzcorner = drag_corner;
|
||||
rzcorner = config.drag_corner;
|
||||
grabcx = (int)round(cursor->x);
|
||||
grabcy = (int)round(cursor->y);
|
||||
if (rzcorner == 4)
|
||||
|
|
@ -380,7 +408,7 @@ int32_t moveresize(const Arg *arg) {
|
|||
? 0
|
||||
: 2);
|
||||
|
||||
if (drag_warp_cursor) {
|
||||
if (config.drag_warp_cursor) {
|
||||
grabcx = rzcorner & 1 ? grabc->geom.x + grabc->geom.width
|
||||
: grabc->geom.x;
|
||||
grabcy = rzcorner & 2 ? grabc->geom.y + grabc->geom.height
|
||||
|
|
@ -399,6 +427,8 @@ int32_t moveresize(const Arg *arg) {
|
|||
|
||||
int32_t movewin(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
c = selmon->sel;
|
||||
if (!c || c->isfullscreen)
|
||||
return 0;
|
||||
|
|
@ -442,15 +472,17 @@ int32_t quit(const Arg *arg) {
|
|||
|
||||
int32_t resizewin(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
c = selmon->sel;
|
||||
int32_t offsetx = 0, offsety = 0;
|
||||
|
||||
if (!c || c->isfullscreen || c->ismaximizescreen)
|
||||
return 0;
|
||||
|
||||
int32_t animations_state_backup = animations;
|
||||
int32_t animations_state_backup = config.animations;
|
||||
if (!c->isfloating)
|
||||
animations = 0;
|
||||
config.animations = 0;
|
||||
|
||||
if (ISTILED(c)) {
|
||||
switch (arg->ui) {
|
||||
|
|
@ -477,7 +509,7 @@ int32_t resizewin(const Arg *arg) {
|
|||
break;
|
||||
}
|
||||
resize_tile_client(c, false, offsetx, offsety, 0);
|
||||
animations = animations_state_backup;
|
||||
config.animations = animations_state_backup;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -508,7 +540,7 @@ int32_t resizewin(const Arg *arg) {
|
|||
c->iscustomsize = 1;
|
||||
c->float_geom = c->geom;
|
||||
resize(c, c->geom, 0);
|
||||
animations = animations_state_backup;
|
||||
config.animations = animations_state_backup;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -520,7 +552,7 @@ int32_t restore_minimized(const Arg *arg) {
|
|||
|
||||
if (selmon && selmon->sel && selmon->sel->is_in_scratchpad &&
|
||||
selmon->sel->is_scratchpad_show) {
|
||||
selmon->sel->isminimized = 0;
|
||||
client_pending_minimized_state(selmon->sel, 0);
|
||||
selmon->sel->is_scratchpad_show = 0;
|
||||
selmon->sel->is_in_scratchpad = 0;
|
||||
selmon->sel->isnamedscratchpad = 0;
|
||||
|
|
@ -546,6 +578,8 @@ int32_t restore_minimized(const Arg *arg) {
|
|||
|
||||
int32_t setlayout(const Arg *arg) {
|
||||
int32_t jk;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
||||
if (strcmp(layouts[jk].name, arg->v) == 0) {
|
||||
|
|
@ -571,12 +605,14 @@ int32_t setkeymode(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t set_proportion(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (selmon->isoverview || !is_scroller_layout(selmon))
|
||||
return 0;
|
||||
|
||||
if (selmon->visible_tiling_clients == 1 &&
|
||||
!scroller_ignore_proportion_single)
|
||||
!config.scroller_ignore_proportion_single)
|
||||
return 0;
|
||||
|
||||
Client *tc = selmon->sel;
|
||||
|
|
@ -584,7 +620,7 @@ int32_t set_proportion(const Arg *arg) {
|
|||
if (tc) {
|
||||
tc = get_scroll_stack_head(tc);
|
||||
uint32_t max_client_width =
|
||||
selmon->w.width - 2 * scroller_structs - gappih;
|
||||
selmon->w.width - 2 * config.scroller_structs - config.gappih;
|
||||
tc->scroller_proportion = arg->f;
|
||||
tc->geom.width = max_client_width * arg->f;
|
||||
arrange(selmon, false, false);
|
||||
|
|
@ -596,6 +632,8 @@ int32_t smartmovewin(const Arg *arg) {
|
|||
Client *c = NULL, *tc = NULL;
|
||||
int32_t nx, ny;
|
||||
int32_t buttom, top, left, right, tar;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
c = selmon->sel;
|
||||
if (!c || c->isfullscreen)
|
||||
return 0;
|
||||
|
|
@ -616,7 +654,7 @@ int32_t smartmovewin(const Arg *arg) {
|
|||
if (c->geom.x + c->geom.width < tc->geom.x ||
|
||||
c->geom.x > tc->geom.x + tc->geom.width)
|
||||
continue;
|
||||
buttom = tc->geom.y + tc->geom.height + gappiv;
|
||||
buttom = tc->geom.y + tc->geom.height + config.gappiv;
|
||||
if (top > buttom && ny < buttom) {
|
||||
tar = MAX(tar, buttom);
|
||||
};
|
||||
|
|
@ -636,7 +674,7 @@ int32_t smartmovewin(const Arg *arg) {
|
|||
if (c->geom.x + c->geom.width < tc->geom.x ||
|
||||
c->geom.x > tc->geom.x + tc->geom.width)
|
||||
continue;
|
||||
top = tc->geom.y - gappiv;
|
||||
top = tc->geom.y - config.gappiv;
|
||||
if (buttom < top && (ny + c->geom.height) > top) {
|
||||
tar = MIN(tar, top - c->geom.height);
|
||||
};
|
||||
|
|
@ -656,7 +694,7 @@ int32_t smartmovewin(const Arg *arg) {
|
|||
if (c->geom.y + c->geom.height < tc->geom.y ||
|
||||
c->geom.y > tc->geom.y + tc->geom.height)
|
||||
continue;
|
||||
right = tc->geom.x + tc->geom.width + gappih;
|
||||
right = tc->geom.x + tc->geom.width + config.gappih;
|
||||
if (left > right && nx < right) {
|
||||
tar = MAX(tar, right);
|
||||
};
|
||||
|
|
@ -675,7 +713,7 @@ int32_t smartmovewin(const Arg *arg) {
|
|||
if (c->geom.y + c->geom.height < tc->geom.y ||
|
||||
c->geom.y > tc->geom.y + tc->geom.height)
|
||||
continue;
|
||||
left = tc->geom.x - gappih;
|
||||
left = tc->geom.x - config.gappih;
|
||||
if (right < left && (nx + c->geom.width) > left) {
|
||||
tar = MIN(tar, left - c->geom.width);
|
||||
};
|
||||
|
|
@ -697,6 +735,8 @@ int32_t smartresizewin(const Arg *arg) {
|
|||
Client *c = NULL, *tc = NULL;
|
||||
int32_t nw, nh;
|
||||
int32_t buttom, top, left, right, tar;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
c = selmon->sel;
|
||||
if (!c || c->isfullscreen)
|
||||
return 0;
|
||||
|
|
@ -721,14 +761,14 @@ int32_t smartresizewin(const Arg *arg) {
|
|||
if (c->geom.x + c->geom.width < tc->geom.x ||
|
||||
c->geom.x > tc->geom.x + tc->geom.width)
|
||||
continue;
|
||||
top = tc->geom.y - gappiv;
|
||||
top = tc->geom.y - config.gappiv;
|
||||
if (buttom < top && (nh + c->geom.y) > top) {
|
||||
tar = MAX(tar, top - c->geom.y);
|
||||
};
|
||||
}
|
||||
nh = tar == -99999 ? nh : tar;
|
||||
if (c->geom.y + nh + gappov > selmon->w.y + selmon->w.height)
|
||||
nh = selmon->w.y + selmon->w.height - c->geom.y - gappov;
|
||||
if (c->geom.y + nh + config.gappov > selmon->w.y + selmon->w.height)
|
||||
nh = selmon->w.y + selmon->w.height - c->geom.y - config.gappov;
|
||||
break;
|
||||
case LEFT:
|
||||
nw -= selmon->w.width / 16;
|
||||
|
|
@ -744,15 +784,15 @@ int32_t smartresizewin(const Arg *arg) {
|
|||
if (c->geom.y + c->geom.height < tc->geom.y ||
|
||||
c->geom.y > tc->geom.y + tc->geom.height)
|
||||
continue;
|
||||
left = tc->geom.x - gappih;
|
||||
left = tc->geom.x - config.gappih;
|
||||
if (right < left && (nw + c->geom.x) > left) {
|
||||
tar = MIN(tar, left - c->geom.x);
|
||||
};
|
||||
}
|
||||
|
||||
nw = tar == 99999 ? nw : tar;
|
||||
if (c->geom.x + nw + gappoh > selmon->w.x + selmon->w.width)
|
||||
nw = selmon->w.x + selmon->w.width - c->geom.x - gappoh;
|
||||
if (c->geom.x + nw + config.gappoh > selmon->w.x + selmon->w.width)
|
||||
nw = selmon->w.x + selmon->w.width - c->geom.x - config.gappoh;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -765,6 +805,8 @@ int32_t smartresizewin(const Arg *arg) {
|
|||
|
||||
int32_t centerwin(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
c = selmon->sel;
|
||||
|
||||
if (!c || c->isfullscreen || c->ismaximizescreen)
|
||||
|
|
@ -812,7 +854,7 @@ int32_t spawn_shell(const Arg *arg) {
|
|||
execlp("bash", "bash", "-c", arg->v, (char *)NULL);
|
||||
|
||||
// if execlp fails, we should not reach here
|
||||
wlr_log(WLR_ERROR,
|
||||
wlr_log(WLR_DEBUG,
|
||||
"mango: failed to execute command '%s' with shell: %s\n",
|
||||
arg->v, strerror(errno));
|
||||
_exit(EXIT_FAILURE);
|
||||
|
|
@ -821,7 +863,6 @@ int32_t spawn_shell(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t spawn(const Arg *arg) {
|
||||
|
||||
if (!arg->v)
|
||||
return 0;
|
||||
|
||||
|
|
@ -834,28 +875,21 @@ int32_t spawn(const Arg *arg) {
|
|||
dup2(STDERR_FILENO, STDOUT_FILENO);
|
||||
setsid();
|
||||
|
||||
// 2. 解析参数
|
||||
char *argv[64];
|
||||
int32_t argc = 0;
|
||||
char *token = strtok((char *)arg->v, " ");
|
||||
while (token != NULL && argc < 63) {
|
||||
wordexp_t p;
|
||||
if (wordexp(token, &p, 0) == 0) {
|
||||
argv[argc++] = p.we_wordv[0];
|
||||
} else {
|
||||
argv[argc++] = token;
|
||||
}
|
||||
token = strtok(NULL, " ");
|
||||
// 2. 对整个参数字符串进行单词展开
|
||||
wordexp_t p;
|
||||
if (wordexp(arg->v, &p, 0) != 0) {
|
||||
wlr_log(WLR_DEBUG, "mango: wordexp failed for '%s'\n", arg->v);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
argv[argc] = NULL;
|
||||
|
||||
// 3. 执行命令
|
||||
execvp(argv[0], argv);
|
||||
// 3. 执行命令(p.we_wordv 已经是 argv 数组)
|
||||
execvp(p.we_wordv[0], p.we_wordv);
|
||||
|
||||
// 4. execvp 失败时:打印错误并直接退出(避免 coredump)
|
||||
wlr_log(WLR_ERROR, "mango: execvp '%s' failed: %s\n", argv[0],
|
||||
// 4. execvp 失败时:打印错误,释放 wordexp 资源,然后退出
|
||||
wlr_log(WLR_DEBUG, "mango: execvp '%s' failed: %s\n", p.we_wordv[0],
|
||||
strerror(errno));
|
||||
_exit(EXIT_FAILURE); // 使用 _exit 避免缓冲区刷新等操作
|
||||
wordfree(&p); // 释放 wordexp 分配的内存
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -943,6 +977,9 @@ int32_t switch_layout(const Arg *arg) {
|
|||
char *target_layout_name = NULL;
|
||||
uint32_t len;
|
||||
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (config.circle_layout_count != 0) {
|
||||
for (jk = 0; jk < config.circle_layout_count; jk++) {
|
||||
|
||||
|
|
@ -994,6 +1031,8 @@ int32_t switch_layout(const Arg *arg) {
|
|||
|
||||
int32_t switch_proportion_preset(const Arg *arg) {
|
||||
float target_proportion = 0;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (config.scroller_proportion_preset_count == 0) {
|
||||
return 0;
|
||||
|
|
@ -1003,7 +1042,7 @@ int32_t switch_proportion_preset(const Arg *arg) {
|
|||
return 0;
|
||||
|
||||
if (selmon->visible_tiling_clients == 1 &&
|
||||
!scroller_ignore_proportion_single)
|
||||
!config.scroller_ignore_proportion_single)
|
||||
return 0;
|
||||
|
||||
Client *tc = selmon->sel;
|
||||
|
|
@ -1013,13 +1052,28 @@ int32_t switch_proportion_preset(const Arg *arg) {
|
|||
for (int32_t i = 0; i < config.scroller_proportion_preset_count; i++) {
|
||||
if (config.scroller_proportion_preset[i] ==
|
||||
tc->scroller_proportion) {
|
||||
if (i == config.scroller_proportion_preset_count - 1) {
|
||||
target_proportion = config.scroller_proportion_preset[0];
|
||||
break;
|
||||
|
||||
if (arg->i == NEXT) {
|
||||
if (i == config.scroller_proportion_preset_count - 1) {
|
||||
target_proportion =
|
||||
config.scroller_proportion_preset[0];
|
||||
break;
|
||||
} else {
|
||||
target_proportion =
|
||||
config.scroller_proportion_preset[i + 1];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
target_proportion =
|
||||
config.scroller_proportion_preset[i + 1];
|
||||
break;
|
||||
if (i == 0) {
|
||||
target_proportion =
|
||||
config.scroller_proportion_preset
|
||||
[config.scroller_proportion_preset_count - 1];
|
||||
break;
|
||||
} else {
|
||||
target_proportion =
|
||||
config.scroller_proportion_preset[i - 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1029,7 +1083,7 @@ int32_t switch_proportion_preset(const Arg *arg) {
|
|||
}
|
||||
|
||||
uint32_t max_client_width =
|
||||
selmon->w.width - 2 * scroller_structs - gappih;
|
||||
selmon->w.width - 2 * config.scroller_structs - config.gappih;
|
||||
tc->scroller_proportion = target_proportion;
|
||||
tc->geom.width = max_client_width * target_proportion;
|
||||
arrange(selmon, false, false);
|
||||
|
|
@ -1038,6 +1092,8 @@ int32_t switch_proportion_preset(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t tag(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
Client *target_client = selmon->sel;
|
||||
tag_client(arg, target_client);
|
||||
return 0;
|
||||
|
|
@ -1053,6 +1109,8 @@ int32_t tagmonsilent(const Arg *arg) {
|
|||
|
||||
int32_t tagmon_general(const Arg *arg, bool silent) {
|
||||
Monitor *m = NULL, *cm = NULL;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
Client *c = focustop(selmon);
|
||||
|
||||
if (!c)
|
||||
|
|
@ -1065,7 +1123,7 @@ int32_t tagmon_general(const Arg *arg, bool silent) {
|
|||
if (!cm->wlr_output->enabled) {
|
||||
continue;
|
||||
}
|
||||
if (regex_match(arg->v, cm->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, cm)) {
|
||||
m = cm;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1091,7 +1149,7 @@ int32_t tagmon_general(const Arg *arg, bool silent) {
|
|||
selmon->sel = NULL;
|
||||
}
|
||||
|
||||
setmon(c, m, newtags, !silent); // todo silent, last arg = false
|
||||
setmon(c, m, newtags, !silent);
|
||||
client_update_oldmonname_record(c, m);
|
||||
|
||||
reset_foreign_tolevel(c);
|
||||
|
|
@ -1122,7 +1180,7 @@ int32_t tagmon_general(const Arg *arg, bool silent) {
|
|||
}
|
||||
arrange(selmon, false, false);
|
||||
}
|
||||
if (warpcursor && !silent) {
|
||||
if (config.warpcursor && !silent) {
|
||||
warp_cursor_to_selmon(c->mon);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1150,6 +1208,9 @@ int32_t tagsilent(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t tagtoleft(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (selmon->sel != NULL &&
|
||||
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 &&
|
||||
selmon->tagset[selmon->seltags] > 1) {
|
||||
|
|
@ -1168,6 +1229,9 @@ int32_t tagtoleftsilent(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t tagtoright(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (selmon->sel != NULL &&
|
||||
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 &&
|
||||
selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
||||
|
|
@ -1205,6 +1269,8 @@ int32_t toggle_named_scratchpad(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t toggle_render_border(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
render_border = !render_border;
|
||||
arrange(selmon, false, false);
|
||||
return 0;
|
||||
|
|
@ -1219,11 +1285,12 @@ int32_t toggle_scratchpad(const Arg *arg) {
|
|||
return 0;
|
||||
|
||||
wl_list_for_each_safe(c, tmp, &clients, link) {
|
||||
if (!scratchpad_cross_monitor && c->mon != selmon) {
|
||||
if (!config.scratchpad_cross_monitor && c->mon != selmon) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (single_scratchpad && c->isnamedscratchpad && !c->isminimized) {
|
||||
if (config.single_scratchpad && c->isnamedscratchpad &&
|
||||
!c->isminimized) {
|
||||
set_minimized(c);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1240,6 +1307,8 @@ int32_t toggle_scratchpad(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t togglefakefullscreen(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
Client *sel = focustop(selmon);
|
||||
if (sel)
|
||||
setfakefullscreen(sel, !sel->isfakefullscreen);
|
||||
|
|
@ -1247,6 +1316,9 @@ int32_t togglefakefullscreen(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t togglefloating(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
Client *sel = focustop(selmon);
|
||||
|
||||
if (selmon && selmon->isoverview)
|
||||
|
|
@ -1268,6 +1340,9 @@ int32_t togglefloating(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t togglefullscreen(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
Client *sel = focustop(selmon);
|
||||
if (!sel)
|
||||
return 0;
|
||||
|
|
@ -1284,6 +1359,9 @@ int32_t togglefullscreen(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t toggleglobal(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (!selmon->sel)
|
||||
return 0;
|
||||
if (selmon->sel->is_in_scratchpad) {
|
||||
|
|
@ -1302,12 +1380,18 @@ int32_t toggleglobal(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t togglegaps(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
enablegaps ^= 1;
|
||||
arrange(selmon, false, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t togglemaximizescreen(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
Client *sel = focustop(selmon);
|
||||
if (!sel)
|
||||
return 0;
|
||||
|
|
@ -1326,6 +1410,9 @@ int32_t togglemaximizescreen(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t toggleoverlay(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (!selmon->sel || !selmon->sel->mon || selmon->sel->isfullscreen) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1347,6 +1434,9 @@ int32_t toggleoverlay(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t toggletag(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
uint32_t newtags;
|
||||
Client *sel = focustop(selmon);
|
||||
if (!sel)
|
||||
|
|
@ -1370,17 +1460,25 @@ int32_t toggletag(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t toggleview(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
uint32_t newtagset;
|
||||
uint32_t target;
|
||||
Client *c = NULL;
|
||||
|
||||
target = arg->ui == 0 ? ~0 & TAGMASK : arg->ui;
|
||||
|
||||
newtagset =
|
||||
selmon ? selmon->tagset[selmon->seltags] ^ (target & TAGMASK) : 0;
|
||||
newtagset = selmon->tagset[selmon->seltags] ^ (target & TAGMASK);
|
||||
|
||||
if (newtagset) {
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
focusclient(focustop(selmon), 1);
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, selmon) && ISTILED(c)) {
|
||||
set_size_per(selmon, c);
|
||||
}
|
||||
}
|
||||
arrange(selmon, false, false);
|
||||
}
|
||||
printstatus();
|
||||
|
|
@ -1388,6 +1486,9 @@ int32_t toggleview(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t viewtoleft(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
uint32_t target = selmon->tagset[selmon->seltags];
|
||||
|
||||
if (selmon->isoverview || selmon->pertag->curtag == 0) {
|
||||
|
|
@ -1408,6 +1509,9 @@ int32_t viewtoleft(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t viewtoright(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (selmon->isoverview || selmon->pertag->curtag == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1425,6 +1529,9 @@ int32_t viewtoright(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t viewtoleft_have_client(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
uint32_t n;
|
||||
uint32_t current = get_tags_first_tag_num(selmon->tagset[selmon->seltags]);
|
||||
bool found = false;
|
||||
|
|
@ -1449,6 +1556,9 @@ int32_t viewtoleft_have_client(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t viewtoright_have_client(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
uint32_t n;
|
||||
uint32_t current = get_tags_first_tag_num(selmon->tagset[selmon->seltags]);
|
||||
bool found = false;
|
||||
|
|
@ -1473,6 +1583,9 @@ int32_t viewtoright_have_client(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t viewcrossmon(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
focusmon(&(Arg){.v = arg->v, .i = UNDIR});
|
||||
view_in_mon(arg, true, selmon, true);
|
||||
return 0;
|
||||
|
|
@ -1482,7 +1595,7 @@ int32_t tagcrossmon(const Arg *arg) {
|
|||
if (!selmon || !selmon->sel)
|
||||
return 0;
|
||||
|
||||
if (regex_match(selmon->wlr_output->name, arg->v)) {
|
||||
if (match_monitor_spec(arg->v, selmon)) {
|
||||
tag_client(arg, selmon->sel);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1551,6 +1664,8 @@ int32_t setoption(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t minimized(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (selmon && selmon->isoverview)
|
||||
return 0;
|
||||
|
|
@ -1573,8 +1688,11 @@ void fix_mon_tagset_from_overview(Monitor *m) {
|
|||
|
||||
int32_t toggleoverview(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
if (selmon->isoverview && ov_tab_mode && arg->i != 1 && selmon->sel) {
|
||||
if (selmon->isoverview && config.ov_tab_mode && arg->i != 1 &&
|
||||
selmon->sel) {
|
||||
focusstack(&(Arg){.i = 1});
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1636,7 +1754,7 @@ int32_t disable_monitor(const Arg *arg) {
|
|||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, false);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
m->asleep = 1;
|
||||
|
|
@ -1651,7 +1769,7 @@ int32_t enable_monitor(const Arg *arg) {
|
|||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, true);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
m->asleep = 0;
|
||||
|
|
@ -1666,7 +1784,7 @@ int32_t toggle_monitor(const Arg *arg) {
|
|||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, !m->wlr_output->enabled);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
m->asleep = !m->wlr_output->enabled;
|
||||
|
|
@ -1678,34 +1796,27 @@ int32_t toggle_monitor(const Arg *arg) {
|
|||
}
|
||||
|
||||
int32_t scroller_stack(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
Client *c = selmon->sel;
|
||||
Client *stack_head = NULL;
|
||||
Client *source_stack_head = NULL;
|
||||
if (!c || !c->mon || c->isfloating || !is_scroller_layout(selmon))
|
||||
return 0;
|
||||
|
||||
if (c && (!client_only_in_one_tag(c) || c->isglobal || c->isunglobal))
|
||||
return 0;
|
||||
|
||||
bool is_horizontal_layout =
|
||||
c->mon->pertag->ltidxs[c->mon->pertag->curtag]->id == SCROLLER ? true
|
||||
: false;
|
||||
|
||||
Client *target_client = find_client_by_direction(c, arg, false, true);
|
||||
|
||||
if (target_client && (!client_only_in_one_tag(target_client) ||
|
||||
target_client->isglobal || target_client->isunglobal))
|
||||
return 0;
|
||||
|
||||
if (target_client) {
|
||||
stack_head = get_scroll_stack_head(target_client);
|
||||
}
|
||||
|
||||
if (c) {
|
||||
source_stack_head = get_scroll_stack_head(c);
|
||||
}
|
||||
source_stack_head = get_scroll_stack_head(c);
|
||||
|
||||
if (stack_head == source_stack_head) {
|
||||
if (source_stack_head == stack_head) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1753,6 +1864,10 @@ int32_t scroller_stack(const Arg *arg) {
|
|||
|
||||
if (!target_client || target_client->mon != c->mon) {
|
||||
return 0;
|
||||
} else {
|
||||
c->isglobal = target_client->isglobal = 0;
|
||||
c->isunglobal = target_client->isglobal = 0;
|
||||
c->tags = target_client->tags = get_tags_first_tag(target_client->tags);
|
||||
}
|
||||
|
||||
exit_scroller_stack(c);
|
||||
|
|
@ -1778,4 +1893,28 @@ int32_t scroller_stack(const Arg *arg) {
|
|||
|
||||
arrange(selmon, false, false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t toggle_all_floating(const Arg *arg) {
|
||||
if (!selmon || !selmon->sel)
|
||||
return 0;
|
||||
|
||||
Client *c = NULL;
|
||||
bool should_floating = !selmon->sel->isfloating;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, selmon)) {
|
||||
|
||||
if (c->isfloating && !should_floating) {
|
||||
c->old_master_inner_per = 0.0f;
|
||||
c->old_stack_inner_per = 0.0f;
|
||||
set_size_per(selmon, c);
|
||||
}
|
||||
|
||||
if (c->isfloating != should_floating) {
|
||||
setfloating(c, should_floating);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void handle_tearing_new_object(struct wl_listener *listener, void *data) {
|
|||
|
||||
bool check_tearing_frame_allow(Monitor *m) {
|
||||
/* never allow tearing when disabled */
|
||||
if (!allow_tearing) {
|
||||
if (!config.allow_tearing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ bool check_tearing_frame_allow(Monitor *m) {
|
|||
}
|
||||
|
||||
/* allow tearing for any window when requested or forced */
|
||||
if (allow_tearing == TEARING_ENABLED) {
|
||||
if (config.allow_tearing == TEARING_ENABLED) {
|
||||
if (c->force_tearing == STATE_UNSPECIFIED) {
|
||||
return c->tearing_hint;
|
||||
} else {
|
||||
|
|
@ -87,7 +87,8 @@ bool check_tearing_frame_allow(Monitor *m) {
|
|||
|
||||
if (c->force_tearing == STATE_UNSPECIFIED) {
|
||||
/* honor the tearing hint or the fullscreen-force preference */
|
||||
return c->tearing_hint || allow_tearing == TEARING_FULLSCREEN_ONLY;
|
||||
return c->tearing_hint ||
|
||||
config.allow_tearing == TEARING_FULLSCREEN_ONLY;
|
||||
}
|
||||
|
||||
/* honor tearing as requested by action */
|
||||
|
|
|
|||
|
|
@ -77,15 +77,6 @@ Monitor *output_from_wlr_output(struct wlr_output *wlr_output) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Monitor *output_nearest_to(int32_t lx, int32_t ly) {
|
||||
double closest_x, closest_y;
|
||||
wlr_output_layout_closest_point(output_layout, NULL, lx, ly, &closest_x,
|
||||
&closest_y);
|
||||
|
||||
return output_from_wlr_output(
|
||||
wlr_output_layout_output_at(output_layout, closest_x, closest_y));
|
||||
}
|
||||
|
||||
bool output_is_usable(Monitor *m) { return m && m->wlr_output->enabled; }
|
||||
|
||||
static bool
|
||||
|
|
@ -255,7 +246,7 @@ static void update_popup_position(struct dwl_input_method_popup *popup) {
|
|||
cursor_rect = (struct wlr_box){0};
|
||||
}
|
||||
|
||||
output = output_nearest_to(cursor_rect.x, cursor_rect.y);
|
||||
output = get_monitor_nearest_to(cursor_rect.x, cursor_rect.y);
|
||||
if (!output_is_usable(output)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
bool check_hit_no_border(Client *c) {
|
||||
int32_t i;
|
||||
bool hit_no_border = false;
|
||||
if (!render_border) {
|
||||
hit_no_border = true;
|
||||
}
|
||||
|
||||
for (i = 0; i < config.tag_rules_count; i++) {
|
||||
if (c->tags & (1 << (config.tag_rules[i].id - 1)) &&
|
||||
config.tag_rules[i].no_render_border) {
|
||||
hit_no_border = true;
|
||||
}
|
||||
if (c->mon && !c->mon->isoverview &&
|
||||
c->mon->pertag->no_render_border[get_tags_first_tag_num(c->tags)]) {
|
||||
hit_no_border = true;
|
||||
}
|
||||
|
||||
if (no_border_when_single && c && c->mon &&
|
||||
if (config.no_border_when_single && c && c->mon &&
|
||||
((ISSCROLLTILED(c) && c->mon->visible_scroll_tiling_clients == 1) ||
|
||||
c->mon->visible_clients == 1)) {
|
||||
hit_no_border = true;
|
||||
}
|
||||
return hit_no_border;
|
||||
}
|
||||
|
||||
Client *termforwin(Client *w) {
|
||||
Client *c = NULL;
|
||||
|
||||
|
|
@ -39,7 +37,7 @@ Client *get_client_by_id_or_title(const char *arg_id, const char *arg_title) {
|
|||
const char *appid, *title;
|
||||
Client *c = NULL;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!scratchpad_cross_monitor && c->mon != selmon) {
|
||||
if (!config.scratchpad_cross_monitor && c->mon != selmon) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +81,9 @@ setclient_coordinate_center(Client *c, Monitor *tm, struct wlr_box geom,
|
|||
int32_t len = 0;
|
||||
Monitor *m = tm ? tm : selmon;
|
||||
|
||||
if (!m)
|
||||
return geom;
|
||||
|
||||
uint32_t cbw = check_hit_no_border(c) ? c->bw : 0;
|
||||
|
||||
if (!c->no_force_center && m) {
|
||||
|
|
@ -164,7 +165,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||
// 第一次遍历,计算客户端数量
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c && (findfloating || !c->isfloating) && !c->isunglobal &&
|
||||
(focus_cross_monitor || c->mon == tc->mon) &&
|
||||
(config.focus_cross_monitor || c->mon == tc->mon) &&
|
||||
(c->tags & c->mon->tagset[c->mon->seltags])) {
|
||||
last++;
|
||||
}
|
||||
|
|
@ -185,7 +186,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||
last = -1;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c && (findfloating || !c->isfloating) && !c->isunglobal &&
|
||||
(focus_cross_monitor || c->mon == tc->mon) &&
|
||||
(config.focus_cross_monitor || c->mon == tc->mon) &&
|
||||
(c->tags & c->mon->tagset[c->mon->seltags])) {
|
||||
last++;
|
||||
tempClients[last] = c;
|
||||
|
|
@ -508,21 +509,21 @@ Client *get_next_stack_client(Client *c, bool reverse) {
|
|||
float *get_border_color(Client *c) {
|
||||
|
||||
if (c->mon != selmon) {
|
||||
return bordercolor;
|
||||
return config.bordercolor;
|
||||
} else if (c->isurgent) {
|
||||
return urgentcolor;
|
||||
return config.urgentcolor;
|
||||
} else if (c->is_in_scratchpad && selmon && c == selmon->sel) {
|
||||
return scratchpadcolor;
|
||||
return config.scratchpadcolor;
|
||||
} else if (c->isglobal && selmon && c == selmon->sel) {
|
||||
return globalcolor;
|
||||
return config.globalcolor;
|
||||
} else if (c->isoverlay && selmon && c == selmon->sel) {
|
||||
return overlaycolor;
|
||||
return config.overlaycolor;
|
||||
} else if (c->ismaximizescreen && selmon && c == selmon->sel) {
|
||||
return maximizescreencolor;
|
||||
return config.maximizescreencolor;
|
||||
} else if (selmon && c == selmon->sel) {
|
||||
return focuscolor;
|
||||
return config.focuscolor;
|
||||
} else {
|
||||
return bordercolor;
|
||||
return config.bordercolor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,3 +96,81 @@ Monitor *xytomon(double x, double y) {
|
|||
struct wlr_output *o = wlr_output_layout_output_at(output_layout, x, y);
|
||||
return o ? o->data : NULL;
|
||||
}
|
||||
|
||||
Monitor *get_monitor_nearest_to(int32_t lx, int32_t ly) {
|
||||
double closest_x, closest_y;
|
||||
wlr_output_layout_closest_point(output_layout, NULL, lx, ly, &closest_x,
|
||||
&closest_y);
|
||||
|
||||
return output_from_wlr_output(
|
||||
wlr_output_layout_output_at(output_layout, closest_x, closest_y));
|
||||
}
|
||||
|
||||
bool match_monitor_spec(char *spec, Monitor *m) {
|
||||
if (!spec || !m)
|
||||
return false;
|
||||
|
||||
// if the spec does not contain a colon, treat it as a match on the monitor
|
||||
// name
|
||||
if (strchr(spec, ':') == NULL) {
|
||||
return regex_match(spec, m->wlr_output->name);
|
||||
}
|
||||
|
||||
char *spec_copy = strdup(spec);
|
||||
if (!spec_copy)
|
||||
return false;
|
||||
|
||||
char *name_rule = NULL;
|
||||
char *make_rule = NULL;
|
||||
char *model_rule = NULL;
|
||||
char *serial_rule = NULL;
|
||||
|
||||
char *token = strtok(spec_copy, "&&");
|
||||
while (token) {
|
||||
char *colon = strchr(token, ':');
|
||||
if (colon) {
|
||||
*colon = '\0';
|
||||
char *key = token;
|
||||
char *value = colon + 1;
|
||||
|
||||
if (strcmp(key, "name") == 0)
|
||||
name_rule = strdup(value);
|
||||
else if (strcmp(key, "make") == 0)
|
||||
make_rule = strdup(value);
|
||||
else if (strcmp(key, "model") == 0)
|
||||
model_rule = strdup(value);
|
||||
else if (strcmp(key, "serial") == 0)
|
||||
serial_rule = strdup(value);
|
||||
}
|
||||
token = strtok(NULL, "&&");
|
||||
}
|
||||
|
||||
bool match = true;
|
||||
|
||||
if (name_rule) {
|
||||
if (!regex_match(name_rule, m->wlr_output->name))
|
||||
match = false;
|
||||
}
|
||||
if (make_rule) {
|
||||
if (!m->wlr_output->make || strcmp(make_rule, m->wlr_output->make) != 0)
|
||||
match = false;
|
||||
}
|
||||
if (model_rule) {
|
||||
if (!m->wlr_output->model ||
|
||||
strcmp(model_rule, m->wlr_output->model) != 0)
|
||||
match = false;
|
||||
}
|
||||
if (serial_rule) {
|
||||
if (!m->wlr_output->serial ||
|
||||
strcmp(serial_rule, m->wlr_output->serial) != 0)
|
||||
match = false;
|
||||
}
|
||||
|
||||
free(spec_copy);
|
||||
free(name_rule);
|
||||
free(make_rule);
|
||||
free(model_rule);
|
||||
free(serial_rule);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
|
@ -1,11 +1,34 @@
|
|||
void save_old_size_per(Monitor *m) {
|
||||
Client *c = NULL;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
||||
c->old_master_inner_per = c->master_inner_per;
|
||||
c->old_stack_inner_per = c->stack_inner_per;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void restore_size_per(Monitor *m, Client *c) {
|
||||
Client *fc = NULL;
|
||||
double total_master_inner_per = 0;
|
||||
double total_stack_inner_per = 0;
|
||||
|
||||
if (!m || !c)
|
||||
return;
|
||||
|
||||
if (!m->wlr_output->enabled)
|
||||
return;
|
||||
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
if (VISIBLEON(fc, m) && ISTILED(fc)) {
|
||||
fc->old_ismaster = fc->ismaster;
|
||||
}
|
||||
}
|
||||
|
||||
c->old_master_inner_per = c->master_inner_per;
|
||||
c->old_stack_inner_per = c->stack_inner_per;
|
||||
|
||||
pre_caculate_before_arrange(m, false, false, true);
|
||||
|
||||
const Layout *current_layout = m->pertag->ltidxs[m->pertag->curtag];
|
||||
|
||||
if (current_layout->id == SCROLLER ||
|
||||
|
|
@ -15,7 +38,7 @@ void restore_size_per(Monitor *m, Client *c) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (current_layout->id == CENTER_TILE || c->ismaster) {
|
||||
if (current_layout->id == CENTER_TILE) {
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
if (VISIBLEON(fc, m) && ISTILED(fc) && !c->ismaster) {
|
||||
set_size_per(m, fc);
|
||||
|
|
@ -24,19 +47,36 @@ void restore_size_per(Monitor *m, Client *c) {
|
|||
return;
|
||||
}
|
||||
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
if (VISIBLEON(fc, m) && ISTILED(fc) && fc != c) {
|
||||
if (fc->ismaster) {
|
||||
total_master_inner_per += fc->master_inner_per;
|
||||
} else {
|
||||
total_stack_inner_per += fc->stack_inner_per;
|
||||
}
|
||||
}
|
||||
// it is possible that the current floating window is moved to another tag,
|
||||
// but the tag has not executed save_old_size_per
|
||||
// so it must be judged whether their old size values are initial values
|
||||
|
||||
if (!c->ismaster && c->old_stack_inner_per < 1.0 &&
|
||||
c->old_stack_inner_per > 0.0f && c->stack_inner_per < 1.0 &&
|
||||
c->stack_inner_per > 0.0f) {
|
||||
c->stack_inner_per = (1.0 - c->stack_inner_per) *
|
||||
c->old_stack_inner_per /
|
||||
(1.0 - c->old_stack_inner_per);
|
||||
}
|
||||
|
||||
if (!c->ismaster && total_stack_inner_per) {
|
||||
c->stack_inner_per = total_stack_inner_per * c->stack_inner_per /
|
||||
(1 - c->stack_inner_per);
|
||||
if (c->ismaster && c->old_master_inner_per < 1.0 &&
|
||||
c->old_master_inner_per > 0.0f && c->master_inner_per < 1.0 &&
|
||||
c->master_inner_per > 0.0f) {
|
||||
c->master_inner_per = (1.0 - c->master_inner_per) *
|
||||
c->old_master_inner_per /
|
||||
(1.0 - c->old_master_inner_per);
|
||||
}
|
||||
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
if (VISIBLEON(fc, m) && ISTILED(fc) && fc != c && !fc->ismaster &&
|
||||
fc->old_ismaster && fc->old_stack_inner_per < 1.0 &&
|
||||
fc->old_stack_inner_per > 0.0f && fc->stack_inner_per < 1.0 &&
|
||||
fc->stack_inner_per > 0.0f) {
|
||||
fc->stack_inner_per = (1.0 - fc->stack_inner_per) *
|
||||
fc->old_stack_inner_per /
|
||||
(1.0 - fc->old_stack_inner_per);
|
||||
fc->old_ismaster = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +92,7 @@ void set_size_per(Monitor *m, Client *c) {
|
|||
wl_list_for_each(fc, &clients, link) {
|
||||
if (VISIBLEON(fc, m) && ISTILED(fc) && fc != c) {
|
||||
if (current_layout->id == CENTER_TILE &&
|
||||
!(fc->isleftstack ^ c->isleftstack))
|
||||
(fc->isleftstack ^ c->isleftstack))
|
||||
continue;
|
||||
c->master_mfact_per = fc->master_mfact_per;
|
||||
c->master_inner_per = fc->master_inner_per;
|
||||
|
|
@ -90,8 +130,7 @@ void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
break;
|
||||
}
|
||||
|
||||
if (!begin_find_nextnext && VISIBLEON(tc, grabc->mon) &&
|
||||
ISTILED(tc)) { // 根据你的实际字段名调整
|
||||
if (!begin_find_nextnext && VISIBLEON(tc, grabc->mon) && ISTILED(tc)) {
|
||||
next = tc;
|
||||
begin_find_nextnext = true;
|
||||
continue;
|
||||
|
|
@ -107,8 +146,7 @@ void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
break;
|
||||
}
|
||||
|
||||
if (!begin_find_prevprev && VISIBLEON(tc, grabc->mon) &&
|
||||
ISTILED(tc)) { // 根据你的实际字段名调整
|
||||
if (!begin_find_prevprev && VISIBLEON(tc, grabc->mon) && ISTILED(tc)) {
|
||||
prev = tc;
|
||||
begin_find_prevprev = true;
|
||||
continue;
|
||||
|
|
@ -244,6 +282,23 @@ void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
// 应用到所有平铺窗口
|
||||
wl_list_for_each(tc, &clients, link) {
|
||||
if (VISIBLEON(tc, grabc->mon) && ISTILED(tc)) {
|
||||
|
||||
if (!isdrag && tc != grabc) {
|
||||
if (!tc->ismaster && new_stack_inner_per != 1.0f &&
|
||||
grabc->old_stack_inner_per != 1.0f &&
|
||||
(type != CENTER_TILE ||
|
||||
!(grabc->isleftstack ^ tc->isleftstack)))
|
||||
tc->stack_inner_per = (1 - new_stack_inner_per) /
|
||||
(1 - grabc->old_stack_inner_per) *
|
||||
tc->stack_inner_per;
|
||||
if (tc->ismaster && new_master_inner_per != 1.0f &&
|
||||
grabc->old_master_inner_per != 1.0f)
|
||||
tc->master_inner_per =
|
||||
(1.0f - new_master_inner_per) /
|
||||
(1.0f - grabc->old_master_inner_per) *
|
||||
tc->master_inner_per;
|
||||
}
|
||||
|
||||
tc->master_mfact_per = new_master_mfact_per;
|
||||
}
|
||||
}
|
||||
|
|
@ -257,7 +312,7 @@ void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
}
|
||||
|
||||
if (last_apply_drap_time == 0 ||
|
||||
time - last_apply_drap_time > drag_tile_refresh_interval) {
|
||||
time - last_apply_drap_time > config.drag_tile_refresh_interval) {
|
||||
arrange(grabc->mon, false, false);
|
||||
last_apply_drap_time = time;
|
||||
}
|
||||
|
|
@ -276,8 +331,7 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
for (node = grabc->link.next; node != &clients; node = node->next) {
|
||||
tc = wl_container_of(node, tc, link);
|
||||
|
||||
if (VISIBLEON(tc, grabc->mon) &&
|
||||
ISTILED(tc)) { // 根据你的实际字段名调整
|
||||
if (VISIBLEON(tc, grabc->mon) && ISTILED(tc)) {
|
||||
next = tc;
|
||||
break;
|
||||
}
|
||||
|
|
@ -287,8 +341,7 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
for (node = grabc->link.prev; node != &clients; node = node->prev) {
|
||||
tc = wl_container_of(node, tc, link);
|
||||
|
||||
if (VISIBLEON(tc, grabc->mon) &&
|
||||
ISTILED(tc)) { // 根据你的实际字段名调整
|
||||
if (VISIBLEON(tc, grabc->mon) && ISTILED(tc)) {
|
||||
prev = tc;
|
||||
break;
|
||||
}
|
||||
|
|
@ -401,6 +454,20 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
// 应用到所有平铺窗口
|
||||
wl_list_for_each(tc, &clients, link) {
|
||||
if (VISIBLEON(tc, grabc->mon) && ISTILED(tc)) {
|
||||
if (!isdrag && tc != grabc && type != CENTER_TILE) {
|
||||
if (!tc->ismaster && new_stack_inner_per != 1.0f &&
|
||||
grabc->old_stack_inner_per != 1.0f)
|
||||
tc->stack_inner_per = (1 - new_stack_inner_per) /
|
||||
(1 - grabc->old_stack_inner_per) *
|
||||
tc->stack_inner_per;
|
||||
if (tc->ismaster && new_master_inner_per != 1.0f &&
|
||||
grabc->old_master_inner_per != 1.0f)
|
||||
tc->master_inner_per =
|
||||
(1.0f - new_master_inner_per) /
|
||||
(1.0f - grabc->old_master_inner_per) *
|
||||
tc->master_inner_per;
|
||||
}
|
||||
|
||||
tc->master_mfact_per = new_master_mfact_per;
|
||||
}
|
||||
}
|
||||
|
|
@ -414,7 +481,7 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
}
|
||||
|
||||
if (last_apply_drap_time == 0 ||
|
||||
time - last_apply_drap_time > drag_tile_refresh_interval) {
|
||||
time - last_apply_drap_time > config.drag_tile_refresh_interval) {
|
||||
arrange(grabc->mon, false, false);
|
||||
last_apply_drap_time = time;
|
||||
}
|
||||
|
|
@ -423,13 +490,14 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
|
||||
void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx,
|
||||
int32_t offsety, uint32_t time, bool isvertical) {
|
||||
Client *tc = NULL;
|
||||
float delta_x, delta_y;
|
||||
float new_scroller_proportion;
|
||||
float new_stack_proportion;
|
||||
Client *stack_head = get_scroll_stack_head(grabc);
|
||||
|
||||
if (grabc && grabc->mon->visible_tiling_clients == 1 &&
|
||||
!scroller_ignore_proportion_single)
|
||||
!config.scroller_ignore_proportion_single)
|
||||
return;
|
||||
|
||||
if (!start_drag_window && isdrag) {
|
||||
|
|
@ -583,19 +651,29 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
// 应用限制,确保比例在合理范围内
|
||||
new_scroller_proportion =
|
||||
fmaxf(0.1f, fminf(1.0f, new_scroller_proportion));
|
||||
new_stack_proportion = fmaxf(0.1f, fminf(1.0f, new_stack_proportion));
|
||||
new_stack_proportion = fmaxf(0.1f, fminf(0.9f, new_stack_proportion));
|
||||
|
||||
grabc->stack_proportion = new_stack_proportion;
|
||||
|
||||
stack_head->scroller_proportion = new_scroller_proportion;
|
||||
|
||||
wl_list_for_each(tc, &clients, link) {
|
||||
if (!isdrag && new_stack_proportion != 1.0f &&
|
||||
grabc->old_stack_proportion != 1.0f && tc != grabc &&
|
||||
ISTILED(tc) && get_scroll_stack_head(tc) == stack_head) {
|
||||
tc->stack_proportion = (1.0f - new_stack_proportion) /
|
||||
(1.0f - grabc->old_stack_proportion) *
|
||||
tc->stack_proportion;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isdrag) {
|
||||
arrange(grabc->mon, false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (last_apply_drap_time == 0 ||
|
||||
time - last_apply_drap_time > drag_tile_refresh_interval) {
|
||||
time - last_apply_drap_time > config.drag_tile_refresh_interval) {
|
||||
arrange(grabc->mon, false, false);
|
||||
last_apply_drap_time = time;
|
||||
}
|
||||
|
|
@ -631,6 +709,18 @@ void resize_tile_client(Client *grabc, bool isdrag, int32_t offsetx,
|
|||
}
|
||||
}
|
||||
|
||||
/* If there are no calculation omissions,
|
||||
these two functions will never be triggered.
|
||||
Just in case to facilitate the final investigation*/
|
||||
|
||||
void check_size_per_valid(Client *c) {
|
||||
if (c->ismaster) {
|
||||
assert(c->master_inner_per > 0.0f && c->master_inner_per <= 1.0f);
|
||||
} else {
|
||||
assert(c->stack_inner_per > 0.0f && c->stack_inner_per <= 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void reset_size_per_mon(Monitor *m, int32_t tile_cilent_num,
|
||||
double total_left_stack_hight_percent,
|
||||
double total_right_stack_hight_percent,
|
||||
|
|
@ -646,6 +736,7 @@ void reset_size_per_mon(Monitor *m, int32_t tile_cilent_num,
|
|||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
||||
|
||||
if (total_master_inner_percent > 0.0 && i < nmasters) {
|
||||
c->ismaster = true;
|
||||
c->stack_inner_per = stack_num ? 1.0f / stack_num : 1.0f;
|
||||
|
|
@ -661,17 +752,20 @@ void reset_size_per_mon(Monitor *m, int32_t tile_cilent_num,
|
|||
: 1.0f;
|
||||
}
|
||||
i++;
|
||||
|
||||
check_size_per_valid(c);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
||||
|
||||
if (total_master_inner_percent > 0.0 && i < nmasters) {
|
||||
c->ismaster = true;
|
||||
if ((stack_index % 2) ^ (tile_cilent_num % 2 == 0)) {
|
||||
c->stack_inner_per =
|
||||
stack_num > 1 ? 1.0f / ((stack_num - 1) / 2) : 1.0f;
|
||||
|
||||
stack_num > 1 ? 1.0f / ((stack_num - 1) / 2.0f)
|
||||
: 1.0f;
|
||||
} else {
|
||||
c->stack_inner_per =
|
||||
stack_num > 1 ? 2.0f / stack_num : 1.0f;
|
||||
|
|
@ -700,13 +794,15 @@ void reset_size_per_mon(Monitor *m, int32_t tile_cilent_num,
|
|||
}
|
||||
}
|
||||
i++;
|
||||
|
||||
check_size_per_valid(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void // 17
|
||||
arrange(Monitor *m, bool want_animation, bool from_view) {
|
||||
void pre_caculate_before_arrange(Monitor *m, bool want_animation,
|
||||
bool from_view, bool only_caculate) {
|
||||
Client *c = NULL;
|
||||
double total_stack_inner_percent = 0;
|
||||
double total_master_inner_percent = 0;
|
||||
|
|
@ -718,11 +814,6 @@ arrange(Monitor *m, bool want_animation, bool from_view) {
|
|||
int32_t master_num = 0;
|
||||
int32_t stack_num = 0;
|
||||
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
if (!m->wlr_output->enabled)
|
||||
return;
|
||||
m->visible_clients = 0;
|
||||
m->visible_tiling_clients = 0;
|
||||
m->visible_scroll_tiling_clients = 0;
|
||||
|
|
@ -795,14 +886,17 @@ arrange(Monitor *m, bool want_animation, bool from_view) {
|
|||
i++;
|
||||
}
|
||||
|
||||
set_arrange_visible(m, c, want_animation);
|
||||
if (!only_caculate)
|
||||
set_arrange_visible(m, c, want_animation);
|
||||
} else {
|
||||
set_arrange_hidden(m, c, want_animation);
|
||||
if (!only_caculate)
|
||||
set_arrange_hidden(m, c, want_animation);
|
||||
}
|
||||
}
|
||||
|
||||
if (c->mon == m && c->ismaximizescreen && !c->animation.tagouted &&
|
||||
!c->animation.tagouting && VISIBLEON(c, m)) {
|
||||
if (!only_caculate && c->mon == m && c->ismaximizescreen &&
|
||||
!c->animation.tagouted && !c->animation.tagouting &&
|
||||
VISIBLEON(c, m)) {
|
||||
reset_maximizescreen_size(c);
|
||||
}
|
||||
}
|
||||
|
|
@ -811,6 +905,18 @@ arrange(Monitor *m, bool want_animation, bool from_view) {
|
|||
m, m->visible_tiling_clients, total_left_stack_hight_percent,
|
||||
total_right_stack_hight_percent, total_stack_inner_percent,
|
||||
total_master_inner_percent, master_num, stack_num);
|
||||
}
|
||||
|
||||
void // 17
|
||||
arrange(Monitor *m, bool want_animation, bool from_view) {
|
||||
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
if (!m->wlr_output->enabled)
|
||||
return;
|
||||
|
||||
pre_caculate_before_arrange(m, want_animation, from_view, false);
|
||||
|
||||
if (m->isoverview) {
|
||||
overviewlayout.arrange(m);
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ void grid(Monitor *m) {
|
|||
Client *c = NULL;
|
||||
n = 0;
|
||||
int32_t target_gappo =
|
||||
enablegaps ? m->isoverview ? overviewgappo : gappoh : 0;
|
||||
enablegaps ? m->isoverview ? config.overviewgappo : config.gappoh : 0;
|
||||
int32_t target_gappi =
|
||||
enablegaps ? m->isoverview ? overviewgappi : gappih : 0;
|
||||
enablegaps ? m->isoverview ? config.overviewgappi : config.gappih : 0;
|
||||
float single_width_ratio = m->isoverview ? 0.7 : 0.9;
|
||||
float single_height_ratio = m->isoverview ? 0.8 : 0.9;
|
||||
|
||||
|
|
@ -123,9 +123,12 @@ void deck(Monitor *m) {
|
|||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappih =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappoh =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
||||
n = m->visible_tiling_clients;
|
||||
|
||||
|
|
@ -188,12 +191,15 @@ void horizontal_scroll_adjust_fullandmax(Client *c,
|
|||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappih =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappoh =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappih = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappih;
|
||||
cur_gappoh = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappoh;
|
||||
cur_gappov = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappov;
|
||||
|
||||
if (c->isfullscreen) {
|
||||
target_geom->height = m->m.height;
|
||||
|
|
@ -289,14 +295,18 @@ void scroller(Monitor *m) {
|
|||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
int32_t cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
|
||||
cur_gappih =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappoh =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappih = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappih;
|
||||
cur_gappoh = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappoh;
|
||||
cur_gappov = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappov;
|
||||
|
||||
int32_t max_client_width = m->w.width - 2 * scroller_structs - cur_gappih;
|
||||
int32_t max_client_width =
|
||||
m->w.width - 2 * config.scroller_structs - cur_gappih;
|
||||
|
||||
n = m->visible_scroll_tiling_clients;
|
||||
|
||||
|
|
@ -320,13 +330,13 @@ void scroller(Monitor *m) {
|
|||
}
|
||||
}
|
||||
|
||||
if (n == 1 && !scroller_ignore_proportion_single &&
|
||||
if (n == 1 && !config.scroller_ignore_proportion_single &&
|
||||
!tempClients[0]->isfullscreen && !tempClients[0]->ismaximizescreen) {
|
||||
c = tempClients[0];
|
||||
|
||||
single_proportion = c->scroller_proportion_single > 0.0f
|
||||
? c->scroller_proportion_single
|
||||
: scroller_default_proportion_single;
|
||||
: config.scroller_default_proportion_single;
|
||||
|
||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||
target_geom.width = (m->w.width - 2 * cur_gappoh) * single_proportion;
|
||||
|
|
@ -360,9 +370,9 @@ void scroller(Monitor *m) {
|
|||
for (i = 0; i < n; i++) {
|
||||
c = tempClients[i];
|
||||
if (root_client == c) {
|
||||
if (c->geom.x >= m->w.x + scroller_structs &&
|
||||
if (c->geom.x >= m->w.x + config.scroller_structs &&
|
||||
c->geom.x + c->geom.width <=
|
||||
m->w.x + m->w.width - scroller_structs) {
|
||||
m->w.x + m->w.width - config.scroller_structs) {
|
||||
need_scroller = false;
|
||||
} else {
|
||||
need_scroller = true;
|
||||
|
|
@ -373,7 +383,8 @@ void scroller(Monitor *m) {
|
|||
}
|
||||
|
||||
bool need_apply_overspread =
|
||||
scroller_prefer_overspread && m->visible_scroll_tiling_clients > 1 &&
|
||||
config.scroller_prefer_overspread &&
|
||||
m->visible_scroll_tiling_clients > 1 &&
|
||||
(focus_client_index == 0 || focus_client_index == n - 1) &&
|
||||
tempClients[focus_client_index]->scroller_proportion < 1.0f;
|
||||
|
||||
|
|
@ -403,16 +414,16 @@ void scroller(Monitor *m) {
|
|||
}
|
||||
|
||||
bool need_apply_center =
|
||||
scroller_focus_center || m->visible_scroll_tiling_clients == 1 ||
|
||||
(scroller_prefer_center && !need_apply_overspread &&
|
||||
config.scroller_focus_center || m->visible_scroll_tiling_clients == 1 ||
|
||||
(config.scroller_prefer_center && !need_apply_overspread &&
|
||||
(!m->prevsel ||
|
||||
(ISSCROLLTILED(m->prevsel) &&
|
||||
(m->prevsel->scroller_proportion * max_client_width) +
|
||||
(tempClients[focus_client_index]->scroller_proportion *
|
||||
max_client_width) >
|
||||
m->w.width - 2 * scroller_structs - cur_gappih)));
|
||||
m->w.width - 2 * config.scroller_structs - cur_gappih)));
|
||||
|
||||
if (n == 1 && scroller_ignore_proportion_single) {
|
||||
if (n == 1 && config.scroller_ignore_proportion_single) {
|
||||
need_scroller = true;
|
||||
}
|
||||
|
||||
|
|
@ -439,14 +450,14 @@ void scroller(Monitor *m) {
|
|||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||
} else if (need_apply_overspread) {
|
||||
if (over_overspread_to_left) {
|
||||
target_geom.x = m->w.x + scroller_structs;
|
||||
target_geom.x = m->w.x + config.scroller_structs;
|
||||
} else {
|
||||
target_geom.x =
|
||||
m->w.x +
|
||||
(m->w.width -
|
||||
tempClients[focus_client_index]->scroller_proportion *
|
||||
max_client_width -
|
||||
scroller_structs);
|
||||
config.scroller_structs);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -456,8 +467,8 @@ void scroller(Monitor *m) {
|
|||
tempClients[focus_client_index]
|
||||
->scroller_proportion *
|
||||
max_client_width -
|
||||
scroller_structs)
|
||||
: m->w.x + scroller_structs;
|
||||
config.scroller_structs)
|
||||
: m->w.x + config.scroller_structs;
|
||||
}
|
||||
horizontal_check_scroller_root_inside_mon(
|
||||
tempClients[focus_client_index], &target_geom);
|
||||
|
|
@ -522,10 +533,14 @@ void center_tile(Monitor *m) {
|
|||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0; // 外部水平间隙
|
||||
|
||||
// 智能间隙处理
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappiv =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
|
||||
int32_t nmasters = m->pertag->nmasters[m->pertag->curtag];
|
||||
mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per
|
||||
|
|
@ -538,7 +553,8 @@ void center_tile(Monitor *m) {
|
|||
tw = mw;
|
||||
|
||||
// 判断是否需要主区域铺满
|
||||
int32_t should_overspread = center_master_overspread && (n <= nmasters);
|
||||
int32_t should_overspread =
|
||||
config.center_master_overspread && (n <= nmasters);
|
||||
|
||||
int32_t master_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (master_num - 1));
|
||||
|
|
@ -564,7 +580,7 @@ void center_tile(Monitor *m) {
|
|||
mx = cur_gappoh + tw + cur_gappih * ie;
|
||||
} else if (n - nmasters == 1) {
|
||||
// 单个堆叠窗口的处理
|
||||
if (center_when_single_stack) {
|
||||
if (config.center_when_single_stack) {
|
||||
// stack在右边,master居中,左边空着
|
||||
tw = (m->w.width - mw) / 2 - cur_gappoh - cur_gappih * ie;
|
||||
mx = cur_gappoh + tw + cur_gappih * ie; // master居中
|
||||
|
|
@ -641,7 +657,7 @@ void center_tile(Monitor *m) {
|
|||
}
|
||||
|
||||
int32_t stack_x;
|
||||
if (center_when_single_stack) {
|
||||
if (config.center_when_single_stack) {
|
||||
// 放在右侧(master居中时,stack在右边)
|
||||
stack_x = m->w.x + mx + mw + cur_gappih * ie;
|
||||
} else {
|
||||
|
|
@ -745,10 +761,14 @@ void tile(Monitor *m) {
|
|||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappiv =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
|
||||
|
|
@ -855,10 +875,14 @@ void right_tile(Monitor *m) {
|
|||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappiv =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
|
||||
|
|
@ -953,8 +977,10 @@ monocle(Monitor *m) {
|
|||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||
|
|
|
|||
|
|
@ -19,10 +19,14 @@ void vertical_tile(Monitor *m) {
|
|||
int32_t cur_gapoh = enablegaps ? m->gappoh : 0;
|
||||
int32_t cur_gapov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gapih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapih;
|
||||
cur_gapiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapiv;
|
||||
cur_gapoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapoh;
|
||||
cur_gapov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapov;
|
||||
cur_gapih =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapih;
|
||||
cur_gapiv =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapiv;
|
||||
cur_gapoh =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapoh;
|
||||
cur_gapov =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapov;
|
||||
|
||||
wl_list_for_each(fc, &clients, link) {
|
||||
if (VISIBLEON(fc, m) && ISTILED(fc))
|
||||
|
|
@ -116,9 +120,12 @@ void vertical_deck(Monitor *m) {
|
|||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappiv =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov =
|
||||
config.smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
||||
n = m->visible_tiling_clients;
|
||||
|
||||
|
|
@ -175,12 +182,15 @@ void vertical_scroll_adjust_fullandmax(Client *c, struct wlr_box *target_geom) {
|
|||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappiv =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappov =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappiv = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappiv;
|
||||
cur_gappov = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappov;
|
||||
cur_gappoh = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappoh;
|
||||
|
||||
if (c->isfullscreen) {
|
||||
target_geom->width = m->m.width;
|
||||
|
|
@ -276,14 +286,18 @@ void vertical_scroller(Monitor *m) {
|
|||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
int32_t cur_gappih = enablegaps ? m->gappih : 0;
|
||||
|
||||
cur_gappiv =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappov =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappiv = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappiv;
|
||||
cur_gappov = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappov;
|
||||
cur_gappoh = config.smartgaps && m->visible_scroll_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappoh;
|
||||
|
||||
int32_t max_client_height = m->w.height - 2 * scroller_structs - cur_gappiv;
|
||||
int32_t max_client_height =
|
||||
m->w.height - 2 * config.scroller_structs - cur_gappiv;
|
||||
|
||||
n = m->visible_scroll_tiling_clients;
|
||||
|
||||
|
|
@ -304,13 +318,13 @@ void vertical_scroller(Monitor *m) {
|
|||
}
|
||||
}
|
||||
|
||||
if (n == 1 && !scroller_ignore_proportion_single &&
|
||||
if (n == 1 && !config.scroller_ignore_proportion_single &&
|
||||
!tempClients[0]->isfullscreen && !tempClients[0]->ismaximizescreen) {
|
||||
c = tempClients[0];
|
||||
|
||||
single_proportion = c->scroller_proportion_single > 0.0f
|
||||
? c->scroller_proportion_single
|
||||
: scroller_default_proportion_single;
|
||||
: config.scroller_default_proportion_single;
|
||||
|
||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
||||
target_geom.height = (m->w.height - 2 * cur_gappov) * single_proportion;
|
||||
|
|
@ -344,9 +358,9 @@ void vertical_scroller(Monitor *m) {
|
|||
for (i = 0; i < n; i++) {
|
||||
c = tempClients[i];
|
||||
if (root_client == c) {
|
||||
if (c->geom.y >= m->w.y + scroller_structs &&
|
||||
if (c->geom.y >= m->w.y + config.scroller_structs &&
|
||||
c->geom.y + c->geom.height <=
|
||||
m->w.y + m->w.height - scroller_structs) {
|
||||
m->w.y + m->w.height - config.scroller_structs) {
|
||||
need_scroller = false;
|
||||
} else {
|
||||
need_scroller = true;
|
||||
|
|
@ -357,7 +371,8 @@ void vertical_scroller(Monitor *m) {
|
|||
}
|
||||
|
||||
bool need_apply_overspread =
|
||||
scroller_prefer_overspread && m->visible_scroll_tiling_clients > 1 &&
|
||||
config.scroller_prefer_overspread &&
|
||||
m->visible_scroll_tiling_clients > 1 &&
|
||||
(focus_client_index == 0 || focus_client_index == n - 1) &&
|
||||
tempClients[focus_client_index]->scroller_proportion < 1.0f;
|
||||
|
||||
|
|
@ -387,16 +402,16 @@ void vertical_scroller(Monitor *m) {
|
|||
}
|
||||
|
||||
bool need_apply_center =
|
||||
scroller_focus_center || m->visible_scroll_tiling_clients == 1 ||
|
||||
(scroller_prefer_center && !need_apply_overspread &&
|
||||
config.scroller_focus_center || m->visible_scroll_tiling_clients == 1 ||
|
||||
(config.scroller_prefer_center && !need_apply_overspread &&
|
||||
(!m->prevsel ||
|
||||
(ISSCROLLTILED(m->prevsel) &&
|
||||
(m->prevsel->scroller_proportion * max_client_height) +
|
||||
(tempClients[focus_client_index]->scroller_proportion *
|
||||
max_client_height) >
|
||||
m->w.height - 2 * scroller_structs - cur_gappiv)));
|
||||
m->w.height - 2 * config.scroller_structs - cur_gappiv)));
|
||||
|
||||
if (n == 1 && scroller_ignore_proportion_single) {
|
||||
if (n == 1 && config.scroller_ignore_proportion_single) {
|
||||
need_scroller = true;
|
||||
}
|
||||
|
||||
|
|
@ -426,14 +441,14 @@ void vertical_scroller(Monitor *m) {
|
|||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||
} else if (need_apply_overspread) {
|
||||
if (over_overspread_to_up) {
|
||||
target_geom.y = m->w.y + scroller_structs;
|
||||
target_geom.y = m->w.y + config.scroller_structs;
|
||||
} else {
|
||||
target_geom.y =
|
||||
m->w.y +
|
||||
(m->w.height -
|
||||
tempClients[focus_client_index]->scroller_proportion *
|
||||
max_client_height -
|
||||
scroller_structs);
|
||||
config.scroller_structs);
|
||||
}
|
||||
} else {
|
||||
target_geom.y = root_client->geom.y > m->w.y + (m->w.height) / 2
|
||||
|
|
@ -441,8 +456,8 @@ void vertical_scroller(Monitor *m) {
|
|||
tempClients[focus_client_index]
|
||||
->scroller_proportion *
|
||||
max_client_height -
|
||||
scroller_structs)
|
||||
: m->w.y + scroller_structs;
|
||||
config.scroller_structs)
|
||||
: m->w.y + config.scroller_structs;
|
||||
}
|
||||
vertical_check_scroller_root_inside_mon(tempClients[focus_client_index],
|
||||
&target_geom);
|
||||
|
|
@ -486,9 +501,9 @@ void vertical_grid(Monitor *m) {
|
|||
int32_t rows, cols, overrows;
|
||||
Client *c = NULL;
|
||||
int32_t target_gappo =
|
||||
enablegaps ? m->isoverview ? overviewgappo : gappov : 0;
|
||||
enablegaps ? m->isoverview ? config.overviewgappo : config.gappov : 0;
|
||||
int32_t target_gappi =
|
||||
enablegaps ? m->isoverview ? overviewgappi : gappiv : 0;
|
||||
enablegaps ? m->isoverview ? config.overviewgappi : config.gappiv : 0;
|
||||
float single_width_ratio = m->isoverview ? 0.7 : 0.9;
|
||||
float single_height_ratio = m->isoverview ? 0.8 : 0.9;
|
||||
|
||||
|
|
|
|||
1069
src/mango.c
1069
src/mango.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue