commit fe0dcf4e2d945f528e2af9cbfc9d8eadb3b571bd from: Omar Polo date: Tue Sep 29 13:27:21 2020 UTC add an error handler the default error handler violates the pledge "stdio" by trying to read (and possibly also write after) some files. Also, I don't like my program to be randomly killed if I try to get class hints on a window that doesn't have any. commit - e573cb09321087dc40dc088a53a9e079a31ecfe5 commit + fe0dcf4e2d945f528e2af9cbfc9d8eadb3b571bd blob - 9db19aa52b32d963822a25e3b440f17cfad7e25c blob + 4deaff27e6ab5a1a8e4d28ce92a4b64fc10cd205 --- star-platinum.c +++ star-platinum.c @@ -161,6 +161,8 @@ main(int argc, char **argv) return 1; } + XSetErrorHandler(&error_handler); + root = DefaultRootWindow(d); /* grab all the keys */ @@ -195,6 +197,13 @@ main(int argc, char **argv) /* xlib */ +int +error_handler(Display *d, XErrorEvent *e) +{ + fprintf(stderr, "Xlib error %d\n", e->type); + return 1; +} + /* TODO: it should grab ALL POSSIBLE COMBINATIONS of `ignored_modifiers`! */ void grabkey(struct key k) blob - 445302b1c862912606adc693d2f237a3a02060b3 blob + 7949d625573a5c7b59f6c7643c44965fdfd74716 --- star-platinum.h +++ star-platinum.h @@ -83,6 +83,7 @@ void process_event(struct group*, XKeyEvent*); int group_match(struct group*, Window); /* xlib-related */ +int error_handler(Display*, XErrorEvent*); void grabkey(struct key); KeySym keycode_to_keysym(unsigned int); Window focused_window();