mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: optimie scroller code struct
This commit is contained in:
parent
a882b1cdd4
commit
243ddc90f7
3 changed files with 16 additions and 21 deletions
|
|
@ -359,10 +359,8 @@ void scroller(Monitor *m) {
|
|||
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
|
||||
!m->sel->ismaxmizescreen && !m->sel->isfullscreen) {
|
||||
root_client = m->sel;
|
||||
} else if (m->prevsel && !client_is_unmanaged(m->prevsel) &&
|
||||
!m->prevsel->isfloating && !m->prevsel->ismaxmizescreen &&
|
||||
!m->prevsel->isfullscreen) {
|
||||
root_client = m->prevsel;
|
||||
} else if (m->prevtilesel && !client_is_unmanaged(m->prevtilesel)) {
|
||||
root_client = m->prevtilesel;
|
||||
} else {
|
||||
root_client = center_select(m);
|
||||
}
|
||||
|
|
@ -394,8 +392,8 @@ void scroller(Monitor *m) {
|
|||
|
||||
if (need_scroller) {
|
||||
if (scroller_focus_center ||
|
||||
((!m->prevsel ||
|
||||
(m->prevsel->scroller_proportion * max_client_width) +
|
||||
((!m->prevtilesel ||
|
||||
(m->prevtilesel->scroller_proportion * max_client_width) +
|
||||
(root_client->scroller_proportion * max_client_width) >
|
||||
m->w.width - 2 * scroller_structs - cur_gappih) &&
|
||||
scroller_prefer_center)) {
|
||||
|
|
|
|||
|
|
@ -344,10 +344,8 @@ void vertical_scroller(Monitor *m) {
|
|||
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
|
||||
!m->sel->ismaxmizescreen && !m->sel->isfullscreen) {
|
||||
root_client = m->sel;
|
||||
} else if (m->prevsel && !client_is_unmanaged(m->prevsel) &&
|
||||
!m->prevsel->isfloating && !m->prevsel->ismaxmizescreen &&
|
||||
!m->prevsel->isfullscreen) {
|
||||
root_client = m->prevsel;
|
||||
} else if (m->prevtilesel && !client_is_unmanaged(m->prevtilesel)) {
|
||||
root_client = m->prevtilesel;
|
||||
} else {
|
||||
root_client = center_select(m);
|
||||
}
|
||||
|
|
@ -379,8 +377,8 @@ void vertical_scroller(Monitor *m) {
|
|||
|
||||
if (need_scroller) {
|
||||
if (scroller_focus_center ||
|
||||
((!m->prevsel ||
|
||||
(m->prevsel->scroller_proportion * max_client_height) +
|
||||
((!m->prevtilesel ||
|
||||
(m->prevtilesel->scroller_proportion * max_client_height) +
|
||||
(root_client->scroller_proportion * max_client_height) >
|
||||
m->w.height - 2 * scroller_structs - cur_gappiv) &&
|
||||
scroller_prefer_center)) {
|
||||
|
|
|
|||
17
src/mango.c
17
src/mango.c
|
|
@ -100,7 +100,7 @@
|
|||
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 && \
|
||||
(A && !(A)->isfloating && !(A)->isminied && !(A)->iskilling && \
|
||||
!client_should_ignore_focus(A) && !(A)->isunglobal && \
|
||||
!(A)->animation.tagouting && !(A)->ismaxmizescreen && !(A)->isfullscreen)
|
||||
#define VISIBLEON(C, M) \
|
||||
|
|
@ -434,7 +434,7 @@ struct Monitor {
|
|||
int gappoh; /* horizontal outer gaps */
|
||||
int gappov; /* vertical outer gaps */
|
||||
Pertag *pertag;
|
||||
Client *sel, *prevsel;
|
||||
Client *sel, *prevtilesel;
|
||||
int isoverview;
|
||||
int is_in_hotarea;
|
||||
int gamma_lut_changed;
|
||||
|
|
@ -1893,7 +1893,7 @@ buttonpress(struct wl_listener *listener, void *data) {
|
|||
client_update_oldmonname_record(grabc, selmon);
|
||||
setmon(grabc, selmon, 0, true);
|
||||
reset_foreign_tolevel(grabc);
|
||||
selmon->prevsel = selmon->sel;
|
||||
selmon->prevtilesel = ISTILED(selmon->sel) ? selmon->sel : NULL;
|
||||
selmon->sel = grabc;
|
||||
tmpc = grabc;
|
||||
grabc = NULL;
|
||||
|
|
@ -3059,8 +3059,7 @@ void focusclient(Client *c, int lift) {
|
|||
if (c && !c->iskilling && !client_is_unmanaged(c) && c->mon) {
|
||||
|
||||
selmon = c->mon;
|
||||
selmon->prevsel =
|
||||
selmon->sel && ISTILED(selmon->sel) ? selmon->sel : NULL;
|
||||
selmon->prevtilesel = ISTILED(selmon->sel) ? selmon->sel : NULL;
|
||||
selmon->sel = c;
|
||||
|
||||
// decide whether need to re-arrange
|
||||
|
|
@ -4496,8 +4495,8 @@ void setmon(Client *c, Monitor *m, unsigned int newtags, bool focus) {
|
|||
oldmon->sel = NULL;
|
||||
}
|
||||
|
||||
if (oldmon && oldmon->prevsel == c) {
|
||||
oldmon->prevsel = NULL;
|
||||
if (oldmon && oldmon->prevtilesel == c) {
|
||||
oldmon->prevtilesel = NULL;
|
||||
}
|
||||
|
||||
c->mon = m;
|
||||
|
|
@ -5103,8 +5102,8 @@ void unmapnotify(struct wl_listener *listener, void *data) {
|
|||
if (c == m->sel) {
|
||||
m->sel = NULL;
|
||||
}
|
||||
if (c == m->prevsel) {
|
||||
m->prevsel = NULL;
|
||||
if (c == m->prevtilesel) {
|
||||
m->prevtilesel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue