mirror of https://github.com/bakkeby/patches
losefullscreen: adding jzbor's variant
parent
22bbbaa8e8
commit
86e173818e
@ -1,98 +1,61 @@
|
|||||||
From b0f56cb0228afc5bda80ea233d1cffe1a19f292f Mon Sep 17 00:00:00 2001
|
From 9b4221ed47a290c77b90e589903e4bc7aeccbc4f Mon Sep 17 00:00:00 2001
|
||||||
From: bakkeby <bakkeby@gmail.com>
|
From: bakkeby <bakkeby@gmail.com>
|
||||||
Date: Tue, 7 Apr 2020 11:40:30 +0200
|
Date: Tue, 7 Apr 2020 11:40:30 +0200
|
||||||
Subject: [PATCH] Lose fullscreen on focus change
|
Subject: [PATCH] Lose fullscreen on focus change
|
||||||
|
|
||||||
|
This implements a separate losefullscreen function proposed by jzbor.
|
||||||
---
|
---
|
||||||
dwm.c | 20 ++++++++++++++------
|
dwm.c | 15 ++++++++++++++-
|
||||||
1 file changed, 14 insertions(+), 6 deletions(-)
|
1 file changed, 14 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/dwm.c b/dwm.c
|
diff --git a/dwm.c b/dwm.c
|
||||||
index 4465af1..a300ba0 100644
|
index 4465af1..277eb48 100644
|
||||||
--- a/dwm.c
|
--- a/dwm.c
|
||||||
+++ b/dwm.c
|
+++ b/dwm.c
|
||||||
@@ -418,15 +418,16 @@ buttonpress(XEvent *e)
|
@@ -177,6 +177,7 @@ static void grabkeys(void);
|
||||||
{
|
static void incnmaster(const Arg *arg);
|
||||||
unsigned int i, x, click;
|
static void keypress(XEvent *e);
|
||||||
Arg arg = {0};
|
static void killclient(const Arg *arg);
|
||||||
- Client *c;
|
+static void losefullscreen(Client *sel, Client *next);
|
||||||
+ Client *c, *sel;
|
static void manage(Window w, XWindowAttributes *wa);
|
||||||
Monitor *m;
|
static void mappingnotify(XEvent *e);
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
static void maprequest(XEvent *e);
|
||||||
|
@@ -850,6 +851,7 @@ focusstack(const Arg *arg)
|
||||||
click = ClkRootWin;
|
c = i;
|
||||||
/* focus monitor if necessary */
|
}
|
||||||
if ((m = wintomon(ev->window)) && m != selmon) {
|
if (c) {
|
||||||
- unfocus(selmon->sel, 1);
|
+ losefullscreen(selmon->sel, c);
|
||||||
+ sel = selmon->sel;
|
focus(c);
|
||||||
selmon = m;
|
restack(selmon);
|
||||||
+ unfocus(sel, 1);
|
}
|
||||||
focus(NULL);
|
@@ -1014,6 +1016,15 @@ killclient(const Arg *arg)
|
||||||
}
|
}
|
||||||
if (ev->window == selmon->barwin) {
|
|
||||||
@@ -754,7 +755,7 @@ drawbars(void)
|
|
||||||
void
|
|
||||||
enternotify(XEvent *e)
|
|
||||||
{
|
|
||||||
- Client *c;
|
|
||||||
+ Client *c, *sel;
|
|
||||||
Monitor *m;
|
|
||||||
XCrossingEvent *ev = &e->xcrossing;
|
|
||||||
|
|
||||||
@@ -763,8 +764,9 @@ enternotify(XEvent *e)
|
|
||||||
c = wintoclient(ev->window);
|
|
||||||
m = c ? c->mon : wintomon(ev->window);
|
|
||||||
if (m != selmon) {
|
|
||||||
- unfocus(selmon->sel, 1);
|
|
||||||
+ sel = selmon->sel;
|
|
||||||
selmon = m;
|
|
||||||
+ unfocus(sel, 1);
|
|
||||||
} else if (!c || c == selmon->sel)
|
|
||||||
return;
|
|
||||||
focus(c);
|
|
||||||
@@ -819,13 +821,15 @@ void
|
|
||||||
focusmon(const Arg *arg)
|
|
||||||
{
|
|
||||||
Monitor *m;
|
|
||||||
+ Client *sel;
|
|
||||||
|
|
||||||
if (!mons->next)
|
|
||||||
return;
|
|
||||||
if ((m = dirtomon(arg->i)) == selmon)
|
|
||||||
return;
|
|
||||||
- unfocus(selmon->sel, 0);
|
|
||||||
+ sel = selmon->sel;
|
|
||||||
selmon = m;
|
|
||||||
+ unfocus(sel, 0);
|
|
||||||
focus(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1120,13 +1124,15 @@ motionnotify(XEvent *e)
|
+void
|
||||||
{
|
+losefullscreen(Client *sel, Client *next)
|
||||||
static Monitor *mon = NULL;
|
+{
|
||||||
Monitor *m;
|
+ if (!sel || !next)
|
||||||
+ Client *sel;
|
+ return;
|
||||||
XMotionEvent *ev = &e->xmotion;
|
+ if (sel->isfullscreen && ISVISIBLE(sel) && sel->mon == next->mon && !next->isfloating)
|
||||||
|
+ setfullscreen(sel, 0);
|
||||||
if (ev->window != root)
|
+}
|
||||||
return;
|
+
|
||||||
if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
void
|
||||||
- unfocus(selmon->sel, 1);
|
manage(Window w, XWindowAttributes *wa)
|
||||||
+ sel = selmon->sel;
|
|
||||||
selmon = m;
|
|
||||||
+ unfocus(sel, 1);
|
|
||||||
focus(NULL);
|
|
||||||
}
|
|
||||||
mon = m;
|
|
||||||
@@ -1751,6 +1757,8 @@ unfocus(Client *c, int setfocus)
|
|
||||||
{
|
{
|
||||||
if (!c)
|
@@ -1068,8 +1079,10 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
return;
|
(unsigned char *) &(c->win), 1);
|
||||||
+ if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon)
|
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
|
||||||
+ setfullscreen(c, 0);
|
setclientstate(c, NormalState);
|
||||||
grabbuttons(c, 0);
|
- if (c->mon == selmon)
|
||||||
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
|
+ if (c->mon == selmon) {
|
||||||
if (setfocus) {
|
+ losefullscreen(selmon->sel, c);
|
||||||
|
unfocus(selmon->sel, 0);
|
||||||
|
+ }
|
||||||
|
c->mon->sel = c;
|
||||||
|
arrange(c->mon);
|
||||||
|
XMapWindow(dpy, c->win);
|
||||||
--
|
--
|
||||||
2.19.1
|
2.19.1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue