aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2020-05-18 03:33:35 -0400
committerB. Watson <yalhcru@gmail.com>2020-05-18 03:33:35 -0400
commit068ae33164a7766148066240f5d0daf25e8a75f6 (patch)
tree956b77bcd3bb6c35b13495068ffad6c92360ea8c
parentc4afb1d2e5e9d1e819af0cb3615ba4642d0ece72 (diff)
downloadunsaver-068ae33164a7766148066240f5d0daf25e8a75f6.tar.gz
nitpicking
-rw-r--r--jsmond.c20
1 files 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) {