mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Assortment of fullscreen improvements (togglefullscreen / fakefullscreenclient / tagallmon / tagswapmon)
This commit is contained in:
parent
dcf7b049ba
commit
5f5dc7ab9c
57
dwm.c
57
dwm.c
@ -578,7 +578,7 @@ static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
static void unfocus(Client *c, int setfocus, Client *nextfocus);
|
||||
static void unmanage(Client *c, int destroyed);
|
||||
static void unmapnotify(XEvent *e);
|
||||
static void updatebarpos(Monitor *m);
|
||||
@ -938,7 +938,7 @@ buttonpress(XEvent *e)
|
||||
&& (focusonwheel || (ev->button != Button4 && ev->button != Button5))
|
||||
#endif // FOCUSONCLICK_PATCH
|
||||
) {
|
||||
unfocus(selmon->sel, 1);
|
||||
unfocus(selmon->sel, 1, NULL);
|
||||
selmon = m;
|
||||
focus(NULL);
|
||||
}
|
||||
@ -1656,9 +1656,9 @@ enternotify(XEvent *e)
|
||||
#if LOSEFULLSCREEN_PATCH
|
||||
sel = selmon->sel;
|
||||
selmon = m;
|
||||
unfocus(sel, 1);
|
||||
unfocus(sel, 1, c);
|
||||
#else
|
||||
unfocus(selmon->sel, 1);
|
||||
unfocus(selmon->sel, 1, c);
|
||||
selmon = m;
|
||||
#endif // LOSEFULLSCREEN_PATCH
|
||||
} else if (!c || c == selmon->sel)
|
||||
@ -1683,7 +1683,7 @@ focus(Client *c)
|
||||
if (!c || !ISVISIBLE(c))
|
||||
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
||||
if (selmon->sel && selmon->sel != c)
|
||||
unfocus(selmon->sel, 0);
|
||||
unfocus(selmon->sel, 0, c);
|
||||
if (c) {
|
||||
if (c->mon != selmon)
|
||||
selmon = c->mon;
|
||||
@ -1732,9 +1732,9 @@ focusmon(const Arg *arg)
|
||||
#if LOSEFULLSCREEN_PATCH
|
||||
sel = selmon->sel;
|
||||
selmon = m;
|
||||
unfocus(sel, 0);
|
||||
unfocus(sel, 0, NULL);
|
||||
#else
|
||||
unfocus(selmon->sel, 0);
|
||||
unfocus(selmon->sel, 0, NULL);
|
||||
selmon = m;
|
||||
#endif // LOSEFULLSCREEN_PATCH
|
||||
focus(NULL);
|
||||
@ -2126,7 +2126,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||
setclientstate(c, NormalState);
|
||||
#endif // BAR_WINTITLEACTIONS_PATCH
|
||||
if (c->mon == selmon)
|
||||
unfocus(selmon->sel, 0);
|
||||
unfocus(selmon->sel, 0, c);
|
||||
c->mon->sel = c;
|
||||
arrange(c->mon);
|
||||
#if BAR_WINTITLEACTIONS_PATCH
|
||||
@ -2191,9 +2191,9 @@ motionnotify(XEvent *e)
|
||||
#if LOSEFULLSCREEN_PATCH
|
||||
sel = selmon->sel;
|
||||
selmon = m;
|
||||
unfocus(sel, 1);
|
||||
unfocus(sel, 1, NULL);
|
||||
#else
|
||||
unfocus(selmon->sel, 1);
|
||||
unfocus(selmon->sel, 1, NULL);
|
||||
selmon = m;
|
||||
#endif // LOSEFULLSCREEN_PATCH
|
||||
focus(NULL);
|
||||
@ -2686,7 +2686,7 @@ sendmon(Client *c, Monitor *m)
|
||||
#if SENDMON_KEEPFOCUS_PATCH && !EXRESIZE_PATCH
|
||||
int hadfocus = (c == selmon->sel);
|
||||
#endif // SENDMON_KEEPFOCUS_PATCH
|
||||
unfocus(c, 1);
|
||||
unfocus(c, 1, NULL);
|
||||
detach(c);
|
||||
detachstack(c);
|
||||
#if SENDMON_KEEPFOCUS_PATCH && !EXRESIZE_PATCH
|
||||
@ -2821,7 +2821,8 @@ setfullscreen(Client *c, int fullscreen)
|
||||
c->isfullscreen = 1;
|
||||
#if !FAKEFULLSCREEN_PATCH
|
||||
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (!c->fakefullscreen) {
|
||||
if (c->fakefullscreen == 1)
|
||||
return;
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
c->oldstate = c->isfloating;
|
||||
c->oldbw = c->bw;
|
||||
@ -2829,9 +2830,6 @@ setfullscreen(Client *c, int fullscreen)
|
||||
c->isfloating = 1;
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||
}
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
#endif // !FAKEFULLSCREEN_PATCH
|
||||
} else if (!fullscreen && c->isfullscreen){
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
@ -2839,7 +2837,10 @@ setfullscreen(Client *c, int fullscreen)
|
||||
c->isfullscreen = 0;
|
||||
#if !FAKEFULLSCREEN_PATCH
|
||||
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (!c->fakefullscreen) {
|
||||
if (c->fakefullscreen == 1)
|
||||
return;
|
||||
if (c->fakefullscreen == 2)
|
||||
c->fakefullscreen = 1;
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
c->isfloating = c->oldstate;
|
||||
c->bw = c->oldbw;
|
||||
@ -2849,9 +2850,6 @@ setfullscreen(Client *c, int fullscreen)
|
||||
c->h = c->oldh;
|
||||
resizeclient(c, c->x, c->y, c->w, c->h);
|
||||
arrange(c->mon);
|
||||
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||
}
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
#endif // !FAKEFULLSCREEN_PATCH
|
||||
}
|
||||
}
|
||||
@ -3299,7 +3297,7 @@ tagmon(const Arg *arg)
|
||||
sendmon(c, dirtomon(arg->i));
|
||||
c->isfullscreen = 1;
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (!c->fakefullscreen) {
|
||||
if (c->fakefullscreen != 1) {
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
}
|
||||
@ -3487,7 +3485,7 @@ toggleview(const Arg *arg)
|
||||
}
|
||||
|
||||
void
|
||||
unfocus(Client *c, int setfocus)
|
||||
unfocus(Client *c, int setfocus, Client *nextfocus)
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
@ -3495,13 +3493,18 @@ unfocus(Client *c, int setfocus)
|
||||
selmon->pertag->prevclient[selmon->pertag->curtag] = c;
|
||||
#endif // SWAPFOCUS_PATCH
|
||||
#if LOSEFULLSCREEN_PATCH
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (c->isfullscreen && !c->fakefullscreen && ISVISIBLE(c) && c->mon == selmon)
|
||||
if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon && nextfocus && !nextfocus->isfloating) {
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (!c->fakefullscreen)
|
||||
setfullscreen(c, 0);
|
||||
else if (c->fakefullscreen == 2) {
|
||||
c->fakefullscreen = 0;
|
||||
togglefakefullscreen(NULL);
|
||||
}
|
||||
#else
|
||||
setfullscreen(c, 0);
|
||||
#else
|
||||
if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon)
|
||||
setfullscreen(c, 0);
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
}
|
||||
#endif // LOSEFULLSCREEN_PATCH
|
||||
grabbuttons(c, 0);
|
||||
#if !BAR_FLEXWINTITLE_PATCH
|
||||
|
@ -2,27 +2,44 @@ void
|
||||
tagallmon(const Arg *arg)
|
||||
{
|
||||
Monitor *m;
|
||||
Client *c;
|
||||
Client *next;
|
||||
Client *c, *last, *slast, *next;
|
||||
|
||||
if (!mons->next)
|
||||
return;
|
||||
|
||||
m = dirtomon(arg->i);
|
||||
for (last = m->clients; last && last->next; last = last->next);
|
||||
for (slast = m->stack; slast && slast->snext; slast = slast->snext);
|
||||
|
||||
for (c = selmon->clients; c; c = next) {
|
||||
next = c->next;
|
||||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
unfocus(c, 1);
|
||||
unfocus(c, 1, NULL);
|
||||
detach(c);
|
||||
detachstack(c);
|
||||
c->mon = m;
|
||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
c->next = NULL;
|
||||
c->snext = NULL;
|
||||
if (last)
|
||||
last = last->next = c;
|
||||
else
|
||||
m->clients = last = c;
|
||||
if (slast)
|
||||
slast = slast->snext = c;
|
||||
else
|
||||
m->stack = slast = c;
|
||||
if (c->isfullscreen) {
|
||||
setfullscreen(c, 0);
|
||||
setfullscreen(c, 1);
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (c->fakefullscreen != 1) {
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
}
|
||||
#elif !FAKEFULLSCREEN_PATCH
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ tagswapmon(const Arg *arg)
|
||||
next = c->next;
|
||||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
unfocus(c, 1);
|
||||
unfocus(c, 1, NULL);
|
||||
detach(c);
|
||||
detachstack(c);
|
||||
c->next = sc;
|
||||
@ -24,7 +24,7 @@ tagswapmon(const Arg *arg)
|
||||
next = c->next;
|
||||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
unfocus(c, 1);
|
||||
unfocus(c, 1, NULL);
|
||||
detach(c);
|
||||
detachstack(c);
|
||||
c->next = mc;
|
||||
@ -38,20 +38,34 @@ tagswapmon(const Arg *arg)
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
if (c->isfullscreen) {
|
||||
setfullscreen(c, 0);
|
||||
setfullscreen(c, 1);
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (c->fakefullscreen != 1) {
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
}
|
||||
#elif !FAKEFULLSCREEN_PATCH
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
}
|
||||
}
|
||||
|
||||
for (c = mc; c; c = next) {
|
||||
next = c->next;
|
||||
next = ;
|
||||
c->mon = selmon;
|
||||
c->tags = selmon->tagset[selmon->seltags]; /* assign tags of target monitor */
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
if (c->isfullscreen) {
|
||||
setfullscreen(c, 0);
|
||||
setfullscreen(c, 1);
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (c->fakefullscreen != 1) {
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
}
|
||||
#elif !FAKEFULLSCREEN_PATCH
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,24 @@
|
||||
void
|
||||
togglefullscreen(const Arg *arg)
|
||||
{
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (selmon->sel->fakefullscreen) {
|
||||
selmon->sel->fakefullscreen = 0;
|
||||
if (selmon->sel->isfullscreen) {
|
||||
selmon->sel->isfullscreen = 0;
|
||||
}
|
||||
}
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (selmon->sel->fakefullscreen == 1) {
|
||||
selmon->sel->fakefullscreen = 2;
|
||||
if (selmon->sel->isfullscreen) {
|
||||
selmon->sel->isfullscreen = 0;
|
||||
}
|
||||
} else if (selmon->sel->fakefullscreen == 2) {
|
||||
selmon->sel->fakefullscreen = 0;
|
||||
togglefakefullscreen(NULL);
|
||||
arrange(selmon);
|
||||
return;
|
||||
}
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
|
||||
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||
if (!selmon->sel->isfullscreen)
|
||||
arrange(selmon);
|
||||
}
|
Loading…
Reference in New Issue
Block a user