Skip to content

Commit 1b7e998

Browse files
committed
opt: optimize scroller layout center client judge
1 parent 992822e commit 1b7e998

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/fetch/client.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ Client *center_tiled_select(Monitor *m) {
128128
int dirx, diry;
129129
long int distance;
130130
wl_list_for_each(c, &clients, link) {
131-
if (c && VISIBLEON(c, m) && ISTILED(c) && client_surface(c)->mapped &&
132-
!c->isfloating && !client_is_unmanaged(c)) {
131+
if (c && VISIBLEON(c, m) && ISSCROLLTILED(c) &&
132+
client_surface(c)->mapped && !c->isfloating &&
133+
!client_is_unmanaged(c)) {
133134
dirx = c->geom.x + c->geom.width / 2 - (m->w.x + m->w.width / 2);
134135
diry = c->geom.y + c->geom.height / 2 - (m->w.y + m->w.height / 2);
135136
distance = dirx * dirx + diry * diry;

src/layout/horizontal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void scroller(Monitor *m) {
284284
return;
285285
}
286286

287-
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
287+
if (m->sel && !client_is_unmanaged(m->sel) && ISSCROLLTILED(m->sel)) {
288288
root_client = m->sel;
289289
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
290290
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {

src/layout/vertical.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void vertical_scroller(Monitor *m) {
246246
return;
247247
}
248248

249-
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
249+
if (m->sel && !client_is_unmanaged(m->sel) && ISSCROLLTILED(m->sel)) {
250250
root_client = m->sel;
251251
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
252252
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {

0 commit comments

Comments
 (0)