opt: optimize scroller layout center client judge

This commit is contained in:
DreamMaoMao
2025-11-30 11:57:34 +08:00
parent 992822e309
commit 1b7e998b67
3 changed files with 5 additions and 4 deletions

View File

@@ -128,8 +128,9 @@ Client *center_tiled_select(Monitor *m) {
int dirx, diry;
long int distance;
wl_list_for_each(c, &clients, link) {
if (c && VISIBLEON(c, m) && ISTILED(c) && client_surface(c)->mapped &&
!c->isfloating && !client_is_unmanaged(c)) {
if (c && VISIBLEON(c, m) && ISSCROLLTILED(c) &&
client_surface(c)->mapped && !c->isfloating &&
!client_is_unmanaged(c)) {
dirx = c->geom.x + c->geom.width / 2 - (m->w.x + m->w.width / 2);
diry = c->geom.y + c->geom.height / 2 - (m->w.y + m->w.height / 2);
distance = dirx * dirx + diry * diry;

View File

@@ -284,7 +284,7 @@ void scroller(Monitor *m) {
return;
}
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
if (m->sel && !client_is_unmanaged(m->sel) && ISSCROLLTILED(m->sel)) {
root_client = m->sel;
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {

View File

@@ -246,7 +246,7 @@ void vertical_scroller(Monitor *m) {
return;
}
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
if (m->sel && !client_is_unmanaged(m->sel) && ISSCROLLTILED(m->sel)) {
root_client = m->sel;
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {