feat: add option no_radius_when_single
This commit is contained in:
@@ -149,6 +149,7 @@ typedef struct {
|
|||||||
int focus_cross_monitor;
|
int focus_cross_monitor;
|
||||||
int focus_cross_tag;
|
int focus_cross_tag;
|
||||||
int no_border_when_single;
|
int no_border_when_single;
|
||||||
|
int no_radius_when_single;
|
||||||
int snap_distance;
|
int snap_distance;
|
||||||
int enable_floating_snap;
|
int enable_floating_snap;
|
||||||
int drag_tile_to_tile;
|
int drag_tile_to_tile;
|
||||||
@@ -926,6 +927,8 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
config->syncobj_enable = atoi(value);
|
config->syncobj_enable = atoi(value);
|
||||||
} else if (strcmp(key, "no_border_when_single") == 0) {
|
} else if (strcmp(key, "no_border_when_single") == 0) {
|
||||||
config->no_border_when_single = atoi(value);
|
config->no_border_when_single = atoi(value);
|
||||||
|
} else if (strcmp(key, "no_radius_when_single") == 0) {
|
||||||
|
config->no_radius_when_single = atoi(value);
|
||||||
} else if (strcmp(key, "snap_distance") == 0) {
|
} else if (strcmp(key, "snap_distance") == 0) {
|
||||||
config->snap_distance = atoi(value);
|
config->snap_distance = atoi(value);
|
||||||
} else if (strcmp(key, "enable_floating_snap") == 0) {
|
} else if (strcmp(key, "enable_floating_snap") == 0) {
|
||||||
@@ -2049,6 +2052,7 @@ void override_config(void) {
|
|||||||
snap_distance = CLAMP_INT(config.snap_distance, 0, 99999);
|
snap_distance = CLAMP_INT(config.snap_distance, 0, 99999);
|
||||||
cursor_size = CLAMP_INT(config.cursor_size, 4, 512);
|
cursor_size = CLAMP_INT(config.cursor_size, 4, 512);
|
||||||
no_border_when_single = CLAMP_INT(config.no_border_when_single, 0, 1);
|
no_border_when_single = CLAMP_INT(config.no_border_when_single, 0, 1);
|
||||||
|
no_radius_when_single = CLAMP_INT(config.no_radius_when_single, 0, 1);
|
||||||
cursor_hide_timeout =
|
cursor_hide_timeout =
|
||||||
CLAMP_INT(config.cursor_hide_timeout, 0, 36000); // 0-10小时
|
CLAMP_INT(config.cursor_hide_timeout, 0, 36000); // 0-10小时
|
||||||
drag_tile_to_tile = CLAMP_INT(config.drag_tile_to_tile, 0, 1);
|
drag_tile_to_tile = CLAMP_INT(config.drag_tile_to_tile, 0, 1);
|
||||||
@@ -2178,6 +2182,7 @@ void set_value_default() {
|
|||||||
config.xwayland_persistence = xwayland_persistence;
|
config.xwayland_persistence = xwayland_persistence;
|
||||||
config.syncobj_enable = syncobj_enable;
|
config.syncobj_enable = syncobj_enable;
|
||||||
config.no_border_when_single = no_border_when_single;
|
config.no_border_when_single = no_border_when_single;
|
||||||
|
config.no_radius_when_single = no_radius_when_single;
|
||||||
config.snap_distance = snap_distance;
|
config.snap_distance = snap_distance;
|
||||||
config.drag_tile_to_tile = drag_tile_to_tile;
|
config.drag_tile_to_tile = drag_tile_to_tile;
|
||||||
config.enable_floating_snap = enable_floating_snap;
|
config.enable_floating_snap = enable_floating_snap;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ int scroller_prefer_center = 0;
|
|||||||
int focus_cross_monitor = 0;
|
int focus_cross_monitor = 0;
|
||||||
int focus_cross_tag = 0;
|
int focus_cross_tag = 0;
|
||||||
int no_border_when_single = 0;
|
int no_border_when_single = 0;
|
||||||
|
int no_radius_when_single = 0;
|
||||||
int snap_distance = 30;
|
int snap_distance = 30;
|
||||||
int enable_floating_snap = 0;
|
int enable_floating_snap = 0;
|
||||||
int drag_tile_to_tile = 0;
|
int drag_tile_to_tile = 0;
|
||||||
|
|||||||
14
src/maomao.c
14
src/maomao.c
@@ -1096,10 +1096,14 @@ void client_draw_shadow(Client *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void apply_border(Client *c) {
|
void apply_border(Client *c) {
|
||||||
if (c->iskilling || !client_surface(c)->mapped)
|
if (!c || c->iskilling || !client_surface(c)->mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool hit_no_border = check_hit_no_border(c);
|
bool hit_no_border = check_hit_no_border(c);
|
||||||
|
enum corner_location current_corner_location =
|
||||||
|
c->mon->visible_clients == 1 && no_radius_when_single
|
||||||
|
? CORNER_LOCATION_NONE
|
||||||
|
: CORNER_LOCATION_ALL;
|
||||||
|
|
||||||
// Handle no-border cases
|
// Handle no-border cases
|
||||||
if (hit_no_border && smartgaps) {
|
if (hit_no_border && smartgaps) {
|
||||||
@@ -1163,14 +1167,14 @@ void apply_border(Client *c) {
|
|||||||
.area = {inner_surface_x, inner_surface_y, inner_surface_width,
|
.area = {inner_surface_x, inner_surface_y, inner_surface_width,
|
||||||
inner_surface_height},
|
inner_surface_height},
|
||||||
.corner_radius = border_radius,
|
.corner_radius = border_radius,
|
||||||
.corners = CORNER_LOCATION_ALL,
|
.corners = current_corner_location,
|
||||||
};
|
};
|
||||||
|
|
||||||
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
||||||
wlr_scene_rect_set_size(c->border, rect_width, rect_height);
|
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_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, border_radius,
|
||||||
CORNER_LOCATION_ALL);
|
current_corner_location);
|
||||||
wlr_scene_rect_set_clipped_region(c->border, clipped_region);
|
wlr_scene_rect_set_clipped_region(c->border, clipped_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5122,6 +5126,10 @@ void buffer_set_effect(Client *c, animationScale data) {
|
|||||||
if (c == grabc)
|
if (c == grabc)
|
||||||
data.should_scale = false;
|
data.should_scale = false;
|
||||||
|
|
||||||
|
if (c->mon->visible_clients == 1 && no_radius_when_single) {
|
||||||
|
data.corner_location = CORNER_LOCATION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||||
scene_buffer_apply_effect, &data);
|
scene_buffer_apply_effect, &data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user