aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-19 15:23:35 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-19 15:23:35 +0100
commite9c49ddd7a021e99dc2e7518736211ab5bc8cf2c (patch)
tree53a1e310410111719d254fc84b3461bf9f83e80a
parentf8415019d4edc1cd4f310adb256e6656e85bfe75 (diff)
downloaddwm-e9c49ddd7a021e99dc2e7518736211ab5bc8cf2c.tar
dwm-e9c49ddd7a021e99dc2e7518736211ab5bc8cf2c.tar.gz
dwm-e9c49ddd7a021e99dc2e7518736211ab5bc8cf2c.tar.bz2
removed procevent, more refactoring
-rw-r--r--dwm.h1
-rw-r--r--event.c11
-rw-r--r--main.c8
3 files changed, 6 insertions, 14 deletions
diff --git a/dwm.h b/dwm.h
index 2ec0bf7..a96eec1 100644
--- a/dwm.h
+++ b/dwm.h
@@ -115,7 +115,6 @@ extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is
/* event.c */
extern void grabkeys(void); /* grab all keys defined in config.h */
-extern void procevent(void); /* process pending X events */
/* main.c */
extern void drawstatus(void); /* draw the bar */
diff --git a/event.c b/event.c
index dfe2552..4b3c1e3 100644
--- a/event.c
+++ b/event.c
@@ -368,14 +368,3 @@ grabkeys(void) {
GrabModeAsync, GrabModeAsync);
}
}
-
-void
-procevent(void) {
- XEvent ev;
-
- while(XPending(dpy)) {
- XNextEvent(dpy, &ev);
- if(handler[ev.type])
- (handler[ev.type])(&ev); /* call handler */
- }
-}
diff --git a/main.c b/main.c
index 77ce0df..3453b59 100644
--- a/main.c
+++ b/main.c
@@ -379,6 +379,7 @@ main(int argc, char *argv[]) {
char *p;
int r, xfd;
fd_set rd;
+ XEvent ev;
if(argc == 2 && !strncmp("-v", argv[1], 3)) {
fputs("dwm-"VERSION", (C)opyright MMVI-MMVII Anselm R. Garbe\n", stdout);
@@ -411,7 +412,6 @@ main(int argc, char *argv[]) {
/* main event loop, also reads status text from stdin */
XSync(dpy, False);
- procevent();
readin = True;
while(running) {
FD_ZERO(&rd);
@@ -443,7 +443,11 @@ main(int argc, char *argv[]) {
drawstatus();
}
if(FD_ISSET(xfd, &rd))
- procevent();
+ while(XPending(dpy)) {
+ XNextEvent(dpy, &ev);
+ if(handler[ev.type])
+ (handler[ev.type])(&ev); /* call handler */
+ }
}
cleanup();
XCloseDisplay(dpy);