mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-05 13:29:54 -05:00
format code
This commit is contained in:
parent
cc8808d492
commit
54974d498b
3 changed files with 171 additions and 126 deletions
|
|
@ -367,23 +367,37 @@ xkb_keysym_t normalize_keysym(xkb_keysym_t sym) {
|
||||||
return XKB_KEY_9;
|
return XKB_KEY_9;
|
||||||
|
|
||||||
// 将 Shift+数字 的符号转换回基础数字
|
// 将 Shift+数字 的符号转换回基础数字
|
||||||
case XKB_KEY_exclam: return XKB_KEY_1; // !
|
case XKB_KEY_exclam:
|
||||||
case XKB_KEY_at: return XKB_KEY_2; // @
|
return XKB_KEY_1; // !
|
||||||
case XKB_KEY_numbersign:return XKB_KEY_3; // #
|
case XKB_KEY_at:
|
||||||
case XKB_KEY_dollar: return XKB_KEY_4; // $
|
return XKB_KEY_2; // @
|
||||||
case XKB_KEY_percent: return XKB_KEY_5; // %
|
case XKB_KEY_numbersign:
|
||||||
case XKB_KEY_asciicircum: return XKB_KEY_6; // ^
|
return XKB_KEY_3; // #
|
||||||
case XKB_KEY_ampersand: return XKB_KEY_7; // &
|
case XKB_KEY_dollar:
|
||||||
case XKB_KEY_asterisk: return XKB_KEY_8; // *
|
return XKB_KEY_4; // $
|
||||||
case XKB_KEY_parenleft: return XKB_KEY_9; // (
|
case XKB_KEY_percent:
|
||||||
case XKB_KEY_parenright:return XKB_KEY_0; // )
|
return XKB_KEY_5; // %
|
||||||
|
case XKB_KEY_asciicircum:
|
||||||
|
return XKB_KEY_6; // ^
|
||||||
|
case XKB_KEY_ampersand:
|
||||||
|
return XKB_KEY_7; // &
|
||||||
|
case XKB_KEY_asterisk:
|
||||||
|
return XKB_KEY_8; // *
|
||||||
|
case XKB_KEY_parenleft:
|
||||||
|
return XKB_KEY_9; // (
|
||||||
|
case XKB_KEY_parenright:
|
||||||
|
return XKB_KEY_0; // )
|
||||||
|
|
||||||
// 其他布局可能需要的变体(如欧洲键盘)
|
// 其他布局可能需要的变体(如欧洲键盘)
|
||||||
case XKB_KEY_quotedbl: return XKB_KEY_2; // "
|
case XKB_KEY_quotedbl:
|
||||||
case XKB_KEY_section: return XKB_KEY_6; // §
|
return XKB_KEY_2; // "
|
||||||
case XKB_KEY_degree: return XKB_KEY_0; // °
|
case XKB_KEY_section:
|
||||||
|
return XKB_KEY_6; // §
|
||||||
|
case XKB_KEY_degree:
|
||||||
|
return XKB_KEY_0; // °
|
||||||
|
|
||||||
default: return sym;
|
default:
|
||||||
|
return sym;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -510,7 +524,8 @@ unsigned int parse_num_type(char *str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
||||||
char *arg_value2, char *arg_value3, char *arg_value4, char *arg_value5) {
|
char *arg_value2, char *arg_value3, char *arg_value4,
|
||||||
|
char *arg_value5) {
|
||||||
|
|
||||||
FuncType func = NULL;
|
FuncType func = NULL;
|
||||||
(*arg).v = NULL;
|
(*arg).v = NULL;
|
||||||
|
|
@ -1284,10 +1299,11 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
|
|
||||||
char mod_str[256], keysym_str[256], func_name[256],
|
char mod_str[256], keysym_str[256], func_name[256],
|
||||||
arg_value[256] = "none", arg_value2[256] = "none",
|
arg_value[256] = "none", arg_value2[256] = "none",
|
||||||
arg_value3[256] = "none", arg_value4[256] = "none", arg_value5[256] = "none";
|
arg_value3[256] = "none", arg_value4[256] = "none",
|
||||||
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", mod_str,
|
arg_value5[256] = "none";
|
||||||
keysym_str, func_name, arg_value, arg_value2, arg_value3,
|
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
|
||||||
arg_value4, arg_value5) < 3) {
|
mod_str, keysym_str, func_name, arg_value, arg_value2,
|
||||||
|
arg_value3, arg_value4, arg_value5) < 3) {
|
||||||
fprintf(stderr, "Error: Invalid bind format: %s\n", value);
|
fprintf(stderr, "Error: Invalid bind format: %s\n", value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1305,8 +1321,9 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
binding->arg.v = NULL;
|
binding->arg.v = NULL;
|
||||||
binding->arg.v2 = NULL;
|
binding->arg.v2 = NULL;
|
||||||
binding->arg.v3 = NULL;
|
binding->arg.v3 = NULL;
|
||||||
binding->func = parse_func_name(func_name, &binding->arg, arg_value,
|
binding->func =
|
||||||
arg_value2, arg_value3, arg_value4, arg_value5);
|
parse_func_name(func_name, &binding->arg, arg_value, arg_value2,
|
||||||
|
arg_value3, arg_value4, arg_value5);
|
||||||
if (!binding->func) {
|
if (!binding->func) {
|
||||||
if (binding->arg.v) {
|
if (binding->arg.v) {
|
||||||
free(binding->arg.v);
|
free(binding->arg.v);
|
||||||
|
|
@ -1340,9 +1357,11 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
|
|
||||||
char mod_str[256], button_str[256], func_name[256],
|
char mod_str[256], button_str[256], func_name[256],
|
||||||
arg_value[256] = "none", arg_value2[256] = "none",
|
arg_value[256] = "none", arg_value2[256] = "none",
|
||||||
arg_value3[256] = "none", arg_value4[256] = "none", arg_value5[256] = "none";
|
arg_value3[256] = "none", arg_value4[256] = "none",
|
||||||
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", mod_str,
|
arg_value5[256] = "none";
|
||||||
button_str, func_name, arg_value, arg_value2, arg_value3, arg_value4, arg_value5) < 3) {
|
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
|
||||||
|
mod_str, button_str, func_name, arg_value, arg_value2,
|
||||||
|
arg_value3, arg_value4, arg_value5) < 3) {
|
||||||
fprintf(stderr, "Error: Invalid mousebind format: %s\n", value);
|
fprintf(stderr, "Error: Invalid mousebind format: %s\n", value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1360,8 +1379,9 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
binding->arg.v = NULL;
|
binding->arg.v = NULL;
|
||||||
binding->arg.v2 = NULL;
|
binding->arg.v2 = NULL;
|
||||||
binding->arg.v3 = NULL;
|
binding->arg.v3 = NULL;
|
||||||
binding->func = parse_func_name(func_name, &binding->arg, arg_value,
|
binding->func =
|
||||||
arg_value2, arg_value3, arg_value4, arg_value5);
|
parse_func_name(func_name, &binding->arg, arg_value, arg_value2,
|
||||||
|
arg_value3, arg_value4, arg_value5);
|
||||||
if (!binding->func) {
|
if (!binding->func) {
|
||||||
if (binding->arg.v) {
|
if (binding->arg.v) {
|
||||||
free(binding->arg.v);
|
free(binding->arg.v);
|
||||||
|
|
@ -1393,9 +1413,11 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
|
|
||||||
char mod_str[256], dir_str[256], func_name[256],
|
char mod_str[256], dir_str[256], func_name[256],
|
||||||
arg_value[256] = "none", arg_value2[256] = "none",
|
arg_value[256] = "none", arg_value2[256] = "none",
|
||||||
arg_value3[256] = "none", arg_value4[256] = "none", arg_value5[256] = "none";
|
arg_value3[256] = "none", arg_value4[256] = "none",
|
||||||
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]", mod_str,
|
arg_value5[256] = "none";
|
||||||
dir_str, func_name, arg_value, arg_value2, arg_value3, arg_value4, arg_value5) < 3) {
|
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
|
||||||
|
mod_str, dir_str, func_name, arg_value, arg_value2, arg_value3,
|
||||||
|
arg_value4, arg_value5) < 3) {
|
||||||
fprintf(stderr, "Error: Invalid axisbind format: %s\n", value);
|
fprintf(stderr, "Error: Invalid axisbind format: %s\n", value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1414,8 +1436,9 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
binding->arg.v = NULL;
|
binding->arg.v = NULL;
|
||||||
binding->arg.v2 = NULL;
|
binding->arg.v2 = NULL;
|
||||||
binding->arg.v3 = NULL;
|
binding->arg.v3 = NULL;
|
||||||
binding->func = parse_func_name(func_name, &binding->arg, arg_value,
|
binding->func =
|
||||||
arg_value2, arg_value3, arg_value4, arg_value5);
|
parse_func_name(func_name, &binding->arg, arg_value, arg_value2,
|
||||||
|
arg_value3, arg_value4, arg_value5);
|
||||||
|
|
||||||
if (!binding->func) {
|
if (!binding->func) {
|
||||||
if (binding->arg.v) {
|
if (binding->arg.v) {
|
||||||
|
|
@ -1451,7 +1474,8 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
|
|
||||||
char mod_str[256], motion_str[256], fingers_count_str[256], func_name[256],
|
char mod_str[256], motion_str[256], fingers_count_str[256], func_name[256],
|
||||||
arg_value[256] = "none", arg_value2[256] = "none",
|
arg_value[256] = "none", arg_value2[256] = "none",
|
||||||
arg_value3[256] = "none", arg_value4[256] = "none", arg_value5[256] = "none";
|
arg_value3[256] = "none", arg_value4[256] = "none",
|
||||||
|
arg_value5[256] = "none";
|
||||||
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
|
if (sscanf(value, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]",
|
||||||
mod_str, motion_str, fingers_count_str, func_name, arg_value,
|
mod_str, motion_str, fingers_count_str, func_name, arg_value,
|
||||||
arg_value2, arg_value3, arg_value4, arg_value5) < 4) {
|
arg_value2, arg_value3, arg_value4, arg_value5) < 4) {
|
||||||
|
|
@ -1475,8 +1499,9 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
binding->arg.v = NULL;
|
binding->arg.v = NULL;
|
||||||
binding->arg.v2 = NULL;
|
binding->arg.v2 = NULL;
|
||||||
binding->arg.v3 = NULL;
|
binding->arg.v3 = NULL;
|
||||||
binding->func = parse_func_name(func_name, &binding->arg, arg_value,
|
binding->func =
|
||||||
arg_value2, arg_value3, arg_value4, arg_value5);
|
parse_func_name(func_name, &binding->arg, arg_value, arg_value2,
|
||||||
|
arg_value3, arg_value4, arg_value5);
|
||||||
|
|
||||||
if (!binding->func) {
|
if (!binding->func) {
|
||||||
if (binding->arg.v) {
|
if (binding->arg.v) {
|
||||||
|
|
|
||||||
|
|
@ -137,8 +137,9 @@ void grid(Monitor *m) {
|
||||||
|
|
||||||
// 第一次遍历,计算 n 的值
|
// 第一次遍历,计算 n 的值
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) && !client_should_ignore_focus(c) && !c->iskilling && !c->animation.tagouting &&
|
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) &&
|
||||||
c->mon == selmon) {
|
!client_should_ignore_focus(c) && !c->iskilling &&
|
||||||
|
!c->animation.tagouting && c->mon == selmon) {
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,8 +153,9 @@ void grid(Monitor *m) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) && !client_should_ignore_focus(c) && !c->iskilling && !c->animation.tagouting &&
|
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) &&
|
||||||
c->mon == selmon) {
|
!client_should_ignore_focus(c) && !c->iskilling &&
|
||||||
|
!c->animation.tagouting && c->mon == selmon) {
|
||||||
cw = (m->w.width - 2 * overviewgappo) * 0.7;
|
cw = (m->w.width - 2 * overviewgappo) * 0.7;
|
||||||
ch = (m->w.height - 2 * overviewgappo) * 0.8;
|
ch = (m->w.height - 2 * overviewgappo) * 0.8;
|
||||||
c->geom.x = m->w.x + (m->w.width - cw) / 2;
|
c->geom.x = m->w.x + (m->w.width - cw) / 2;
|
||||||
|
|
@ -174,8 +176,9 @@ void grid(Monitor *m) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) && !client_should_ignore_focus(c) && !c->iskilling && !c->animation.tagouting &&
|
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) &&
|
||||||
c->mon == selmon) {
|
!client_should_ignore_focus(c) && !c->iskilling &&
|
||||||
|
!c->animation.tagouting && c->mon == selmon) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
c->geom.x = m->w.x + overviewgappo;
|
c->geom.x = m->w.x + overviewgappo;
|
||||||
c->geom.y = m->w.y + (m->w.height - ch) / 2 + overviewgappo;
|
c->geom.y = m->w.y + (m->w.height - ch) / 2 + overviewgappo;
|
||||||
|
|
@ -220,8 +223,9 @@ void grid(Monitor *m) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) && !client_should_ignore_focus(c) && !c->iskilling && !c->animation.tagouting &&
|
if (VISIBLEON(c, c->mon) && (m->isoverview || ISTILED(c)) &&
|
||||||
c->mon == selmon) {
|
!client_should_ignore_focus(c) && !c->iskilling &&
|
||||||
|
!c->animation.tagouting && c->mon == selmon) {
|
||||||
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
||||||
cy = m->w.y + (i / cols) * (ch + overviewgappi);
|
cy = m->w.y + (i / cols) * (ch + overviewgappi);
|
||||||
if (overcols && i >= n - overcols) {
|
if (overcols && i >= n - overcols) {
|
||||||
|
|
|
||||||
74
src/maomao.c
74
src/maomao.c
|
|
@ -615,7 +615,8 @@ static void handle_foreign_close_request(struct wl_listener *listener,
|
||||||
void *data);
|
void *data);
|
||||||
static void handle_foreign_destroy(struct wl_listener *listener, void *data);
|
static void handle_foreign_destroy(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
static struct wlr_box setclient_coordinate_center(Client *c, struct wlr_box geom,
|
static struct wlr_box setclient_coordinate_center(Client *c,
|
||||||
|
struct wlr_box geom,
|
||||||
int offsetx, int offsety);
|
int offsetx, int offsety);
|
||||||
static unsigned int get_tags_first_tag(unsigned int tags);
|
static unsigned int get_tags_first_tag(unsigned int tags);
|
||||||
|
|
||||||
|
|
@ -1288,8 +1289,10 @@ void client_apply_clip(Client *c) {
|
||||||
scale_data.should_scale = true;
|
scale_data.should_scale = true;
|
||||||
scale_data.width = clip_box.width - 2 * c->bw;
|
scale_data.width = clip_box.width - 2 * c->bw;
|
||||||
scale_data.height = clip_box.height - 2 * c->bw;
|
scale_data.height = clip_box.height - 2 * c->bw;
|
||||||
scale_data.width_scale = (float)scale_data.width / (geometry.width - offset.x);
|
scale_data.width_scale =
|
||||||
scale_data.height_scale = (float)scale_data.height / (geometry.height - offset.y);
|
(float)scale_data.width / (geometry.width - offset.x);
|
||||||
|
scale_data.height_scale =
|
||||||
|
(float)scale_data.height / (geometry.height - offset.y);
|
||||||
buffer_set_effect(c, scale_data);
|
buffer_set_effect(c, scale_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1413,8 +1416,8 @@ void show_scratchpad(Client *c) {
|
||||||
/* return if fullscreen */
|
/* return if fullscreen */
|
||||||
if (!c->isfloating) {
|
if (!c->isfloating) {
|
||||||
setfloating(c, 1);
|
setfloating(c, 1);
|
||||||
c->geom.width =
|
c->geom.width = c->scratchpad_geom.width ? c->scratchpad_geom.width
|
||||||
c->scratchpad_geom.width ? c->scratchpad_geom.width : c->mon->w.width * 0.7;
|
: c->mon->w.width * 0.7;
|
||||||
c->geom.height = c->scratchpad_geom.height ? c->scratchpad_geom.height
|
c->geom.height = c->scratchpad_geom.height ? c->scratchpad_geom.height
|
||||||
: c->mon->w.height * 0.8;
|
: c->mon->w.height * 0.8;
|
||||||
// 重新计算居中的坐标
|
// 重新计算居中的坐标
|
||||||
|
|
@ -1423,8 +1426,8 @@ void show_scratchpad(Client *c) {
|
||||||
resize(c, c->geom, 0);
|
resize(c, c->geom, 0);
|
||||||
} else if (c->geom.width != c->scratchpad_geom.width ||
|
} else if (c->geom.width != c->scratchpad_geom.width ||
|
||||||
c->geom.height != c->scratchpad_geom.height) {
|
c->geom.height != c->scratchpad_geom.height) {
|
||||||
c->geom.width =
|
c->geom.width = c->scratchpad_geom.width ? c->scratchpad_geom.width
|
||||||
c->scratchpad_geom.width ? c->scratchpad_geom.width : c->mon->w.width * 0.7;
|
: c->mon->w.width * 0.7;
|
||||||
c->geom.height = c->scratchpad_geom.height ? c->scratchpad_geom.height
|
c->geom.height = c->scratchpad_geom.height ? c->scratchpad_geom.height
|
||||||
: c->mon->w.height * 0.8;
|
: c->mon->w.height * 0.8;
|
||||||
c->geom = c->animainit_geom = c->animation.current =
|
c->geom = c->animainit_geom = c->animation.current =
|
||||||
|
|
@ -1612,7 +1615,8 @@ void apply_named_scratchpad(Client *target_client) {
|
||||||
if (c->mon != selmon) {
|
if (c->mon != selmon) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (single_scratchpad && c->is_in_scratchpad && c->is_scratchpad_show && c != target_client) {
|
if (single_scratchpad && c->is_in_scratchpad && c->is_scratchpad_show &&
|
||||||
|
c != target_client) {
|
||||||
set_minized(c);
|
set_minized(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1665,8 +1669,6 @@ void toggle_scratchpad(const Arg *arg) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hit = switch_scratchpad_client_state(c);
|
hit = switch_scratchpad_client_state(c);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1732,7 +1734,8 @@ void toggle_hotarea(int x_root, int y_root) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box // 计算客户端居中坐标
|
struct wlr_box // 计算客户端居中坐标
|
||||||
setclient_coordinate_center(Client *c, struct wlr_box geom, int offsetx, int offsety) {
|
setclient_coordinate_center(Client *c, struct wlr_box geom, int offsetx,
|
||||||
|
int offsety) {
|
||||||
struct wlr_box tempbox;
|
struct wlr_box tempbox;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
@ -1800,7 +1803,8 @@ applyrulesgeom(Client *c) {
|
||||||
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
||||||
// 重新计算居中的坐标
|
// 重新计算居中的坐标
|
||||||
if (r->offsetx || r->offsety || r->width || r->height)
|
if (r->offsetx || r->offsety || r->width || r->height)
|
||||||
c->geom = setclient_coordinate_center(c, c->geom, r->offsetx, r->offsety);
|
c->geom =
|
||||||
|
setclient_coordinate_center(c, c->geom, r->offsetx, r->offsety);
|
||||||
hit = r->height > 0 || r->width > 0 || r->offsetx != 0 || r->offsety != 0
|
hit = r->height > 0 || r->width > 0 || r->offsetx != 0 || r->offsety != 0
|
||||||
? 1
|
? 1
|
||||||
: 0;
|
: 0;
|
||||||
|
|
@ -1838,10 +1842,12 @@ applyrules(Client *c) {
|
||||||
regex_match(r->title, title))) {
|
regex_match(r->title, title))) {
|
||||||
c->isterm = r->isterm > 0 ? r->isterm : c->isterm;
|
c->isterm = r->isterm > 0 ? r->isterm : c->isterm;
|
||||||
c->noswallow = r->noswallow > 0 ? r->noswallow : c->noswallow;
|
c->noswallow = r->noswallow > 0 ? r->noswallow : c->noswallow;
|
||||||
c->scratchpad_geom.width =
|
c->scratchpad_geom.width = r->scratchpad_width > 0
|
||||||
r->scratchpad_width > 0 ? r->scratchpad_width : c->scratchpad_geom.width;
|
? r->scratchpad_width
|
||||||
c->scratchpad_geom.height =
|
: c->scratchpad_geom.width;
|
||||||
r->scratchpad_height > 0 ? r->scratchpad_height : c->scratchpad_geom.height;
|
c->scratchpad_geom.height = r->scratchpad_height > 0
|
||||||
|
? r->scratchpad_height
|
||||||
|
: c->scratchpad_geom.height;
|
||||||
c->isfloating = r->isfloating > 0 ? r->isfloating : c->isfloating;
|
c->isfloating = r->isfloating > 0 ? r->isfloating : c->isfloating;
|
||||||
c->isfullscreen = r->isfullscreen > 0 ? r->isfullscreen : c->isfullscreen;
|
c->isfullscreen = r->isfullscreen > 0 ? r->isfullscreen : c->isfullscreen;
|
||||||
c->animation_type_open = r->animation_type_open == NULL
|
c->animation_type_open = r->animation_type_open == NULL
|
||||||
|
|
@ -1855,10 +1861,14 @@ applyrules(Client *c) {
|
||||||
: c->scroller_proportion;
|
: c->scroller_proportion;
|
||||||
c->isnoborder = r->isnoborder > 0 ? r->isnoborder : c->isnoborder;
|
c->isnoborder = r->isnoborder > 0 ? r->isnoborder : c->isnoborder;
|
||||||
c->isopensilent = r->isopensilent > 0 ? r->isopensilent : c->isopensilent;
|
c->isopensilent = r->isopensilent > 0 ? r->isopensilent : c->isopensilent;
|
||||||
c->isopenscratchpad = r->isopenscratchpad > 0 ? r->isopenscratchpad : c->isopenscratchpad;
|
c->isopenscratchpad =
|
||||||
|
r->isopenscratchpad > 0 ? r->isopenscratchpad : c->isopenscratchpad;
|
||||||
c->isglobal = r->isglobal > 0 ? r->isglobal : c->isglobal;
|
c->isglobal = r->isglobal > 0 ? r->isglobal : c->isglobal;
|
||||||
c->isoverlay = r->isoverlay > 0 ? r->isoverlay : c->isoverlay;
|
c->isoverlay = r->isoverlay > 0 ? r->isoverlay : c->isoverlay;
|
||||||
c->isglobal = r->isunglobal > 0 && (client_is_unmanaged(c) || client_should_ignore_focus(c)) ? r->isunglobal : c->isglobal;
|
c->isglobal = r->isunglobal > 0 && (client_is_unmanaged(c) ||
|
||||||
|
client_should_ignore_focus(c))
|
||||||
|
? r->isunglobal
|
||||||
|
: c->isglobal;
|
||||||
newtags = r->tags > 0 ? r->tags | newtags : newtags;
|
newtags = r->tags > 0 ? r->tags | newtags : newtags;
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(m, &mons, link) if (r->monitor == i++) mon = m;
|
wl_list_for_each(m, &mons, link) if (r->monitor == i++) mon = m;
|
||||||
|
|
@ -1884,8 +1894,7 @@ applyrules(Client *c) {
|
||||||
|
|
||||||
// if no geom rule hit, use the center pos and record the hit size
|
// if no geom rule hit, use the center pos and record the hit size
|
||||||
if (!hit_rule_pos && (!client_is_x11(c) || !client_should_ignore_focus(c))) {
|
if (!hit_rule_pos && (!client_is_x11(c) || !client_should_ignore_focus(c))) {
|
||||||
c->oldgeom = c->geom =
|
c->oldgeom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||||
setclient_coordinate_center(c, c->geom, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!client_surface(c)->mapped)
|
if (!client_surface(c)->mapped)
|
||||||
|
|
@ -1919,7 +1928,8 @@ applyrules(Client *c) {
|
||||||
int fullscreen_state_backup = c->isfullscreen;
|
int fullscreen_state_backup = c->isfullscreen;
|
||||||
setmon(c, mon, newtags, !c->isopensilent);
|
setmon(c, mon, newtags, !c->isopensilent);
|
||||||
|
|
||||||
if (!c->isopensilent && selmon && !(c->tags & (1 << (selmon->pertag->curtag - 1)))) {
|
if (!c->isopensilent && selmon &&
|
||||||
|
!(c->tags & (1 << (selmon->pertag->curtag - 1)))) {
|
||||||
c->animation.from_rule = true;
|
c->animation.from_rule = true;
|
||||||
view(&(Arg){.ui = c->tags}, true);
|
view(&(Arg){.ui = c->tags}, true);
|
||||||
}
|
}
|
||||||
|
|
@ -3819,7 +3829,8 @@ void dwl_ipc_output_quit(struct wl_client *client,
|
||||||
void dwl_ipc_output_dispatch(struct wl_client *client,
|
void dwl_ipc_output_dispatch(struct wl_client *client,
|
||||||
struct wl_resource *resource, const char *dispatch,
|
struct wl_resource *resource, const char *dispatch,
|
||||||
const char *arg1, const char *arg2,
|
const char *arg1, const char *arg2,
|
||||||
const char *arg3, const char *arg4, const char *arg5) {
|
const char *arg3, const char *arg4,
|
||||||
|
const char *arg5) {
|
||||||
|
|
||||||
void (*func)(const Arg *);
|
void (*func)(const Arg *);
|
||||||
Arg arg;
|
Arg arg;
|
||||||
|
|
@ -4484,7 +4495,8 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||||
"scroller") != 0)
|
"scroller") != 0)
|
||||||
// tile at the top
|
// tile at the top
|
||||||
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
|
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
|
||||||
else if (selmon && strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
|
else if (selmon &&
|
||||||
|
strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
|
||||||
"scroller") == 0 &&
|
"scroller") == 0 &&
|
||||||
center_select(selmon)) {
|
center_select(selmon)) {
|
||||||
Client *at_client = center_select(selmon);
|
Client *at_client = center_select(selmon);
|
||||||
|
|
@ -5727,8 +5739,8 @@ void setmon(Client *c, Monitor *m, uint32_t newtags, bool focus) {
|
||||||
if (!c->foreign_toplevel && c->mon) {
|
if (!c->foreign_toplevel && c->mon) {
|
||||||
add_foreign_toplevel(c);
|
add_foreign_toplevel(c);
|
||||||
if (selmon->sel && selmon->sel->foreign_toplevel)
|
if (selmon->sel && selmon->sel->foreign_toplevel)
|
||||||
wlr_foreign_toplevel_handle_v1_set_activated(selmon->sel->foreign_toplevel,
|
wlr_foreign_toplevel_handle_v1_set_activated(
|
||||||
false);
|
selmon->sel->foreign_toplevel, false);
|
||||||
if (c->foreign_toplevel)
|
if (c->foreign_toplevel)
|
||||||
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true);
|
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true);
|
||||||
}
|
}
|
||||||
|
|
@ -6197,7 +6209,8 @@ void spawn(const Arg *arg) {
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
|
|
||||||
// 4. execvp 失败时:打印错误并直接退出(避免 coredump)
|
// 4. execvp 失败时:打印错误并直接退出(避免 coredump)
|
||||||
wlr_log(WLR_ERROR, "dwl: execvp '%s' failed: %s\n", argv[0], strerror(errno));
|
wlr_log(WLR_ERROR, "dwl: execvp '%s' failed: %s\n", argv[0],
|
||||||
|
strerror(errno));
|
||||||
_exit(EXIT_FAILURE); // 使用 _exit 避免缓冲区刷新等操作
|
_exit(EXIT_FAILURE); // 使用 _exit 避免缓冲区刷新等操作
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6472,8 +6485,10 @@ void toggleoverview(const Arg *arg) {
|
||||||
unsigned int visible_client_number = 0;
|
unsigned int visible_client_number = 0;
|
||||||
|
|
||||||
if (selmon->isoverview) {
|
if (selmon->isoverview) {
|
||||||
wl_list_for_each(c, &clients,
|
wl_list_for_each(c, &clients, link) if (c && c->mon == selmon &&
|
||||||
link) if (c && c->mon == selmon && !client_is_unmanaged(c) && !client_should_ignore_focus(c) && !c->isminied) {
|
!client_is_unmanaged(c) &&
|
||||||
|
!client_should_ignore_focus(c) &&
|
||||||
|
!c->isminied) {
|
||||||
visible_client_number++;
|
visible_client_number++;
|
||||||
}
|
}
|
||||||
if (visible_client_number > 0) {
|
if (visible_client_number > 0) {
|
||||||
|
|
@ -6499,7 +6514,8 @@ void toggleoverview(const Arg *arg) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c && !c->iskilling && !client_is_unmanaged(c) && !client_should_ignore_focus(c) && client_surface(c)->mapped)
|
if (c && !c->iskilling && !client_is_unmanaged(c) &&
|
||||||
|
!client_should_ignore_focus(c) && client_surface(c)->mapped)
|
||||||
overview_restore(c, &(Arg){.ui = target});
|
overview_restore(c, &(Arg){.ui = target});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue