mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: optimize scroll judge when focus change
This commit is contained in:
parent
e81ca5a6e5
commit
a882b1cdd4
1 changed files with 9 additions and 7 deletions
16
src/mango.c
16
src/mango.c
|
|
@ -95,6 +95,10 @@
|
|||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||
#define GEZERO(A) ((A) >= 0 ? (A) : 0)
|
||||
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
|
||||
#define INSIDEMON(A) \
|
||||
(A->geom.x > A->mon->m.x && A->geom.y > A->mon->m.y && \
|
||||
A->geom.x + A->geom.width < A->mon->m.x + A->mon->m.width && \
|
||||
A->geom.y + A->geom.height < A->mon->m.y + A->mon->m.height)
|
||||
#define ISTILED(A) \
|
||||
(!(A)->isfloating && !(A)->isminied && !(A)->iskilling && \
|
||||
!client_should_ignore_focus(A) && !(A)->isunglobal && \
|
||||
|
|
@ -3055,17 +3059,15 @@ void focusclient(Client *c, int lift) {
|
|||
if (c && !c->iskilling && !client_is_unmanaged(c) && c->mon) {
|
||||
|
||||
selmon = c->mon;
|
||||
selmon->prevsel = selmon->sel;
|
||||
selmon->prevsel =
|
||||
selmon->sel && ISTILED(selmon->sel) ? selmon->sel : NULL;
|
||||
selmon->sel = c;
|
||||
|
||||
// decide whether need to re-arrange
|
||||
if (c && selmon->prevsel && !selmon->prevsel->isfloating &&
|
||||
(selmon->prevsel->tags & selmon->tagset[selmon->seltags]) &&
|
||||
(c->tags & selmon->tagset[selmon->seltags]) && !c->isfloating &&
|
||||
!c->isfullscreen && is_scroller_layout(selmon)) {
|
||||
|
||||
if (c && ISTILED(c) && VISIBLEON(c, selmon) && !INSIDEMON(c) &&
|
||||
is_scroller_layout(selmon)) {
|
||||
arrange(selmon, false);
|
||||
} else if (selmon->prevsel) {
|
||||
selmon->prevsel = NULL;
|
||||
}
|
||||
|
||||
// change focus link position
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue