mirror of
https://github.com/zoriya/dwm.git
synced 2025-12-06 07:16:17 +00:00
Lose fullscreen on focus change
This implements a separate losefullscreen function proposed by jzbor.
This commit is contained in:
15
dwm.c
15
dwm.c
@@ -238,6 +238,7 @@ static void grabkeys(void);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void keypress(XEvent *e);
|
||||
static void killclient(const Arg *arg);
|
||||
static void losefullscreen(Client *sel, Client *next);
|
||||
static void manage(Window w, XWindowAttributes *wa);
|
||||
static void mappingnotify(XEvent *e);
|
||||
static void maprequest(XEvent *e);
|
||||
@@ -1133,6 +1134,7 @@ focusstack(const Arg *arg)
|
||||
c = i;
|
||||
}
|
||||
if (c) {
|
||||
losefullscreen(selmon->sel, c);
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
}
|
||||
@@ -1303,6 +1305,15 @@ killclient(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
losefullscreen(Client *sel, Client *next)
|
||||
{
|
||||
if (!sel || !next)
|
||||
return;
|
||||
if (sel->isfullscreen && ISVISIBLE(sel) && sel->mon == next->mon && !next->isfloating)
|
||||
setfullscreen(sel, 0);
|
||||
}
|
||||
|
||||
void
|
||||
manage(Window w, XWindowAttributes *wa)
|
||||
{
|
||||
@@ -1357,8 +1368,10 @@ manage(Window w, XWindowAttributes *wa)
|
||||
(unsigned char *) &(c->win), 1);
|
||||
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
|
||||
setclientstate(c, NormalState);
|
||||
if (c->mon == selmon)
|
||||
if (c->mon == selmon) {
|
||||
losefullscreen(selmon->sel, c);
|
||||
unfocus(selmon->sel, 0);
|
||||
}
|
||||
c->mon->sel = c;
|
||||
arrange(c->mon);
|
||||
XMapWindow(dpy, c->win);
|
||||
|
||||
Reference in New Issue
Block a user