tDon't keep state for X display - spoon - dwm status utility (2f30 fork)
(HTM) git clone git://src.adamsgaard.dk/spoon
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit dc742d20742b5b09431e66db6f726c86fdc95e47
(DIR) parent 26f4036b31ba4d4b96fb8f103fdc30a897438e46
(HTM) Author: lostd <lostd@2f30.org>
Date: Thu, 6 Apr 2017 10:52:28 +0300
Don't keep state for X display
Diffstat:
M key.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/key.c b/key.c
t@@ -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;
t@@ -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) {