Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-smartborders-6.2.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-smartborders-6.2.diff (7570B)
---
1 diff --git a/dwm.c b/dwm.c
2 index 4465af1..3c94e4b 100644
3 --- a/dwm.c
4 +++ b/dwm.c
5 @@ -143,7 +143,7 @@ typedef struct {
6
7 /* function declarations */
8 static void applyrules(Client *c);
9 -static int applysizehints(Client *c, int *x, int *y, int *w, int *h, in…
10 +static int applysizehints(Client *c, int *x, int *y, int *w, int *h, in…
11 static void arrange(Monitor *m);
12 static void arrangemon(Monitor *m);
13 static void attach(Client *c);
14 @@ -188,8 +188,8 @@ static void pop(Client *);
15 static void propertynotify(XEvent *e);
16 static void quit(const Arg *arg);
17 static Monitor *recttomon(int x, int y, int w, int h);
18 -static void resize(Client *c, int x, int y, int w, int h, int interact);
19 -static void resizeclient(Client *c, int x, int y, int w, int h);
20 +static void resize(Client *c, int x, int y, int w, int h, int bw, int i…
21 +static void resizeclient(Client *c, int x, int y, int w, int h, int bw);
22 static void resizemouse(const Arg *arg);
23 static void restack(Monitor *m);
24 static void run(void);
25 @@ -312,7 +312,7 @@ applyrules(Client *c)
26 }
27
28 int
29 -applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
30 +applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int …
31 {
32 int baseismin;
33 Monitor *m = c->mon;
34 @@ -325,18 +325,18 @@ applysizehints(Client *c, int *x, int *y, int *w, …
35 *x = sw - WIDTH(c);
36 if (*y > sh)
37 *y = sh - HEIGHT(c);
38 - if (*x + *w + 2 * c->bw < 0)
39 + if (*x + *w + 2 * *bw < 0)
40 *x = 0;
41 - if (*y + *h + 2 * c->bw < 0)
42 + if (*y + *h + 2 * *bw < 0)
43 *y = 0;
44 } else {
45 if (*x >= m->wx + m->ww)
46 *x = m->wx + m->ww - WIDTH(c);
47 if (*y >= m->wy + m->wh)
48 *y = m->wy + m->wh - HEIGHT(c);
49 - if (*x + *w + 2 * c->bw <= m->wx)
50 + if (*x + *w + 2 * *bw <= m->wx)
51 *x = m->wx;
52 - if (*y + *h + 2 * c->bw <= m->wy)
53 + if (*y + *h + 2 * *bw <= m->wy)
54 *y = m->wy;
55 }
56 if (*h < bh)
57 @@ -374,7 +374,7 @@ applysizehints(Client *c, int *x, int *y, int *w, in…
58 if (c->maxh)
59 *h = MIN(*h, c->maxh);
60 }
61 - return *x != c->x || *y != c->y || *w != c->w || *h != c->h;
62 + return *x != c->x || *y != c->y || *w != c->w || *h != c->h || …
63 }
64
65 void
66 @@ -394,9 +394,16 @@ arrange(Monitor *m)
67 void
68 arrangemon(Monitor *m)
69 {
70 + Client *c;
71 +
72 strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbo…
73 if (m->lt[m->sellt]->arrange)
74 m->lt[m->sellt]->arrange(m);
75 + else
76 + /* <>< case; rather than providing an arrange function …
77 + for (c = selmon->clients; c; c = c->next)
78 + if (ISVISIBLE(c) && c->bw == 0)
79 + resize(c, c->x, c->y, c->w - 2*borderpx…
80 }
81
82 void
83 @@ -566,7 +573,7 @@ configurenotify(XEvent *e)
84 for (m = mons; m; m = m->next) {
85 for (c = m->clients; c; c = c->next)
86 if (c->isfullscreen)
87 - resizeclient(c, m->mx, …
88 + resizeclient(c, m->mx, …
89 XMoveResizeWindow(dpy, m->barwin, m->wx…
90 }
91 focus(NULL);
92 @@ -1112,7 +1119,7 @@ monocle(Monitor *m)
93 if (n > 0) /* override layout symbol */
94 snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
95 for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
96 - resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * …
97 + resize(c, m->wx, m->wy, m->ww, m->wh, 0, 0);
98 }
99
100 void
101 @@ -1180,7 +1187,7 @@ movemouse(const Arg *arg)
102 && (abs(nx - c->x) > snap || abs(ny - c->y) > s…
103 togglefloating(NULL);
104 if (!selmon->lt[selmon->sellt]->arrange || c->i…
105 - resize(c, nx, ny, c->w, c->h, 1);
106 + resize(c, nx, ny, c->w, c->h, c->bw, 1);
107 break;
108 }
109 } while (ev.type != ButtonRelease);
110 @@ -1266,14 +1273,14 @@ recttomon(int x, int y, int w, int h)
111 }
112
113 void
114 -resize(Client *c, int x, int y, int w, int h, int interact)
115 +resize(Client *c, int x, int y, int w, int h, int bw, int interact)
116 {
117 - if (applysizehints(c, &x, &y, &w, &h, interact))
118 - resizeclient(c, x, y, w, h);
119 + if (applysizehints(c, &x, &y, &w, &h, &bw, interact))
120 + resizeclient(c, x, y, w, h, bw);
121 }
122
123 void
124 -resizeclient(Client *c, int x, int y, int w, int h)
125 +resizeclient(Client *c, int x, int y, int w, int h, int bw)
126 {
127 XWindowChanges wc;
128
129 @@ -1281,7 +1288,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
130 c->oldy = c->y; c->y = wc.y = y;
131 c->oldw = c->w; c->w = wc.width = w;
132 c->oldh = c->h; c->h = wc.height = h;
133 - wc.border_width = c->bw;
134 + c->oldbw = c->bw; c->bw = wc.border_width = bw;
135 XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorder…
136 configure(c);
137 XSync(dpy, False);
138 @@ -1330,7 +1337,7 @@ resizemouse(const Arg *arg)
139 togglefloating(NULL);
140 }
141 if (!selmon->lt[selmon->sellt]->arrange || c->i…
142 - resize(c, c->x, c->y, nw, nh, 1);
143 + resize(c, c->x, c->y, nw, nh, c->bw, 1);
144 break;
145 }
146 } while (ev.type != ButtonRelease);
147 @@ -1477,22 +1484,20 @@ setfullscreen(Client *c, int fullscreen)
148 PropModeReplace, (unsigned char*)&netatom[NetWM…
149 c->isfullscreen = 1;
150 c->oldstate = c->isfloating;
151 - c->oldbw = c->bw;
152 - c->bw = 0;
153 c->isfloating = 1;
154 - resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->…
155 + resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->…
156 XRaiseWindow(dpy, c->win);
157 } else if (!fullscreen && c->isfullscreen){
158 XChangeProperty(dpy, c->win, netatom[NetWMState], XA_AT…
159 PropModeReplace, (unsigned char*)0, 0);
160 c->isfullscreen = 0;
161 c->isfloating = c->oldstate;
162 - c->bw = c->oldbw;
163 c->x = c->oldx;
164 c->y = c->oldy;
165 c->w = c->oldw;
166 c->h = c->oldh;
167 - resizeclient(c, c->x, c->y, c->w, c->h);
168 + c->bw = c->oldbw;
169 + resizeclient(c, c->x, c->y, c->w, c->h, c->bw);
170 arrange(c->mon);
171 }
172 }
173 @@ -1619,7 +1624,7 @@ showhide(Client *c)
174 /* show clients top down */
175 XMoveWindow(dpy, c->win, c->x, c->y);
176 if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloati…
177 - resize(c, c->x, c->y, c->w, c->h, 0);
178 + resize(c, c->x, c->y, c->w, c->h, c->bw, 0);
179 showhide(c->snext);
180 } else {
181 /* hide clients bottom up */
182 @@ -1673,13 +1678,17 @@ tagmon(const Arg *arg)
183 void
184 tile(Monitor *m)
185 {
186 - unsigned int i, n, h, mw, my, ty;
187 + unsigned int i, n, h, mw, my, ty, bw;
188 Client *c;
189
190 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next…
191 if (n == 0)
192 return;
193
194 + if (n == 1)
195 + bw = 0;
196 + else
197 + bw = borderpx;
198 if (n > m->nmaster)
199 mw = m->nmaster ? m->ww * m->mfact : 0;
200 else
201 @@ -1687,11 +1696,11 @@ tile(Monitor *m)
202 for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttil…
203 if (i < m->nmaster) {
204 h = (m->wh - my) / (MIN(n, m->nmaster) - i);
205 - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h …
206 + resize(c, m->wx, m->wy + my, mw - 2*bw, h - 2*b…
207 my += HEIGHT(c);
208 } else {
209 h = (m->wh - ty) / (n - i);
210 - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - …
211 + resize(c, m->wx + mw, m->wy + ty, m->ww - mw - …
212 ty += HEIGHT(c);
213 }
214 }
215 @@ -1715,7 +1724,9 @@ togglefloating(const Arg *arg)
216 selmon->sel->isfloating = !selmon->sel->isfloating || selmon->s…
217 if (selmon->sel->isfloating)
218 resize(selmon->sel, selmon->sel->x, selmon->sel->y,
219 - selmon->sel->w, selmon->sel->h, 0);
220 + selmon->sel->w - 2 * (borderpx - selmon->sel->b…
221 + selmon->sel->h - 2 * (borderpx - selmon->sel->b…
222 + borderpx, 0);
223 arrange(selmon);
224 }
225
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.