commit 412e6ea94bef41a731ce33a846d407d98e05121a
parent 6e486267fad75e51b98d78e738746a0285c1ad6d
Author: Britton Leo Kerin <britton.kerin@gmail.com>
Date: Fri, 15 Jul 2016 14:44:00 -0800
Fixed patch to apply correctly to 6.1
Diffstat:
1 file changed, 62 insertions(+), 60 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-dwmfifo-6.1.diff b/dwm.suckless.org/patches/dwm-dwmfifo-6.1.diff
@@ -1,8 +1,8 @@
diff --git a/config.def.h b/config.def.h
-index 875885b..c0a01fa 100644
+index 7054c06..9f4ef79 100644
--- a/config.def.h
+++ b/config.def.h
-@@ -108,3 +108,65 @@ static Button buttons[] = {
+@@ -111,3 +111,65 @@ static Button buttons[] = {
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
@@ -69,7 +69,7 @@ index 875885b..c0a01fa 100644
+ { "toggletag9", toggletag, {.ui = 1 << 8} },
+};
diff --git a/dwm.c b/dwm.c
-index 1bbb4b3..cd7ddd1 100644
+index 0362114..194c3e9 100644
--- a/dwm.c
+++ b/dwm.c
@@ -21,6 +21,7 @@
@@ -78,8 +78,8 @@ index 1bbb4b3..cd7ddd1 100644
#include <errno.h>
+#include <fcntl.h>
#include <locale.h>
- #include <stdarg.h>
#include <signal.h>
+ #include <stdarg.h>
@@ -28,6 +29,8 @@
#include <stdlib.h>
#include <string.h>
@@ -89,7 +89,7 @@ index 1bbb4b3..cd7ddd1 100644
#include <sys/types.h>
#include <sys/wait.h>
#include <X11/cursorfont.h>
-@@ -140,6 +143,12 @@ typedef struct {
+@@ -141,6 +144,12 @@ typedef struct {
int monitor;
} Rule;
@@ -101,8 +101,8 @@ index 1bbb4b3..cd7ddd1 100644
+
/* function declarations */
static void applyrules(Client *c);
- static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
-@@ -161,9 +170,11 @@ static void destroynotify(XEvent *e);
+ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
+@@ -162,9 +171,11 @@ static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
@@ -114,15 +114,15 @@ index 1bbb4b3..cd7ddd1 100644
static void expose(XEvent *e);
static void focus(Client *c);
static void focusin(XEvent *e);
-@@ -266,6 +277,7 @@ static Drw *drw;
- static Fnt *fnt;
+@@ -266,6 +277,7 @@ static Display *dpy;
+ static Drw *drw;
static Monitor *mons, *selmon;
static Window root;
+static int fifofd;
/* configuration, allows nested code to access above variables */
#include "config.h"
-@@ -485,6 +497,7 @@ cleanup(void) {
+@@ -490,6 +502,7 @@ cleanup(void)
XSync(dpy, False);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
@@ -130,33 +130,33 @@ index 1bbb4b3..cd7ddd1 100644
}
void
-@@ -691,6 +704,25 @@ dirtomon(int dir) {
+@@ -702,6 +715,25 @@ dirtomon(int dir)
}
void
+dispatchcmd(void)
+{
-+ int i;
-+ char buf[BUFSIZ];
-+ ssize_t n;
++ int i;
++ char buf[BUFSIZ];
++ ssize_t n;
+
-+ n = read(fifofd, buf, sizeof(buf) - 1);
-+ if (n == -1)
-+ die("Failed to read from DWM fifo\n");
-+ buf[n] = '\0';
-+ for (i = 0; i < LENGTH(commands); i++) {
-+ if (strcmp(commands[i].name, buf) == 0) {
-+ commands[i].func(&commands[i].arg);
-+ break;
-+ }
-+ }
++ n = read(fifofd, buf, sizeof(buf) - 1);
++ if (n == -1)
++ die("Failed to read from DWM fifo\n");
++ buf[n] = '\0';
++ for (i = 0; i < LENGTH(commands); i++) {
++ if (strcmp(commands[i].name, buf) == 0) {
++ commands[i].func(&commands[i].arg);
++ break;
++ }
++ }
+}
+
+void
- drawbar(Monitor *m) {
- int x, xx, w;
- unsigned int i, occ = 0, urg = 0;
-@@ -768,6 +800,12 @@ enternotify(XEvent *e) {
+ drawbar(Monitor *m)
+ {
+ int x, xx, w, dx;
+@@ -781,6 +813,12 @@ enternotify(XEvent *e)
focus(c);
}
@@ -167,43 +167,45 @@ index 1bbb4b3..cd7ddd1 100644
+}
+
void
- expose(XEvent *e) {
- Monitor *m;
-@@ -1341,11 +1379,30 @@ restack(Monitor *m) {
- void
- run(void) {
+ expose(XEvent *e)
+ {
+@@ -1390,11 +1428,30 @@ void
+ run(void)
+ {
XEvent ev;
-+ fd_set rfds;
-+ int n;
-+ int dpyfd, maxfd;
- /* main event loop */
- XSync(dpy, False);
-- while(running && !XNextEvent(dpy, &ev))
-- if(handler[ev.type])
+- /* main event loop */
+- XSync(dpy, False);
+- while (running && !XNextEvent(dpy, &ev))
+- if (handler[ev.type])
- handler[ev.type](&ev); /* call handler */
-+ dpyfd = ConnectionNumber(dpy);
-+ maxfd = fifofd;
-+ if (dpyfd > maxfd)
-+ maxfd = dpyfd;
-+ maxfd++;
-+ while (running) {
-+ FD_ZERO(&rfds);
-+ FD_SET(fifofd, &rfds);
-+ FD_SET(dpyfd, &rfds);
-+ n = select(maxfd, &rfds, NULL, NULL, NULL);
-+ if (n > 0) {
-+ if (FD_ISSET(fifofd, &rfds))
-+ dispatchcmd();
-+ if (FD_ISSET(dpyfd, &rfds))
-+ while (XCheckIfEvent(dpy, &ev, evpredicate, NULL))
-+ if (handler[ev.type])
-+ handler[ev.type](&ev); /* call handler */
-+ }
-+ }
++ fd_set rfds;
++ int n;
++ int dpyfd, maxfd;
++ /* main event loop */
++ XSync(dpy, False);
++ dpyfd = ConnectionNumber(dpy);
++ maxfd = fifofd;
++ if (dpyfd > maxfd)
++ maxfd = dpyfd;
++ maxfd++;
++ while (running) {
++ FD_ZERO(&rfds);
++ FD_SET(fifofd, &rfds);
++ FD_SET(dpyfd, &rfds);
++ n = select(maxfd, &rfds, NULL, NULL, NULL);
++ if (n > 0) {
++ if (FD_ISSET(fifofd, &rfds))
++ dispatchcmd();
++ if (FD_ISSET(dpyfd, &rfds))
++ while (XCheckIfEvent(dpy, &ev, evpredicate, NULL))
++ if (handler[ev.type])
++ handler[ev.type](&ev); /* call handler */
++ }
++ }
}
void
-@@ -1543,6 +1600,9 @@ setup(void) {
+@@ -1601,6 +1658,9 @@ setup(void)
XSelectInput(dpy, root, wa.event_mask);
grabkeys();
focus(NULL);