From 8544e4a57016e370a25bb7038cc3ef11c81eb9c3 Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <lfleischer@calcurse.org>
Date: Wed, 30 Aug 2017 16:24:04 +0200
Subject: Rename keys_getch() to keys_get()

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
---
 src/calcurse.c |  2 +-
 src/calcurse.h |  2 +-
 src/custom.c   | 49 ++++++++++++++++++++++---------------------------
 src/keys.c     |  4 ++--
 src/notify.c   |  6 +++---
 5 files changed, 29 insertions(+), 34 deletions(-)

(limited to 'src')

diff --git a/src/calcurse.c b/src/calcurse.c
index c3bd84e..5c77bca 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -658,7 +658,7 @@ int main(int argc, char **argv)
 			key_generic_reload();
 		}
 
-		key = keys_getch(win[KEY].p, &count, &reg);
+		key = keys_get(win[KEY].p, &count, &reg);
 		switch (key) {
 		HANDLE_KEY(KEY_GENERIC_CHANGE_VIEW, key_generic_change_view);
 		HANDLE_KEY(KEY_GENERIC_OTHER_CMD, key_generic_other_cmd);
diff --git a/src/calcurse.h b/src/calcurse.h
index c5ad2fe..ac1baba 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -871,7 +871,7 @@ void keys_free(void);
 void keys_dump_defaults(char *);
 const char *keys_get_label(enum key);
 enum key keys_get_action(int);
-enum key keys_getch(WINDOW * win, int *, int *);
+enum key keys_get(WINDOW *, int *, int *);
 int keys_assign_binding(int, enum key);
 void keys_remove_binding(int, enum key);
 int keys_str2int(const char *);
diff --git a/src/custom.c b/src/custom.c
index 1fd616c..ce219c1 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -173,7 +173,7 @@ static void display_layout_config(struct window *lwin, int mark,
 void custom_layout_config(void)
 {
 	struct window conf_win;
-	int ch, mark, cursor, need_reset;
+	int key, mark, cursor, need_reset;
 	const char *label = _("layout configuration");
 
 	conf_win.p = NULL;
@@ -182,10 +182,9 @@ void custom_layout_config(void)
 	display_layout_config(&conf_win, mark, cursor);
 	clear();
 
-	while ((ch =
-		keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
+	while ((key = keys_get(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
 		need_reset = 0;
-		switch (ch) {
+		switch (key) {
 		case KEY_GENERIC_SELECT:
 			mark = cursor;
 			break;
@@ -236,15 +235,14 @@ void custom_sidebar_config(void)
 	static int bindings[] = {
 		KEY_GENERIC_QUIT, KEY_MOVE_UP, KEY_MOVE_DOWN, KEY_GENERIC_HELP
 	};
-	int ch, bindings_size = ARRAY_SIZE(bindings);
+	int key, bindings_size = ARRAY_SIZE(bindings);
 
 	keys_display_bindings_bar(win[STA].p, bindings, bindings_size, 0,
 				  bindings_size);
 	wins_doupdate();
 
-	while ((ch =
-		keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
-		switch (ch) {
+	while ((key = keys_get(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
+		switch (key) {
 		case KEY_MOVE_UP:
 			wins_sbar_winc();
 			break;
@@ -445,7 +443,7 @@ display_color_config(struct window *cwin, int *mark_fore, int *mark_back,
 void custom_color_config(void)
 {
 	struct window conf_win;
-	int ch, cursor, need_reset, theme_changed;
+	int key, cursor, need_reset, theme_changed;
 	int mark_fore, mark_back;
 	const char *label = _("color theme");
 
@@ -459,12 +457,11 @@ void custom_color_config(void)
 			     theme_changed);
 	clear();
 
-	while ((ch =
-		keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
+	while ((key = keys_get(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
 		need_reset = 0;
 		theme_changed = 0;
 
-		switch (ch) {
+		switch (key) {
 		case KEY_GENERIC_SELECT:
 			colorize = 1;
 			need_reset = 1;
@@ -775,7 +772,7 @@ void custom_general_config(void)
 		KEY_GENERIC_QUIT, KEY_MOVE_UP, KEY_MOVE_DOWN, KEY_EDIT_ITEM
 	};
 	struct listbox lb;
-	int ch;
+	int key;
 
 	clear();
 	listbox_init(&lb, 0, 0, notify_bar() ? row - 3 : row - 2, col,
@@ -790,8 +787,8 @@ void custom_general_config(void)
 	wmove(win[STA].p, 0, 0);
 	wins_doupdate();
 
-	while ((ch = keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
-		switch (ch) {
+	while ((key = keys_get(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
+		switch (key) {
 		case KEY_MOVE_DOWN:
 			listbox_sel_move(&lb, 1);
 			break;
@@ -908,7 +905,7 @@ void custom_keys_config(void)
 {
 	struct scrollwin kwin;
 	int selrow, selelm, firstrow, lastrow, nbrowelm, nbdisplayed;
-	int keyval, used, not_recognized;
+	int ch, used, not_recognized;
 	const char *keystr;
 	WINDOW *grabwin;
 	const int LINESPERKEY = 2;
@@ -926,10 +923,9 @@ void custom_keys_config(void)
 	firstrow = 0;
 	lastrow = firstrow + nbdisplayed - 1;
 	for (;;) {
-		int ch;
+		int key = keys_get(win[KEY].p, NULL, NULL);
 
-		ch = keys_getch(win[KEY].p, NULL, NULL);
-		switch (ch) {
+		switch (key) {
 		case KEY_MOVE_UP:
 			if (selrow > 0) {
 				selrow--;
@@ -976,11 +972,10 @@ void custom_keys_config(void)
 					  (col - WINCOL) / 2,
 					  _("Press the key you want to assign to:"),
 					  keys_get_label(selrow), 0);
-				keyval = wgetch(grabwin);
+				ch = wgetch(grabwin);
 
 				/* First check if this key would be recognized by calcurse. */
-				if (keys_str2int(keys_int2str(keyval)) ==
-				    -1) {
+				if (keys_str2int(keys_int2str(ch)) == -1) {
 					not_recognized = 1;
 					WARN_MSG(_("This key is not yet recognized by calcurse, "
 						  "please choose another one."));
@@ -997,16 +992,16 @@ void custom_keys_config(void)
 				}
 
 				/* Is the binding used by this action already? If so, just end the reassignment */
-				if (selrow == keys_get_action(keyval)) {
+				if (selrow == keys_get_action(ch)) {
 					delwin(grabwin);
 					break;
 				}
 
-				used = keys_assign_binding(keyval, selrow);
+				used = keys_assign_binding(ch, selrow);
 				if (used) {
 					enum key action;
 
-					action = keys_get_action(keyval);
+					action = keys_get_action(ch);
 					WARN_MSG(_("This key is already in use for %s, "
 						  "please choose another one."),
 						 keys_get_label(action));
@@ -1029,8 +1024,8 @@ void custom_keys_config(void)
 			break;
 		case KEY_DEL_ITEM:
 			keystr = keys_action_nkey(selrow, selelm);
-			keyval = keys_str2int(keystr);
-			keys_remove_binding(keyval, selrow);
+			ch = keys_str2int(keystr);
+			keys_remove_binding(ch, selrow);
 			nbrowelm--;
 			if (selelm > 0 && selelm <= nbrowelm)
 				selelm--;
diff --git a/src/keys.c b/src/keys.c
index c23a741..e71a2c4 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -187,7 +187,7 @@ enum key keys_get_action(int pressed)
 		return actions[pressed];
 }
 
-enum key keys_getch(WINDOW * win, int *count, int *reg)
+enum key keys_get(WINDOW *win, int *count, int *reg)
 {
 	int ch = '0';
 
@@ -582,7 +582,7 @@ void keys_popup_info(enum key key)
 	infowin =
 	    popup(WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2,
 		  keydef[key].label, info[key], 1);
-	keys_getch(infowin, NULL, NULL);
+	keys_get(infowin, NULL, NULL);
 	delwin(infowin);
 #undef WINROW
 #undef WINCOL
diff --git a/src/notify.c b/src/notify.c
index 64ce0dc..ff5b2e2 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -778,7 +778,7 @@ void notify_config_bar(void)
 		KEY_GENERIC_QUIT, KEY_MOVE_UP, KEY_MOVE_DOWN, KEY_EDIT_ITEM
 	};
 	struct listbox lb;
-	int ch;
+	int key;
 
 	clear();
 	listbox_init(&lb, 0, 0, notify_bar() ? row - 3 : row - 2, col,
@@ -793,8 +793,8 @@ void notify_config_bar(void)
 	wmove(win[STA].p, 0, 0);
 	wins_doupdate();
 
-	while ((ch = keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
-		switch (ch) {
+	while ((key = keys_get(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
+		switch (key) {
 		case KEY_MOVE_DOWN:
 			listbox_sel_move(&lb, 1);
 			break;
-- 
cgit v1.2.3-70-g09d2