mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Minor refactoring of warp and fullscreen patches, getting rid of MONOCLE_LAYOUT_POS setting
This commit is contained in:
parent
f45acf8795
commit
e952cc9a81
@ -674,9 +674,6 @@ static const int decorhints = 1; /* 1 means respect decoration hints */
|
|||||||
#define FORCE_VSPLIT 1
|
#define FORCE_VSPLIT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Position of the monocle layout in the layouts variable, used by warp and fullscreen patches */
|
|
||||||
#define MONOCLE_LAYOUT_POS 2
|
|
||||||
|
|
||||||
#if FLEXTILE_DELUXE_LAYOUT
|
#if FLEXTILE_DELUXE_LAYOUT
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function, { nmaster, nstack, layout, master axis, stack axis, secondary stack axis } */
|
/* symbol arrange function, { nmaster, nstack, layout, master axis, stack axis, secondary stack axis } */
|
||||||
|
20
dwm.c
20
dwm.c
@ -2591,6 +2591,9 @@ restack(Monitor *m)
|
|||||||
Client *c;
|
Client *c;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
#if WARP_PATCH && FLEXTILE_DELUXE_LAYOUT
|
||||||
|
int n;
|
||||||
|
#endif // WARP_PATCH
|
||||||
|
|
||||||
drawbar(m);
|
drawbar(m);
|
||||||
if (!m->sel)
|
if (!m->sel)
|
||||||
@ -2608,8 +2611,21 @@ restack(Monitor *m)
|
|||||||
}
|
}
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
#if WARP_PATCH
|
#if WARP_PATCH && (FLEXTILE_DELUXE_LAYOUT || MONOCLE_LAYOUT)
|
||||||
if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[MONOCLE_LAYOUT_POS])
|
#if FLEXTILE_DELUXE_LAYOUT
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // FLEXTILE_DELUXE_LAYOUT
|
||||||
|
if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && (
|
||||||
|
#if MONOCLE_LAYOUT && FLEXTILE_DELUXE_LAYOUT
|
||||||
|
(m->lt[m->sellt]->arrange != &monocle
|
||||||
|
&& !(m->ltaxis[MASTER] == MONOCLE && (abs(m->ltaxis[LAYOUT] == NO_SPLIT || !m->nmaster || n <= m->nmaster))))
|
||||||
|
#elif MONOCLE_LAYOUT
|
||||||
|
m->lt[m->sellt]->arrange == &monocle
|
||||||
|
#else
|
||||||
|
!(m->ltaxis[MASTER] == MONOCLE && (abs(m->ltaxis[LAYOUT] == NO_SPLIT || !m->nmaster || n <= m->nmaster)))
|
||||||
|
#endif // FLEXTILE_DELUXE_LAYOUT
|
||||||
|
|| m->sel->isfloating)
|
||||||
|
)
|
||||||
warp(m->sel);
|
warp(m->sel);
|
||||||
#endif // WARP_PATCH
|
#endif // WARP_PATCH
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,11 @@ Layout *last_layout;
|
|||||||
void
|
void
|
||||||
fullscreen(const Arg *arg)
|
fullscreen(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
int monocle_pos;
|
||||||
if (selmon->showbar || last_layout == NULL) {
|
if (selmon->showbar || last_layout == NULL) {
|
||||||
|
for (monocle_pos = 0, last_layout = (Layout *)layouts; !last_layout->arrange || last_layout->arrange != &monocle; monocle_pos++, last_layout++ );
|
||||||
for (last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
|
for (last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
|
||||||
setlayout(&((Arg) { .v = &layouts[MONOCLE_LAYOUT_POS] }));
|
setlayout(&((Arg) { .v = &layouts[monocle_pos] }));
|
||||||
} else {
|
} else {
|
||||||
setlayout(&((Arg) { .v = last_layout }));
|
setlayout(&((Arg) { .v = last_layout }));
|
||||||
}
|
}
|
||||||
|
18
patch/warp.c
18
patch/warp.c
@ -4,19 +4,19 @@ warp(const Client *c)
|
|||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (!c) {
|
if (!c) {
|
||||||
XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2);
|
XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh / 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getrootptr(&x, &y) ||
|
if (!getrootptr(&x, &y) ||
|
||||||
(x > c->x - c->bw &&
|
(x > c->x - c->bw &&
|
||||||
y > c->y - c->bw &&
|
y > c->y - c->bw &&
|
||||||
x < c->x + c->w + c->bw*2 &&
|
x < c->x + c->w + c->bw*2 &&
|
||||||
y < c->y + c->h + c->bw*2) ||
|
y < c->y + c->h + c->bw*2) ||
|
||||||
x < c->mon->wx ||
|
x < c->mon->wx ||
|
||||||
x > c->mon->wx + c->mon->ww ||
|
x > c->mon->wx + c->mon->ww ||
|
||||||
y < c->mon->wy ||
|
y < c->mon->wy ||
|
||||||
y > c->mon->wy + c->mon->wh
|
y > c->mon->wy + c->mon->wh
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -503,7 +503,6 @@
|
|||||||
|
|
||||||
/* Applies the monocle layout with the focused client on top and hides the bar. When pressed
|
/* Applies the monocle layout with the focused client on top and hides the bar. When pressed
|
||||||
* again it shows the bar and restores the layout that was active before going fullscreen.
|
* again it shows the bar and restores the layout that was active before going fullscreen.
|
||||||
* NB: This patch assumes that the third layout is monocle and that the bar is shown.
|
|
||||||
* https://dwm.suckless.org/patches/fullscreen/
|
* https://dwm.suckless.org/patches/fullscreen/
|
||||||
*/
|
*/
|
||||||
#define FULLSCREEN_PATCH 0
|
#define FULLSCREEN_PATCH 0
|
||||||
|
Loading…
Reference in New Issue
Block a user