Explorar o código

Changing keybind struct member name to ckm aka Current KeyMap

Vinicius Teshima hai 1 ano
pai
achega
8ad1eb1375
Modificáronse 2 ficheiros con 9 adicións e 8 borrados
  1. 8 7
      src/app.h
  2. 1 1
      src/main.c

+ 8 - 7
src/app.h

@@ -49,7 +49,7 @@ struct app {
 	bool show_fps;
 	struct free_glyph_atlas *fga;
 	struct cursor_render *cr;
-	struct app_kbd_ht kbds;
+	struct app_kbd_ht ckm;
 };
 
 #include "free_glyph.h"
@@ -116,8 +116,8 @@ app_create(const char *win_title)
 		},
 		.target_fps = 120,
 	};
-	HT_CREATE(app.kbds, 16);
-	app.kbds.hash = ht_hash_nop;
+	HT_CREATE(app.ckm, 16);
+	app.ckm.hash = ht_hash_nop;
 	DA_CREATE(app.bufs);
 	DA_APPEND(app.bufs, buffer_create());
 	app.cbuf = &app.bufs.items[0];
@@ -346,7 +346,8 @@ char_to_keymod(char c)
 
 #define IF_GOTO(cond, to)				\
 	if ( (cond) ) {				\
-		fprintf(stderr, #cond"\n");		\
+		fprintf(stderr, "%s:%d: "#cond"\n",	\
+			__FILE__, __LINE__);		\
 		goto to;				\
 	}
 
@@ -364,7 +365,7 @@ app_add_global_keybind(struct app *app, const char *keybind,
 			.func = func,
 			.dir = dir
 		};
-		HT_ISET(app->kbds, (int64_t)(key), kbd);
+		HT_ISET(app->ckm, (int64_t)(key), kbd);
 		return;
 	}
 	if ( kbd_str.data[0] == '<' ) {
@@ -376,7 +377,7 @@ app_add_global_keybind(struct app *app, const char *keybind,
 			.func = func,
 			.dir = dir
 		};
-		HT_ISET(app->kbds, (int64_t)(key), kbd);
+		HT_ISET(app->ckm, (int64_t)(key), kbd);
 		return;
 	}
 
@@ -420,7 +421,7 @@ app_add_global_keybind(struct app *app, const char *keybind,
 			.func = func,
 			.dir = dir
 		};
-		HT_ISET(app->kbds, (int64_t)(key) + (int64_t)(mod), kbd);
+		HT_ISET(app->ckm, (int64_t)(key) + (int64_t)(mod), kbd);
 	}
 
 	DA_DESTROY(words);

+ 1 - 1
src/main.c

@@ -164,7 +164,7 @@ handle_events(struct app *app)
 			}
 
 			struct app_kbd kbd = {0};
-			HT_IGET(app->kbds, (int64_t)(ks.sym + mod), kbd);
+			HT_IGET(app->ckm, (int64_t)(ks.sym + mod), kbd);
 
 			if ( kbd.func == NULL ) {
 				break;