diff --git a/src/toxic_windows b/src/toxic_windows new file mode 100644 index 0000000..7e1ad30 Binary files /dev/null and b/src/toxic_windows differ diff --git a/src/toxic_windows.h b/src/toxic_windows.h index 8d8afbc..c17c128 100644 --- a/src/toxic_windows.h +++ b/src/toxic_windows.h @@ -29,8 +29,11 @@ #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 -#define T_KEY_KILL 0xB /* ASCII code for ctrl-k */ -#define T_KEY_DISCARD 0x15 /* ASCII code for ctrl-u */ +/* ASCII key codes */ +#define T_KEY_KILL 0xB /* ctrl-k */ +#define T_KEY_DISCARD 0x15 /* ctrl-u */ +#define T_KEY_NEXT 0x1D /* ctrl-] */ +#define T_KEY_PREV 0x1B /* ctrl-[ */ /* Curses foreground colours (background is black) */ enum { @@ -80,12 +83,13 @@ struct ToxWindow { void(*onFileData)(ToxWindow *, Tox *, int, uint8_t, uint8_t *, uint16_t); char name[TOX_MAX_NAME_LENGTH]; + int num; bool active; + int x; + bool alert0; bool alert1; bool alert2; - int num; - int x; ChatContext *chatwin; PromptBuf *promptbuf; diff --git a/src/windows.c b/src/windows.c index 01cae48..13c154d 100644 --- a/src/windows.c +++ b/src/windows.c @@ -221,7 +221,7 @@ void set_next_window(int ch) ToxWindow *inf = active_window; while (true) { - if (ch == '\t') { + if (ch == '\t' || ch == T_KEY_NEXT) { if (++active_window > end) active_window = windows; } else if (--active_window < windows) @@ -348,7 +348,7 @@ void draw_active_window(Tox *m) ch = getch(); #endif - if (ch == '\t' || ch == KEY_BTAB) + if (ch == '\t' || ch == KEY_BTAB || ch == T_KEY_NEXT || ch == T_KEY_PREV) set_next_window((int) ch); else if (ch != ERR) a->onKey(a, m, ch);