Compare commits
10 Commits
7ed12cf921
...
8ab59c1aca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ab59c1aca | ||
|
|
b3578344dc | ||
|
|
389f417a3b | ||
|
|
d2e0df024d | ||
|
|
bd6a71f05e | ||
|
|
cfb66111de | ||
|
|
94e47bc3b0 | ||
|
|
43424152f3 | ||
|
|
0ff4d94365 | ||
|
|
ade00f88f0 |
@@ -1084,7 +1084,7 @@ void client_set_focused_opacity_animation(Client *c) {
|
|||||||
c->opacity_animation.running = true;
|
c->opacity_animation.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleint_set_unfocused_opacity_animation(Client *c) {
|
void client_set_unfocused_opacity_animation(Client *c) {
|
||||||
// Start border color animation to unfocused
|
// Start border color animation to unfocused
|
||||||
float *border_color = get_border_color(c);
|
float *border_color = get_border_color(c);
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ typedef struct {
|
|||||||
int noblur;
|
int noblur;
|
||||||
float focused_opacity;
|
float focused_opacity;
|
||||||
float unfocused_opacity;
|
float unfocused_opacity;
|
||||||
|
float scroller_proportion_single;
|
||||||
uint32_t passmod;
|
uint32_t passmod;
|
||||||
xkb_keysym_t keysym;
|
xkb_keysym_t keysym;
|
||||||
KeyBinding globalkeybinding;
|
KeyBinding globalkeybinding;
|
||||||
@@ -517,61 +518,6 @@ long int parse_color(const char *hex_str) {
|
|||||||
return hex_num;
|
return hex_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
xkb_keysym_t normalize_keysym(xkb_keysym_t sym) {
|
|
||||||
// 首先转换为小写(主要影响字母键)
|
|
||||||
sym = xkb_keysym_to_lower(sym);
|
|
||||||
|
|
||||||
// 将数字小键盘键转换为普通数字键
|
|
||||||
switch (sym) {
|
|
||||||
// 小键盘数字转换
|
|
||||||
case XKB_KEY_KP_0:
|
|
||||||
return XKB_KEY_0;
|
|
||||||
case XKB_KEY_KP_1:
|
|
||||||
return XKB_KEY_1;
|
|
||||||
case XKB_KEY_KP_2:
|
|
||||||
return XKB_KEY_2;
|
|
||||||
case XKB_KEY_KP_3:
|
|
||||||
return XKB_KEY_3;
|
|
||||||
case XKB_KEY_KP_4:
|
|
||||||
return XKB_KEY_4;
|
|
||||||
case XKB_KEY_KP_5:
|
|
||||||
return XKB_KEY_5;
|
|
||||||
case XKB_KEY_KP_6:
|
|
||||||
return XKB_KEY_6;
|
|
||||||
case XKB_KEY_KP_7:
|
|
||||||
return XKB_KEY_7;
|
|
||||||
case XKB_KEY_KP_8:
|
|
||||||
return XKB_KEY_8;
|
|
||||||
case XKB_KEY_KP_9:
|
|
||||||
return XKB_KEY_9;
|
|
||||||
|
|
||||||
// 将 Shift+数字 的符号转换回基础数字
|
|
||||||
case XKB_KEY_exclam:
|
|
||||||
return XKB_KEY_1; // !
|
|
||||||
case XKB_KEY_at:
|
|
||||||
return XKB_KEY_2; // @
|
|
||||||
case XKB_KEY_numbersign:
|
|
||||||
return XKB_KEY_3; // #
|
|
||||||
case XKB_KEY_dollar:
|
|
||||||
return XKB_KEY_4; // $
|
|
||||||
case XKB_KEY_percent:
|
|
||||||
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; // )
|
|
||||||
|
|
||||||
default:
|
|
||||||
return sym;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 辅助函数:检查字符串是否以指定的前缀开头(忽略大小写)
|
// 辅助函数:检查字符串是否以指定的前缀开头(忽略大小写)
|
||||||
static bool starts_with_ignore_case(const char *str, const char *prefix) {
|
static bool starts_with_ignore_case(const char *str, const char *prefix) {
|
||||||
while (*prefix) {
|
while (*prefix) {
|
||||||
@@ -1734,6 +1680,7 @@ void parse_option(Config *config, char *key, char *value) {
|
|||||||
// float rule value, relay to a client property
|
// float rule value, relay to a client property
|
||||||
rule->focused_opacity = 0;
|
rule->focused_opacity = 0;
|
||||||
rule->unfocused_opacity = 0;
|
rule->unfocused_opacity = 0;
|
||||||
|
rule->scroller_proportion_single = 0.0f;
|
||||||
rule->scroller_proportion = 0;
|
rule->scroller_proportion = 0;
|
||||||
|
|
||||||
// special rule value,not directly set to client property
|
// special rule value,not directly set to client property
|
||||||
@@ -1805,6 +1752,8 @@ void parse_option(Config *config, char *key, char *value) {
|
|||||||
rule->isunglobal = atoi(val);
|
rule->isunglobal = atoi(val);
|
||||||
} else if (strcmp(key, "isglobal") == 0) {
|
} else if (strcmp(key, "isglobal") == 0) {
|
||||||
rule->isglobal = atoi(val);
|
rule->isglobal = atoi(val);
|
||||||
|
} else if (strcmp(key, "scroller_proportion_single") == 0) {
|
||||||
|
rule->scroller_proportion_single = atof(val);
|
||||||
} else if (strcmp(key, "unfocused_opacity") == 0) {
|
} else if (strcmp(key, "unfocused_opacity") == 0) {
|
||||||
rule->unfocused_opacity = atof(val);
|
rule->unfocused_opacity = atof(val);
|
||||||
} else if (strcmp(key, "focused_opacity") == 0) {
|
} else if (strcmp(key, "focused_opacity") == 0) {
|
||||||
@@ -3220,33 +3169,37 @@ void reapply_master(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parse_tagrule(Monitor *m) {
|
||||||
|
int i, jk;
|
||||||
|
ConfigTagRule tr;
|
||||||
|
|
||||||
|
for (i = 0; i < config.tag_rules_count; i++) {
|
||||||
|
|
||||||
|
tr = config.tag_rules[i];
|
||||||
|
|
||||||
|
if (config.tag_rules_count > 0 &&
|
||||||
|
(!tr.monitor_name ||
|
||||||
|
regex_match(tr.monitor_name, m->wlr_output->name))) {
|
||||||
|
|
||||||
|
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
||||||
|
if (tr.layout_name &&
|
||||||
|
strcmp(layouts[jk].name, tr.layout_name) == 0) {
|
||||||
|
m->pertag->ltidxs[tr.id] = &layouts[jk];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m->pertag->no_hide[tr.id] = tr.no_hide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void reapply_tagrule(void) {
|
void reapply_tagrule(void) {
|
||||||
Monitor *m = NULL;
|
Monitor *m = NULL;
|
||||||
int i, jk;
|
|
||||||
char *rule_monitor_name = NULL;
|
|
||||||
wl_list_for_each(m, &mons, link) {
|
wl_list_for_each(m, &mons, link) {
|
||||||
if (!m->wlr_output->enabled) {
|
if (!m->wlr_output->enabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
parse_tagrule(m);
|
||||||
// apply tag rule
|
|
||||||
for (i = 1; i <= config.tag_rules_count; i++) {
|
|
||||||
rule_monitor_name = config.tag_rules[i - 1].monitor_name;
|
|
||||||
if (regex_match(rule_monitor_name, m->wlr_output->name) ||
|
|
||||||
!rule_monitor_name) {
|
|
||||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
|
||||||
if (config.tag_rules_count > 0 &&
|
|
||||||
config.tag_rules[i - 1].layout_name &&
|
|
||||||
strcmp(layouts[jk].name,
|
|
||||||
config.tag_rules[i - 1].layout_name) == 0) {
|
|
||||||
m->pertag->ltidxs[config.tag_rules[i - 1].id] =
|
|
||||||
&layouts[jk];
|
|
||||||
m->pertag->no_hide[config.tag_rules[i - 1].id] =
|
|
||||||
config.tag_rules[i - 1].no_hide;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ int focusmon(const Arg *arg) {
|
|||||||
focusclient(c, 1);
|
focusclient(c, 1);
|
||||||
|
|
||||||
if (old_selmon_sel) {
|
if (old_selmon_sel) {
|
||||||
setborder_color(old_selmon_sel);
|
client_set_unfocused_opacity_animation(old_selmon_sel);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@ int restore_minimized(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->isminied) {
|
if (c->isminied && !c->isnamedscratchpad) {
|
||||||
c->is_scratchpad_show = 0;
|
c->is_scratchpad_show = 0;
|
||||||
c->is_in_scratchpad = 0;
|
c->is_in_scratchpad = 0;
|
||||||
c->isnamedscratchpad = 0;
|
c->isnamedscratchpad = 0;
|
||||||
@@ -805,7 +805,7 @@ int spawn_on_empty(const Arg *arg) {
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
view(arg, true);
|
view(arg, true);
|
||||||
spawn(arg);
|
spawn_shell(arg);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -971,7 +971,7 @@ int tag(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tagmon(const Arg *arg) {
|
int tagmon(const Arg *arg) {
|
||||||
Monitor *m = NULL;
|
Monitor *m = NULL, *cm = NULL;
|
||||||
Client *c = focustop(selmon);
|
Client *c = focustop(selmon);
|
||||||
|
|
||||||
if (!c)
|
if (!c)
|
||||||
@@ -980,11 +980,12 @@ int tagmon(const Arg *arg) {
|
|||||||
if (arg->i != UNDIR) {
|
if (arg->i != UNDIR) {
|
||||||
m = dirtomon(arg->i);
|
m = dirtomon(arg->i);
|
||||||
} else if (arg->v) {
|
} else if (arg->v) {
|
||||||
wl_list_for_each(m, &mons, link) {
|
wl_list_for_each(cm, &mons, link) {
|
||||||
if (!m->wlr_output->enabled) {
|
if (!cm->wlr_output->enabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
if (regex_match(arg->v, cm->wlr_output->name)) {
|
||||||
|
m = cm;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1087,7 +1088,7 @@ int toggle_named_scratchpad(const Arg *arg) {
|
|||||||
|
|
||||||
if (!target_client && arg->v3) {
|
if (!target_client && arg->v3) {
|
||||||
Arg arg_spawn = {.v = arg->v3};
|
Arg arg_spawn = {.v = arg->v3};
|
||||||
spawn(&arg_spawn);
|
spawn_shell(&arg_spawn);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ Client *center_tiled_select(Monitor *m) {
|
|||||||
return target_c;
|
return target_c;
|
||||||
}
|
}
|
||||||
Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||||
bool align) {
|
bool ignore_align) {
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
Client **tempClients = NULL; // 初始化为 NULL
|
Client **tempClients = NULL; // 初始化为 NULL
|
||||||
int last = -1;
|
int last = -1;
|
||||||
@@ -185,6 +185,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
|
|
||||||
switch (arg->i) {
|
switch (arg->i) {
|
||||||
case UP:
|
case UP:
|
||||||
|
if (!ignore_align) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.y < sel_y &&
|
if (tempClients[_i]->geom.y < sel_y &&
|
||||||
tempClients[_i]->geom.x == sel_x &&
|
tempClients[_i]->geom.x == sel_x &&
|
||||||
@@ -199,7 +200,8 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tempFocusClients && !align) {
|
}
|
||||||
|
if (!tempFocusClients) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.y < sel_y) {
|
if (tempClients[_i]->geom.y < sel_y) {
|
||||||
int dis_x = tempClients[_i]->geom.x - sel_x;
|
int dis_x = tempClients[_i]->geom.x - sel_x;
|
||||||
@@ -215,6 +217,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DOWN:
|
case DOWN:
|
||||||
|
if (!ignore_align) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.y > sel_y &&
|
if (tempClients[_i]->geom.y > sel_y &&
|
||||||
tempClients[_i]->geom.x == sel_x &&
|
tempClients[_i]->geom.x == sel_x &&
|
||||||
@@ -229,7 +232,8 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tempFocusClients && !align) {
|
}
|
||||||
|
if (!tempFocusClients) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.y > sel_y) {
|
if (tempClients[_i]->geom.y > sel_y) {
|
||||||
int dis_x = tempClients[_i]->geom.x - sel_x;
|
int dis_x = tempClients[_i]->geom.x - sel_x;
|
||||||
@@ -245,6 +249,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LEFT:
|
case LEFT:
|
||||||
|
if (!ignore_align) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x < sel_x &&
|
if (tempClients[_i]->geom.x < sel_x &&
|
||||||
tempClients[_i]->geom.y == sel_y &&
|
tempClients[_i]->geom.y == sel_y &&
|
||||||
@@ -259,7 +264,8 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tempFocusClients && !align) {
|
}
|
||||||
|
if (!tempFocusClients) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x < sel_x) {
|
if (tempClients[_i]->geom.x < sel_x) {
|
||||||
int dis_x = tempClients[_i]->geom.x - sel_x;
|
int dis_x = tempClients[_i]->geom.x - sel_x;
|
||||||
@@ -275,6 +281,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
|
if (!ignore_align) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x > sel_x &&
|
if (tempClients[_i]->geom.x > sel_x &&
|
||||||
tempClients[_i]->geom.y == sel_y &&
|
tempClients[_i]->geom.y == sel_y &&
|
||||||
@@ -289,7 +296,8 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tempFocusClients && !align) {
|
}
|
||||||
|
if (!tempFocusClients) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x > sel_x) {
|
if (tempClients[_i]->geom.x > sel_x) {
|
||||||
int dis_x = tempClients[_i]->geom.x - sel_x;
|
int dis_x = tempClients[_i]->geom.x - sel_x;
|
||||||
@@ -317,12 +325,12 @@ Client *direction_select(const Arg *arg) {
|
|||||||
if (!tc)
|
if (!tc)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (tc && (tc->isfullscreen || tc->ismaximizescreen)) {
|
if (tc && (tc->isfullscreen || tc->ismaximizescreen) &&
|
||||||
// 不支持全屏窗口的焦点切换
|
!is_scroller_layout(selmon)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return find_client_by_direction(tc, arg, true, false);
|
return find_client_by_direction(tc, arg, true, is_scroller_layout(selmon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We probably should change the name of this, it sounds like
|
/* We probably should change the name of this, it sounds like
|
||||||
@@ -374,7 +382,10 @@ Client *get_next_stack_client(Client *c, bool reverse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float *get_border_color(Client *c) {
|
float *get_border_color(Client *c) {
|
||||||
if (c->isurgent) {
|
|
||||||
|
if (c->mon != selmon) {
|
||||||
|
return bordercolor;
|
||||||
|
} else if (c->isurgent) {
|
||||||
return urgentcolor;
|
return urgentcolor;
|
||||||
} else if (c->is_in_scratchpad && selmon && c == selmon->sel) {
|
} else if (c->is_in_scratchpad && selmon && c == selmon->sel) {
|
||||||
return scratchpadcolor;
|
return scratchpadcolor;
|
||||||
|
|||||||
@@ -599,6 +599,7 @@ arrange(Monitor *m, bool want_animation) {
|
|||||||
return;
|
return;
|
||||||
m->visible_clients = 0;
|
m->visible_clients = 0;
|
||||||
m->visible_tiling_clients = 0;
|
m->visible_tiling_clients = 0;
|
||||||
|
m->visible_scroll_tiling_clients = 0;
|
||||||
m->has_visible_fullscreen_client = false;
|
m->has_visible_fullscreen_client = false;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
@@ -619,6 +620,10 @@ arrange(Monitor *m, bool want_animation) {
|
|||||||
if (ISTILED(c)) {
|
if (ISTILED(c)) {
|
||||||
m->visible_tiling_clients++;
|
m->visible_tiling_clients++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ISSCROLLTILED(c)) {
|
||||||
|
m->visible_scroll_tiling_clients++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,9 +189,42 @@ void deck(Monitor *m) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void horizontal_scroll_adjust_fullandmax(Client *c,
|
||||||
|
struct wlr_box *target_geom) {
|
||||||
|
Monitor *m = c->mon;
|
||||||
|
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||||
|
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||||
|
unsigned int 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;
|
||||||
|
|
||||||
|
if (c->isfullscreen) {
|
||||||
|
target_geom->height = m->m.height;
|
||||||
|
target_geom->width = m->m.width;
|
||||||
|
target_geom->y = m->m.y;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c->ismaximizescreen) {
|
||||||
|
target_geom->height = m->w.height - 2 * cur_gappov;
|
||||||
|
target_geom->width = m->w.width - 2 * cur_gappoh;
|
||||||
|
target_geom->y = m->w.y + cur_gappov;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
target_geom->height = m->w.height - 2 * cur_gappov;
|
||||||
|
target_geom->y = m->w.y + (m->w.height - target_geom->height) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
// 滚动布局
|
// 滚动布局
|
||||||
void scroller(Monitor *m) {
|
void scroller(Monitor *m) {
|
||||||
unsigned int i, n, j;
|
unsigned int i, n, j;
|
||||||
|
float single_proportion = 1.0;
|
||||||
|
|
||||||
Client *c = NULL, *root_client = NULL;
|
Client *c = NULL, *root_client = NULL;
|
||||||
Client **tempClients = NULL; // 初始化为 NULL
|
Client **tempClients = NULL; // 初始化为 NULL
|
||||||
@@ -202,14 +235,17 @@ void scroller(Monitor *m) {
|
|||||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||||
|
|
||||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
cur_gappih =
|
||||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
cur_gappoh =
|
||||||
|
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
|
cur_gappov =
|
||||||
|
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
unsigned int max_client_width =
|
unsigned int max_client_width =
|
||||||
m->w.width - 2 * scroller_structs - cur_gappih;
|
m->w.width - 2 * scroller_structs - cur_gappih;
|
||||||
|
|
||||||
n = m->visible_tiling_clients;
|
n = m->visible_scroll_tiling_clients;
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
return; // 没有需要处理的客户端,直接返回
|
return; // 没有需要处理的客户端,直接返回
|
||||||
@@ -225,17 +261,22 @@ void scroller(Monitor *m) {
|
|||||||
// 第二次遍历,填充 tempClients
|
// 第二次遍历,填充 tempClients
|
||||||
j = 0;
|
j = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
|
||||||
tempClients[j] = c;
|
tempClients[j] = c;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 1 && !scroller_ignore_proportion_single) {
|
if (n == 1 && !scroller_ignore_proportion_single &&
|
||||||
|
!tempClients[0]->isfullscreen && !tempClients[0]->ismaximizescreen) {
|
||||||
c = tempClients[0];
|
c = tempClients[0];
|
||||||
|
|
||||||
|
single_proportion = c->scroller_proportion_single > 0.0f
|
||||||
|
? c->scroller_proportion_single
|
||||||
|
: scroller_default_proportion_single;
|
||||||
|
|
||||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||||
target_geom.width =
|
target_geom.width = (m->w.width - 2 * cur_gappoh) * single_proportion;
|
||||||
(m->w.width - 2 * cur_gappoh) * scroller_default_proportion_single;
|
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
@@ -243,11 +284,10 @@ void scroller(Monitor *m) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
|
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
|
||||||
!m->sel->ismaximizescreen && !m->sel->isfullscreen) {
|
|
||||||
root_client = m->sel;
|
root_client = m->sel;
|
||||||
} else if (m->prevsel && ISTILED(m->prevsel) && VISIBLEON(m->prevsel, m) &&
|
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
|
||||||
!client_is_unmanaged(m->prevsel)) {
|
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {
|
||||||
root_client = m->prevsel;
|
root_client = m->prevsel;
|
||||||
} else {
|
} else {
|
||||||
root_client = center_tiled_select(m);
|
root_client = center_tiled_select(m);
|
||||||
@@ -284,11 +324,18 @@ void scroller(Monitor *m) {
|
|||||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
target_geom.width = max_client_width * c->scroller_proportion;
|
||||||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||||
|
horizontal_scroll_adjust_fullandmax(tempClients[focus_client_index],
|
||||||
if (need_scroller) {
|
&target_geom);
|
||||||
|
if (tempClients[focus_client_index]->isfullscreen) {
|
||||||
|
target_geom.x = m->m.x;
|
||||||
|
resize(tempClients[focus_client_index], target_geom, 0);
|
||||||
|
} else if (tempClients[focus_client_index]->ismaximizescreen) {
|
||||||
|
target_geom.x = m->w.x + cur_gappoh;
|
||||||
|
resize(tempClients[focus_client_index], target_geom, 0);
|
||||||
|
} else if (need_scroller) {
|
||||||
if (scroller_focus_center ||
|
if (scroller_focus_center ||
|
||||||
((!m->prevsel ||
|
((!m->prevsel ||
|
||||||
(ISTILED(m->prevsel) &&
|
(ISSCROLLTILED(m->prevsel) &&
|
||||||
(m->prevsel->scroller_proportion * max_client_width) +
|
(m->prevsel->scroller_proportion * max_client_width) +
|
||||||
(root_client->scroller_proportion * max_client_width) >
|
(root_client->scroller_proportion * max_client_width) >
|
||||||
m->w.width - 2 * scroller_structs - cur_gappih)) &&
|
m->w.width - 2 * scroller_structs - cur_gappih)) &&
|
||||||
@@ -311,14 +358,17 @@ void scroller(Monitor *m) {
|
|||||||
for (i = 1; i <= focus_client_index; i++) {
|
for (i = 1; i <= focus_client_index; i++) {
|
||||||
c = tempClients[focus_client_index - i];
|
c = tempClients[focus_client_index - i];
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
target_geom.width = max_client_width * c->scroller_proportion;
|
||||||
|
horizontal_scroll_adjust_fullandmax(c, &target_geom);
|
||||||
target_geom.x = tempClients[focus_client_index - i + 1]->geom.x -
|
target_geom.x = tempClients[focus_client_index - i + 1]->geom.x -
|
||||||
cur_gappih - target_geom.width;
|
cur_gappih - target_geom.width;
|
||||||
|
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < n - focus_client_index; i++) {
|
for (i = 1; i < n - focus_client_index; i++) {
|
||||||
c = tempClients[focus_client_index + i];
|
c = tempClients[focus_client_index + i];
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
target_geom.width = max_client_width * c->scroller_proportion;
|
||||||
|
horizontal_scroll_adjust_fullandmax(c, &target_geom);
|
||||||
target_geom.x = tempClients[focus_client_index + i - 1]->geom.x +
|
target_geom.x = tempClients[focus_client_index + i - 1]->geom.x +
|
||||||
cur_gappih +
|
cur_gappih +
|
||||||
tempClients[focus_client_index + i - 1]->geom.width;
|
tempClients[focus_client_index + i - 1]->geom.width;
|
||||||
|
|||||||
@@ -155,8 +155,42 @@ void vertical_deck(Monitor *m) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vertical_scroll_adjust_fullandmax(Client *c, struct wlr_box *target_geom) {
|
||||||
|
Monitor *m = c->mon;
|
||||||
|
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||||
|
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||||
|
unsigned int 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;
|
||||||
|
|
||||||
|
if (c->isfullscreen) {
|
||||||
|
target_geom->width = m->m.width;
|
||||||
|
target_geom->height = m->m.height;
|
||||||
|
target_geom->x = m->m.x;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c->ismaximizescreen) {
|
||||||
|
target_geom->width = m->w.width - 2 * cur_gappoh;
|
||||||
|
target_geom->height = m->w.height - 2 * cur_gappov;
|
||||||
|
target_geom->x = m->w.x + cur_gappoh;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
target_geom->width = m->w.width - 2 * cur_gappoh;
|
||||||
|
target_geom->x = m->w.x + (m->w.width - target_geom->width) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 竖屏滚动布局
|
||||||
void vertical_scroller(Monitor *m) {
|
void vertical_scroller(Monitor *m) {
|
||||||
unsigned int i, n, j;
|
unsigned int i, n, j;
|
||||||
|
float single_proportion = 1.0;
|
||||||
|
|
||||||
Client *c = NULL, *root_client = NULL;
|
Client *c = NULL, *root_client = NULL;
|
||||||
Client **tempClients = NULL;
|
Client **tempClients = NULL;
|
||||||
struct wlr_box target_geom;
|
struct wlr_box target_geom;
|
||||||
@@ -166,14 +200,17 @@ void vertical_scroller(Monitor *m) {
|
|||||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||||
|
|
||||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv =
|
||||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
cur_gappov =
|
||||||
|
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
|
cur_gappoh =
|
||||||
|
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
|
|
||||||
unsigned int max_client_height =
|
unsigned int max_client_height =
|
||||||
m->w.height - 2 * scroller_structs - cur_gappiv;
|
m->w.height - 2 * scroller_structs - cur_gappiv;
|
||||||
|
|
||||||
n = m->visible_tiling_clients;
|
n = m->visible_scroll_tiling_clients;
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
return;
|
return;
|
||||||
@@ -186,29 +223,33 @@ void vertical_scroller(Monitor *m) {
|
|||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
|
||||||
tempClients[j] = c;
|
tempClients[j] = c;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 1 && !scroller_ignore_proportion_single) {
|
if (n == 1 && !scroller_ignore_proportion_single &&
|
||||||
|
!tempClients[0]->isfullscreen && !tempClients[0]->ismaximizescreen) {
|
||||||
c = tempClients[0];
|
c = tempClients[0];
|
||||||
|
|
||||||
|
single_proportion = c->scroller_proportion_single > 0.0f
|
||||||
|
? c->scroller_proportion_single
|
||||||
|
: scroller_default_proportion_single;
|
||||||
|
|
||||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
target_geom.width = m->w.width - 2 * cur_gappoh;
|
||||||
target_geom.height =
|
target_geom.height = (m->w.height - 2 * cur_gappov) * single_proportion;
|
||||||
(m->w.height - 2 * cur_gappov) * scroller_default_proportion_single;
|
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
|
||||||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||||
|
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
free(tempClients);
|
free(tempClients);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
|
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
|
||||||
!m->sel->ismaximizescreen && !m->sel->isfullscreen) {
|
|
||||||
root_client = m->sel;
|
root_client = m->sel;
|
||||||
} else if (m->prevsel && ISTILED(m->prevsel) && VISIBLEON(m->prevsel, m) &&
|
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
|
||||||
!client_is_unmanaged(m->prevsel)) {
|
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {
|
||||||
root_client = m->prevsel;
|
root_client = m->prevsel;
|
||||||
} else {
|
} else {
|
||||||
root_client = center_tiled_select(m);
|
root_client = center_tiled_select(m);
|
||||||
@@ -245,11 +286,19 @@ void vertical_scroller(Monitor *m) {
|
|||||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
target_geom.width = m->w.width - 2 * cur_gappoh;
|
||||||
target_geom.height = max_client_height * c->scroller_proportion;
|
target_geom.height = max_client_height * c->scroller_proportion;
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||||
|
vertical_scroll_adjust_fullandmax(tempClients[focus_client_index],
|
||||||
|
&target_geom);
|
||||||
|
|
||||||
if (need_scroller) {
|
if (tempClients[focus_client_index]->isfullscreen) {
|
||||||
|
target_geom.y = m->m.y;
|
||||||
|
resize(tempClients[focus_client_index], target_geom, 0);
|
||||||
|
} else if (tempClients[focus_client_index]->ismaximizescreen) {
|
||||||
|
target_geom.y = m->w.y + cur_gappov;
|
||||||
|
resize(tempClients[focus_client_index], target_geom, 0);
|
||||||
|
} else if (need_scroller) {
|
||||||
if (scroller_focus_center ||
|
if (scroller_focus_center ||
|
||||||
((!m->prevsel ||
|
((!m->prevsel ||
|
||||||
(ISTILED(m->prevsel) &&
|
(ISSCROLLTILED(m->prevsel) &&
|
||||||
(m->prevsel->scroller_proportion * max_client_height) +
|
(m->prevsel->scroller_proportion * max_client_height) +
|
||||||
(root_client->scroller_proportion * max_client_height) >
|
(root_client->scroller_proportion * max_client_height) >
|
||||||
m->w.height - 2 * scroller_structs - cur_gappiv)) &&
|
m->w.height - 2 * scroller_structs - cur_gappiv)) &&
|
||||||
@@ -272,14 +321,17 @@ void vertical_scroller(Monitor *m) {
|
|||||||
for (i = 1; i <= focus_client_index; i++) {
|
for (i = 1; i <= focus_client_index; i++) {
|
||||||
c = tempClients[focus_client_index - i];
|
c = tempClients[focus_client_index - i];
|
||||||
target_geom.height = max_client_height * c->scroller_proportion;
|
target_geom.height = max_client_height * c->scroller_proportion;
|
||||||
|
vertical_scroll_adjust_fullandmax(c, &target_geom);
|
||||||
target_geom.y = tempClients[focus_client_index - i + 1]->geom.y -
|
target_geom.y = tempClients[focus_client_index - i + 1]->geom.y -
|
||||||
cur_gappiv - target_geom.height;
|
cur_gappiv - target_geom.height;
|
||||||
|
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < n - focus_client_index; i++) {
|
for (i = 1; i < n - focus_client_index; i++) {
|
||||||
c = tempClients[focus_client_index + i];
|
c = tempClients[focus_client_index + i];
|
||||||
target_geom.height = max_client_height * c->scroller_proportion;
|
target_geom.height = max_client_height * c->scroller_proportion;
|
||||||
|
vertical_scroll_adjust_fullandmax(c, &target_geom);
|
||||||
target_geom.y = tempClients[focus_client_index + i - 1]->geom.y +
|
target_geom.y = tempClients[focus_client_index + i - 1]->geom.y +
|
||||||
cur_gappiv +
|
cur_gappiv +
|
||||||
tempClients[focus_client_index + i - 1]->geom.height;
|
tempClients[focus_client_index + i - 1]->geom.height;
|
||||||
|
|||||||
50
src/mango.c
50
src/mango.c
@@ -104,6 +104,9 @@
|
|||||||
#define ISTILED(A) \
|
#define ISTILED(A) \
|
||||||
(A && !(A)->isfloating && !(A)->isminied && !(A)->iskilling && \
|
(A && !(A)->isfloating && !(A)->isminied && !(A)->iskilling && \
|
||||||
!(A)->ismaximizescreen && !(A)->isfullscreen && !(A)->isunglobal)
|
!(A)->ismaximizescreen && !(A)->isfullscreen && !(A)->isunglobal)
|
||||||
|
#define ISSCROLLTILED(A) \
|
||||||
|
(A && !(A)->isfloating && !(A)->isminied && !(A)->iskilling && \
|
||||||
|
!(A)->isunglobal)
|
||||||
#define VISIBLEON(C, M) \
|
#define VISIBLEON(C, M) \
|
||||||
((C) && (M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
|
((C) && (M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
|
||||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||||
@@ -377,6 +380,7 @@ struct Client {
|
|||||||
int tearing_hint;
|
int tearing_hint;
|
||||||
int force_tearing;
|
int force_tearing;
|
||||||
int allow_shortcuts_inhibit;
|
int allow_shortcuts_inhibit;
|
||||||
|
float scroller_proportion_single;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -480,6 +484,7 @@ struct Monitor {
|
|||||||
int asleep;
|
int asleep;
|
||||||
unsigned int visible_clients;
|
unsigned int visible_clients;
|
||||||
unsigned int visible_tiling_clients;
|
unsigned int visible_tiling_clients;
|
||||||
|
unsigned int visible_scroll_tiling_clients;
|
||||||
bool has_visible_fullscreen_client;
|
bool has_visible_fullscreen_client;
|
||||||
struct wlr_scene_optimized_blur *blur;
|
struct wlr_scene_optimized_blur *blur;
|
||||||
char last_surface_ws_name[256];
|
char last_surface_ws_name[256];
|
||||||
@@ -933,6 +938,10 @@ void applybounds(Client *c, struct wlr_box *bbox) {
|
|||||||
|
|
||||||
/*清除全屏标志,还原全屏时清0的border*/
|
/*清除全屏标志,还原全屏时清0的border*/
|
||||||
void clear_fullscreen_flag(Client *c) {
|
void clear_fullscreen_flag(Client *c) {
|
||||||
|
|
||||||
|
if (is_scroller_layout(c->mon))
|
||||||
|
return;
|
||||||
|
|
||||||
if (c->isfullscreen) {
|
if (c->isfullscreen) {
|
||||||
setfullscreen(c, false);
|
setfullscreen(c, false);
|
||||||
}
|
}
|
||||||
@@ -1175,6 +1184,7 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
|
|||||||
APPLY_INT_PROP(c, r, allow_shortcuts_inhibit);
|
APPLY_INT_PROP(c, r, allow_shortcuts_inhibit);
|
||||||
|
|
||||||
APPLY_FLOAT_PROP(c, r, scroller_proportion);
|
APPLY_FLOAT_PROP(c, r, scroller_proportion);
|
||||||
|
APPLY_FLOAT_PROP(c, r, scroller_proportion_single);
|
||||||
APPLY_FLOAT_PROP(c, r, focused_opacity);
|
APPLY_FLOAT_PROP(c, r, focused_opacity);
|
||||||
APPLY_FLOAT_PROP(c, r, unfocused_opacity);
|
APPLY_FLOAT_PROP(c, r, unfocused_opacity);
|
||||||
|
|
||||||
@@ -1368,7 +1378,8 @@ void applyrules(Client *c) {
|
|||||||
|
|
||||||
int fullscreen_state_backup = c->isfullscreen || client_wants_fullscreen(c);
|
int fullscreen_state_backup = c->isfullscreen || client_wants_fullscreen(c);
|
||||||
setmon(c, mon, newtags,
|
setmon(c, mon, newtags,
|
||||||
!c->isopensilent && !client_should_ignore_focus(c) &&
|
!c->isopensilent &&
|
||||||
|
!(client_is_x11_popup(c) && client_should_ignore_focus(c)) &&
|
||||||
(!c->istagsilent || !newtags ||
|
(!c->istagsilent || !newtags ||
|
||||||
newtags & mon->tagset[mon->seltags]));
|
newtags & mon->tagset[mon->seltags]));
|
||||||
|
|
||||||
@@ -2705,18 +2716,7 @@ void createmon(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply tag rule
|
// apply tag rule
|
||||||
for (i = 1; i <= config.tag_rules_count; i++) {
|
parse_tagrule(m);
|
||||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
|
||||||
if (config.tag_rules_count > 0 &&
|
|
||||||
config.tag_rules[i - 1].layout_name &&
|
|
||||||
strcmp(layouts[jk].name, config.tag_rules[i - 1].layout_name) ==
|
|
||||||
0) {
|
|
||||||
m->pertag->ltidxs[config.tag_rules[i - 1].id] = &layouts[jk];
|
|
||||||
m->pertag->no_hide[config.tag_rules[i - 1].id] =
|
|
||||||
config.tag_rules[i - 1].no_hide;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The xdg-protocol specifies:
|
/* The xdg-protocol specifies:
|
||||||
*
|
*
|
||||||
@@ -3114,6 +3114,9 @@ void destroykeyboardgroup(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void focusclient(Client *c, int lift) {
|
void focusclient(Client *c, int lift) {
|
||||||
|
|
||||||
|
Client *last_focus_client = NULL;
|
||||||
|
|
||||||
struct wlr_surface *old_keyboard_focus_surface =
|
struct wlr_surface *old_keyboard_focus_surface =
|
||||||
seat->keyboard_state.focused_surface;
|
seat->keyboard_state.focused_surface;
|
||||||
|
|
||||||
@@ -3148,12 +3151,14 @@ void focusclient(Client *c, int lift) {
|
|||||||
|
|
||||||
if (c && !c->iskilling && !client_is_unmanaged(c) && c->mon) {
|
if (c && !c->iskilling && !client_is_unmanaged(c) && c->mon) {
|
||||||
|
|
||||||
|
last_focus_client = selmon->sel;
|
||||||
selmon = c->mon;
|
selmon = c->mon;
|
||||||
selmon->prevsel = selmon->sel;
|
selmon->prevsel = selmon->sel;
|
||||||
selmon->sel = c;
|
selmon->sel = c;
|
||||||
|
|
||||||
if (selmon->prevsel && !selmon->prevsel->iskilling) {
|
if (last_focus_client && !last_focus_client->iskilling &&
|
||||||
cleint_set_unfocused_opacity_animation(selmon->prevsel);
|
last_focus_client != c) {
|
||||||
|
client_set_unfocused_opacity_animation(last_focus_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
client_set_focused_opacity_animation(c);
|
client_set_focused_opacity_animation(c);
|
||||||
@@ -3163,7 +3168,6 @@ void focusclient(Client *c, int lift) {
|
|||||||
if (c && selmon->prevsel &&
|
if (c && selmon->prevsel &&
|
||||||
(selmon->prevsel->tags & selmon->tagset[selmon->seltags]) &&
|
(selmon->prevsel->tags & selmon->tagset[selmon->seltags]) &&
|
||||||
(c->tags & selmon->tagset[selmon->seltags]) && !c->isfloating &&
|
(c->tags & selmon->tagset[selmon->seltags]) && !c->isfloating &&
|
||||||
!c->isfullscreen && !c->ismaximizescreen &&
|
|
||||||
is_scroller_layout(selmon)) {
|
is_scroller_layout(selmon)) {
|
||||||
arrange(selmon, false);
|
arrange(selmon, false);
|
||||||
}
|
}
|
||||||
@@ -3356,8 +3360,8 @@ keybinding(unsigned int state, bool locked, unsigned int mods, xkb_keysym_t sym,
|
|||||||
(strcmp(keymode.mode, k->mode) == 0)) &&
|
(strcmp(keymode.mode, k->mode) == 0)) &&
|
||||||
CLEANMASK(mods) == CLEANMASK(k->mod) &&
|
CLEANMASK(mods) == CLEANMASK(k->mod) &&
|
||||||
((k->keysymcode.type == KEY_TYPE_SYM &&
|
((k->keysymcode.type == KEY_TYPE_SYM &&
|
||||||
normalize_keysym(sym) ==
|
xkb_keysym_to_lower(sym) ==
|
||||||
normalize_keysym(k->keysymcode.keysym)) ||
|
xkb_keysym_to_lower(k->keysymcode.keysym)) ||
|
||||||
(k->keysymcode.type == KEY_TYPE_CODE &&
|
(k->keysymcode.type == KEY_TYPE_CODE &&
|
||||||
(keycode == k->keysymcode.keycode.keycode1 ||
|
(keycode == k->keysymcode.keycode.keycode1 ||
|
||||||
keycode == k->keysymcode.keycode.keycode2 ||
|
keycode == k->keysymcode.keycode.keycode2 ||
|
||||||
@@ -3640,6 +3644,7 @@ void init_client_properties(Client *c) {
|
|||||||
c->force_maximize = 0;
|
c->force_maximize = 0;
|
||||||
c->force_tearing = 0;
|
c->force_tearing = 0;
|
||||||
c->allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
c->allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
||||||
|
c->scroller_proportion_single = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void // old fix to 0.5
|
void // old fix to 0.5
|
||||||
@@ -3720,7 +3725,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
else if (selmon && is_scroller_layout(selmon) &&
|
else if (selmon && is_scroller_layout(selmon) &&
|
||||||
selmon->visible_tiling_clients > 0) {
|
selmon->visible_tiling_clients > 0) {
|
||||||
|
|
||||||
if (selmon->sel && ISTILED(selmon->sel) &&
|
if (selmon->sel && ISSCROLLTILED(selmon->sel) &&
|
||||||
VISIBLEON(selmon->sel, selmon)) {
|
VISIBLEON(selmon->sel, selmon)) {
|
||||||
at_client = selmon->sel;
|
at_client = selmon->sel;
|
||||||
} else {
|
} else {
|
||||||
@@ -4552,6 +4557,7 @@ void setmaximizescreen(Client *c, int maximizescreen) {
|
|||||||
maximizescreen_box.width = c->mon->w.width - 2 * gappoh;
|
maximizescreen_box.width = c->mon->w.width - 2 * gappoh;
|
||||||
maximizescreen_box.height = c->mon->w.height - 2 * gappov;
|
maximizescreen_box.height = c->mon->w.height - 2 * gappov;
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
||||||
|
if (!is_scroller_layout(c->mon))
|
||||||
resize(c, maximizescreen_box, 0);
|
resize(c, maximizescreen_box, 0);
|
||||||
c->ismaximizescreen = 1;
|
c->ismaximizescreen = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -4609,6 +4615,7 @@ void setfullscreen(Client *c, int fullscreen) // 用自定义全屏代理自带
|
|||||||
|
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
||||||
|
if (!is_scroller_layout(c->mon))
|
||||||
resize(c, c->mon->m, 1);
|
resize(c, c->mon->m, 1);
|
||||||
c->isfullscreen = 1;
|
c->isfullscreen = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -4807,8 +4814,11 @@ void setsel(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void show_hide_client(Client *c) {
|
void show_hide_client(Client *c) {
|
||||||
|
unsigned int target = 1;
|
||||||
|
|
||||||
|
set_size_per(c->mon, c);
|
||||||
|
target = get_tags_first_tag(c->oldtags);
|
||||||
|
|
||||||
unsigned int target = get_tags_first_tag(c->oldtags);
|
|
||||||
if (!c->is_in_scratchpad) {
|
if (!c->is_in_scratchpad) {
|
||||||
tag_client(&(Arg){.ui = target}, c);
|
tag_client(&(Arg){.ui = target}, c);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user