You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
patches/dwm/dwm-losefullscreen-6.2.diff

62 lines
1.6 KiB
Diff

From 9b4221ed47a290c77b90e589903e4bc7aeccbc4f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 11:40:30 +0200
Subject: [PATCH] Lose fullscreen on focus change
This implements a separate losefullscreen function proposed by jzbor.
---
dwm.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
index 4465af1..277eb48 100644
--- a/dwm.c
+++ b/dwm.c
@@ -177,6 +177,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);
@@ -850,6 +851,7 @@ focusstack(const Arg *arg)
c = i;
}
if (c) {
+ losefullscreen(selmon->sel, c);
focus(c);
restack(selmon);
}
@@ -1014,6 +1016,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)
{
@@ -1068,8 +1079,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);
--
2.19.1