about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAcid Bong <acid-bong@cock.lt>2022-10-19 12:35:49 +0300
committerAcid Bong <acid-bong@cock.lt>2022-10-19 12:35:49 +0300
commit0a2bda286ed0233673cbede17d80d64a98eb996b (patch)
tree5abf1281f0b03c9e3adcb97d644704e92bba0ae3
parentdb183efa60a525cd245fa6ce477580faaf241f62 (diff)
downloaddwm-0a2bda286ed0233673cbede17d80d64a98eb996b.tar.gz
saving original ru_gaps patch
-rw-r--r--patches/dwm-ru-gaps-6.3.diff151
1 files changed, 151 insertions, 0 deletions
diff --git a/patches/dwm-ru-gaps-6.3.diff b/patches/dwm-ru-gaps-6.3.diff
new file mode 100644
index 0000000..8e83755
--- /dev/null
+++ b/patches/dwm-ru-gaps-6.3.diff
@@ -0,0 +1,151 @@
+From dee230eb56b95c5bc336ad5494675009e76830d1 Mon Sep 17 00:00:00 2001
+From: save196 <saverioturetta@protonmail.com>
+Date: Tue, 22 Mar 2022 22:10:05 +0200
+Subject: [PATCH] fixes and updated to work with dwm 6.3
+ version
+
+- Fix bug where windows moved incorrectly while dragged with the mouse
+  in the floating layout
+- Updated patch to work with dwm 6.3
+---
+ config.def.h |  4 ++++
+ dwm.c        | 57 ++++++++++++++++++++++++++++++++++++++++------------
+ 2 files changed, 48 insertions(+), 13 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index a2ac963..8f3da2b 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -2,6 +2,7 @@
+
+ /* appearance */
+ static const unsigned int borderpx  = 1;        /* border pixel of windows */
++static const int gappx     = 5;                 /* gaps between windows */
+ static const unsigned int snap      = 32;       /* snap pixel */
+ static const int showbar            = 1;        /* 0 means no bar */
+ static const int topbar             = 1;        /* 0 means bottom bar */
+@@ -85,6 +86,9 @@ static Key keys[] = {
+ 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
+ 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
+ 	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
++	{ MODKEY,                       XK_minus,  setgaps,        {.i = -5 } },
++	{ MODKEY,                       XK_equal,  setgaps,        {.i = +5 } },
++	{ MODKEY|ShiftMask,             XK_equal,  setgaps,        {.i = 0  } },
+ 	TAGKEYS(                        XK_1,                      0)
+ 	TAGKEYS(                        XK_2,                      1)
+ 	TAGKEYS(                        XK_3,                      2)
+diff --git a/dwm.c b/dwm.c
+index 5f16260..506bb1a 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -119,6 +119,7 @@ struct Monitor {
+ 	int by;               /* bar geometry */
+ 	int mx, my, mw, mh;   /* screen size */
+ 	int wx, wy, ww, wh;   /* window area  */
++	int gappx;            /* gaps between windows */
+ 	unsigned int seltags;
+ 	unsigned int sellt;
+ 	unsigned int tagset[2];
+@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
++static void setgaps(const Arg *arg);
+ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+ static void setup(void);
+@@ -640,6 +642,7 @@ createmon(void)
+ 	m->nmaster = nmaster;
+ 	m->showbar = showbar;
+ 	m->topbar = topbar;
++	m->gappx = gappx;
+ 	m->lt[0] = &layouts[0];
+ 	m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ 	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
+@@ -1287,6 +1290,15 @@ resizeclient(Client *c, int x, int y, int w, int h)
+ 	c->oldw = c->w; c->w = wc.width = w;
+ 	c->oldh = c->h; c->h = wc.height = h;
+ 	wc.border_width = c->bw;
++	if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
++	    || &monocle == c->mon->lt[c->mon->sellt]->arrange)
++	    && !c->isfullscreen && !c->isfloating
++	    && c->mon->lt[c->mon->sellt]->arrange)
++	{
++		c->w = wc.width += c->bw * 2;
++		c->h = wc.height += c->bw * 2;
++		wc.border_width = 0;
++	}
+ 	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ 	configure(c);
+ 	XSync(dpy, False);
+@@ -1502,6 +1514,16 @@ setfullscreen(Client *c, int fullscreen)
+ 	}
+ }
+
++void
++setgaps(const Arg *arg)
++{
++	if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
++		selmon->gappx = 0;
++	else
++		selmon->gappx += arg->i;
++	arrange(selmon);
++}
++
+ void
+ setlayout(const Arg *arg)
+ {
+@@ -1678,28 +1700,37 @@ tagmon(const Arg *arg)
+ void
+ tile(Monitor *m)
+ {
+-	unsigned int i, n, h, mw, my, ty;
++        unsigned int i, n, h, mw, my, ty, ns;
+ 	Client *c;
+
+ 	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ 	if (n == 0)
+ 		return;
++	if(n == 1){
++		c = nexttiled(m->clients);
++		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
++		return;
++	}
+
+-	if (n > m->nmaster)
++	if (n > m->nmaster) {
+ 		mw = m->nmaster ? m->ww * m->mfact : 0;
+-	else
+-		mw = m->ww;
+-	for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++		ns = m->nmaster > 0 ? 2 : 1;
++	}
++	else{
++		mw = m->ww - m->gappx;
++		ns = 1;
++	}
++	for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ 		if (i < m->nmaster) {
+-			h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+-			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
+-			if (my + HEIGHT(c) < m->wh)
+-				my += HEIGHT(c);
++			h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
++			resize(c, m->wx + m->gappx, m->wy + my, mw - 2*c->bw - m->gappx*(5-ns)/2, h - 2*c->bw, 0);
++			if(my + HEIGHT(c) + m->gappx < m->wh)
++				my += HEIGHT(c) + m->gappx;
+ 		} else {
+-			h = (m->wh - ty) / (n - i);
+-			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
+-			if (ty + HEIGHT(c) < m->wh)
+-				ty += HEIGHT(c);
++			h = (m->wh - ty) / (n - i) - m->gappx;
++			resize(c, m->wx + mw + m->gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - m->gappx*(5-ns)/2, h - 2*c->bw, 0);
++			if(ty + HEIGHT(c) + m->gappx < m->wh)
++				ty += HEIGHT(c) + m->gappx;
+ 		}
+ }
+
+--
+2.35.1
+