From 068ae33164a7766148066240f5d0daf25e8a75f6 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 18 May 2020 03:33:35 -0400 Subject: nitpicking --- jsmond.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/jsmond.c b/jsmond.c index d57f626..b0d6d6d 100644 --- a/jsmond.c +++ b/jsmond.c @@ -461,7 +461,7 @@ void daemonize(void) { void init_inotify(void) { inotify_fd = inotify_init1(IN_NONBLOCK); - if( inotify_fd < 0) { + if(inotify_fd < 0) { fprintf(stderr, "%s: inotify_init1() failed: %s", self, strerror(errno)); exit(1); @@ -470,7 +470,7 @@ void init_inotify(void) { if(debug) fprintf(stderr, "inotify_init1() returned %d\n", inotify_fd); watch_fd = inotify_add_watch(inotify_fd, event_dir, IN_CREATE | IN_DELETE); - if( watch_fd < 0) { + if(watch_fd < 0) { fprintf(stderr, "%s: inotify_add_watch() failed: %s", self, strerror(errno)); exit(1); @@ -496,6 +496,14 @@ void connect_to_x(void) { } } +/* XXX: XKeycodeToKeysym() is deprecated. I must learn XKB. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +KeySym get_keysym(int i) { + return XKeycodeToKeysym(xdisp, i, 0); +} +#pragma GCC diagnostic pop + /* the goggles, they do nothing! */ void find_keycode() { int i, min_code = 0, max_code = 0; @@ -505,13 +513,8 @@ void find_keycode() { if(debug) fprintf(stderr, "XDisplayKeycodes min %d, max %d\n", min_code, max_code); - /* XXX: XKeycodeToKeysym() is deprecated. I must learn XKB. */ for(i = min_code; i <= max_code; i++) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - KeySym ks = XKeycodeToKeysym(xdisp, i, 0); -#pragma GCC diagnostic pop - if(ks == NoSymbol) { + if(get_keysym(i) == NoSymbol) { keycode = i; if(debug) fprintf(stderr, "using keycode %d\n", keycode); break; @@ -524,7 +527,6 @@ void find_keycode() { self, FALLBACK_KEYCODE); keycode = FALLBACK_KEYCODE; } - } void init_x(void) { -- cgit v1.2.3