summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-05-07 13:12:41 +0200
committerAnselm R. Garbe <arg@suckless.org>2007-05-07 13:12:41 +0200
commitf9e7a330190259a54449837a16c2af66fa823d30 (patch)
treea85452d878a8527bdcac2cefd86878271ccd0cab
parentAdded tag 4.0 for changeset 018c38468422 (diff)
downloaddwm-f9e7a330190259a54449837a16c2af66fa823d30.tar.gz
dwm-f9e7a330190259a54449837a16c2af66fa823d30.zip
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Diffstat (limited to '')
-rw-r--r--event.c19
-rw-r--r--layout.c5
-rw-r--r--main.c3
3 files changed, 25 insertions, 2 deletions
diff --git a/event.c b/event.c
index 72e9ccd..c89850a 100644
--- a/event.c
+++ b/event.c
@@ -208,6 +208,24 @@ configurerequest(XEvent *e) {
208} 208}
209 209
210static void 210static void
211configurenotify(XEvent *e) {
212 Client *c;
213 XConfigureEvent *ev = &e->xconfigure;
214 XWindowChanges wc;
215
216 if (ev->window == root && (ev->width != sw || ev->height != sh)) {
217 sw = ev->width;
218 sh = ev->height;
219 wah = sh - bh;
220 waw = sw;
221 XFreePixmap(dpy, dc.drawable);
222 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
223 XResizeWindow(dpy, barwin, sw, bh);
224 lt->arrange();
225 }
226}
227
228static void
211destroynotify(XEvent *e) { 229destroynotify(XEvent *e) {
212 Client *c; 230 Client *c;
213 XDestroyWindowEvent *ev = &e->xdestroywindow; 231 XDestroyWindowEvent *ev = &e->xdestroywindow;
@@ -333,6 +351,7 @@ unmapnotify(XEvent *e) {
333void (*handler[LASTEvent]) (XEvent *) = { 351void (*handler[LASTEvent]) (XEvent *) = {
334 [ButtonPress] = buttonpress, 352 [ButtonPress] = buttonpress,
335 [ConfigureRequest] = configurerequest, 353 [ConfigureRequest] = configurerequest,
354 [ConfigureNotify] = configurenotify,
336 [DestroyNotify] = destroynotify, 355 [DestroyNotify] = destroynotify,
337 [EnterNotify] = enternotify, 356 [EnterNotify] = enternotify,
338 [LeaveNotify] = leavenotify, 357 [LeaveNotify] = leavenotify,
diff --git a/layout.c b/layout.c
index 6eae290..8005894 100644
--- a/layout.c
+++ b/layout.c
@@ -46,7 +46,10 @@ tile(void) {
46 nw = tw - 2 * c->border; 46 nw = tw - 2 * c->border;
47 if(th > 2 * c->border) { 47 if(th > 2 * c->border) {
48 ny += (i - nmaster) * th; 48 ny += (i - nmaster) * th;
49 nh = th - 2 * c->border; 49 if(i == n - 1)
50 nh = wah - ny - 2 * c->border;
51 else
52 nh = th - 2 * c->border;
50 } 53 }
51 else /* fallback if th <= 2 * c->border */ 54 else /* fallback if th <= 2 * c->border */
52 nh = wah - 2 * c->border; 55 nh = wah - 2 * c->border;
diff --git a/main.c b/main.c
index 7d3479e..63f791f 100644
--- a/main.c
+++ b/main.c
@@ -163,9 +163,10 @@ setup(void) {
163 XFreeModifiermap(modmap); 163 XFreeModifiermap(modmap);
164 /* select for events */ 164 /* select for events */
165 wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask 165 wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
166 | EnterWindowMask | LeaveWindowMask; 166 | EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
167 wa.cursor = cursor[CurNormal]; 167 wa.cursor = cursor[CurNormal];
168 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); 168 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
169 XSelectInput(dpy, root, wa.event_mask);
169 grabkeys(); 170 grabkeys();
170 compileregs(); 171 compileregs();
171 for(ntags = 0; tags[ntags]; ntags++); 172 for(ntags = 0; tags[ntags]; ntags++);