commit dc742d20742b5b09431e66db6f726c86fdc95e47
parent 26f4036b31ba4d4b96fb8f103fdc30a897438e46
Author: lostd <lostd@2f30.org>
Date: Thu, 6 Apr 2017 10:52:28 +0300
Don't keep state for X display
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/key.c b/key.c
@@ -10,7 +10,7 @@
int
keyread(void *arg, char *buf, size_t len)
{
- static Display *dpy = NULL;
+ Display *dpy;
XModifierKeymap *map;
KeyCode keycode;
Window w1, w2;
@@ -21,12 +21,10 @@ keyread(void *arg, char *buf, size_t len)
int on;
int i;
+ dpy = XOpenDisplay(NULL);
if (dpy == NULL) {
- dpy = XOpenDisplay(NULL);
- if (dpy == NULL) {
- warnx("cannot open display");
- return -1;
- }
+ warnx("cannot open display");
+ return -1;
}
keycode = XKeysymToKeycode(dpy, key->sym);
if (keycode == NoSymbol) {