mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-02 09:01:43 -05:00
Merge pull request #159 from DreamMaoMao/fix-smartgap
fix: smartgap shouldn't affect by non-tiling window
This commit is contained in:
commit
296b375e2a
3 changed files with 64 additions and 54 deletions
|
|
@ -6,10 +6,10 @@ void fibonacci(Monitor *mon, int s) {
|
||||||
unsigned int cur_gappoh = enablegaps ? mon->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? mon->gappoh : 0;
|
||||||
unsigned int cur_gappov = enablegaps ? mon->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? mon->gappov : 0;
|
||||||
|
|
||||||
cur_gappih = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
// Count visible clients
|
// Count visible clients
|
||||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && ISTILED(c))
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && ISTILED(c))
|
||||||
n++;
|
n++;
|
||||||
|
|
@ -28,7 +28,8 @@ void fibonacci(Monitor *mon, int s) {
|
||||||
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c->bw = mon->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw = mon->visible_tiling_clients == 1 && no_border_when_single &&
|
||||||
|
smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
||||||
|
|
@ -146,10 +147,10 @@ void grid(Monitor *m) {
|
||||||
|
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw =
|
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||||
m->visible_clients == 1 && no_border_when_single && smartgaps
|
smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||||
((m->isoverview && !client_should_ignore_focus(c)) ||
|
((m->isoverview && !client_should_ignore_focus(c)) ||
|
||||||
ISTILED(c))) {
|
ISTILED(c))) {
|
||||||
|
|
@ -170,10 +171,10 @@ void grid(Monitor *m) {
|
||||||
ch = (m->w.height - 2 * overviewgappo) * 0.65;
|
ch = (m->w.height - 2 * overviewgappo) * 0.65;
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw =
|
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||||
m->visible_clients == 1 && no_border_when_single && smartgaps
|
smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||||
((m->isoverview && !client_should_ignore_focus(c)) ||
|
((m->isoverview && !client_should_ignore_focus(c)) ||
|
||||||
ISTILED(c))) {
|
ISTILED(c))) {
|
||||||
|
|
@ -218,9 +219,10 @@ void grid(Monitor *m) {
|
||||||
// 调整每个客户端的位置和大小
|
// 调整每个客户端的位置和大小
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw =
|
||||||
? 0
|
m->visible_tiling_clients == 1 && no_border_when_single && smartgaps
|
||||||
: borderpx;
|
? 0
|
||||||
|
: borderpx;
|
||||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||||
((m->isoverview && !client_should_ignore_focus(c)) || ISTILED(c))) {
|
((m->isoverview && !client_should_ignore_focus(c)) || ISTILED(c))) {
|
||||||
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
||||||
|
|
@ -247,10 +249,10 @@ void deck(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_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
|
|
@ -310,9 +312,9 @@ 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_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_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;
|
||||||
|
|
@ -447,10 +449,10 @@ void tile(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_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
||||||
mw = selmon->pertag->nmasters[selmon->pertag->curtag]
|
mw = selmon->pertag->nmasters[selmon->pertag->curtag]
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ void vertical_fibonacci(Monitor *mon, int s) {
|
||||||
unsigned int cur_gappoh = enablegaps ? mon->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? mon->gappoh : 0;
|
||||||
unsigned int cur_gappov = enablegaps ? mon->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? mon->gappov : 0;
|
||||||
|
|
||||||
cur_gappih = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
// Count visible clients
|
// Count visible clients
|
||||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && ISTILED(c))
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && ISTILED(c))
|
||||||
n++;
|
n++;
|
||||||
|
|
@ -28,7 +28,8 @@ void vertical_fibonacci(Monitor *mon, int s) {
|
||||||
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c->bw = mon->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw = mon->visible_tiling_clients == 1 && no_border_when_single &&
|
||||||
|
smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if ((i % 2 && nw / 2 > 2 * c->bw) || (!(i % 2) && nh / 2 > 2 * c->bw)) {
|
if ((i % 2 && nw / 2 > 2 * c->bw) || (!(i % 2) && nh / 2 > 2 * c->bw)) {
|
||||||
|
|
@ -144,10 +145,10 @@ void vertical_grid(Monitor *m) {
|
||||||
|
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw =
|
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||||
m->visible_clients == 1 && no_border_when_single && smartgaps
|
smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||||
((m->isoverview && !client_should_ignore_focus(c)) ||
|
((m->isoverview && !client_should_ignore_focus(c)) ||
|
||||||
ISTILED(c))) {
|
ISTILED(c))) {
|
||||||
|
|
@ -168,10 +169,10 @@ void vertical_grid(Monitor *m) {
|
||||||
cw = (m->w.width - 2 * overviewgappo) * 0.65;
|
cw = (m->w.width - 2 * overviewgappo) * 0.65;
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw =
|
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||||
m->visible_clients == 1 && no_border_when_single && smartgaps
|
smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||||
((m->isoverview && !client_should_ignore_focus(c)) ||
|
((m->isoverview && !client_should_ignore_focus(c)) ||
|
||||||
ISTILED(c))) {
|
ISTILED(c))) {
|
||||||
|
|
@ -213,9 +214,10 @@ void vertical_grid(Monitor *m) {
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw =
|
||||||
? 0
|
m->visible_tiling_clients == 1 && no_border_when_single && smartgaps
|
||||||
: borderpx;
|
? 0
|
||||||
|
: borderpx;
|
||||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||||
((m->isoverview && !client_should_ignore_focus(c)) || ISTILED(c))) {
|
((m->isoverview && !client_should_ignore_focus(c)) || ISTILED(c))) {
|
||||||
cx = m->w.x + (i / rows) * (cw + overviewgappi);
|
cx = m->w.x + (i / rows) * (cw + overviewgappi);
|
||||||
|
|
@ -242,10 +244,10 @@ void vertical_deck(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_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
|
|
@ -299,9 +301,9 @@ 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_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_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;
|
||||||
|
|
@ -432,10 +434,10 @@ void vertical_tile(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_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
||||||
mh = selmon->pertag->nmasters[selmon->pertag->curtag]
|
mh = selmon->pertag->nmasters[selmon->pertag->curtag]
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,7 @@ struct Monitor {
|
||||||
int gamma_lut_changed;
|
int gamma_lut_changed;
|
||||||
int asleep;
|
int asleep;
|
||||||
unsigned int visible_clients;
|
unsigned int visible_clients;
|
||||||
|
unsigned int visible_tiling_clients;
|
||||||
struct wlr_scene_optimized_blur *blur;
|
struct wlr_scene_optimized_blur *blur;
|
||||||
char last_surface_ws_name[256];
|
char last_surface_ws_name[256];
|
||||||
};
|
};
|
||||||
|
|
@ -1472,6 +1473,7 @@ arrange(Monitor *m, bool want_animation) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m->visible_clients = 0;
|
m->visible_clients = 0;
|
||||||
|
m->visible_tiling_clients = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->iskilling)
|
if (c->iskilling)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1489,6 +1491,10 @@ arrange(Monitor *m, bool want_animation) {
|
||||||
m->visible_clients++;
|
m->visible_clients++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ISTILED(c)) {
|
||||||
|
m->visible_tiling_clients++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!c->is_clip_to_hide || !ISTILED(c) ||
|
if (!c->is_clip_to_hide || !ISTILED(c) ||
|
||||||
!is_scroller_layout(c->mon)) {
|
!is_scroller_layout(c->mon)) {
|
||||||
c->is_clip_to_hide = false;
|
c->is_clip_to_hide = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue