mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 04:53:02 +01:00
make ctrl-] [ keys switch pages
This commit is contained in:
parent
f942982f4e
commit
d232538317
BIN
src/toxic_windows
Normal file
BIN
src/toxic_windows
Normal file
Binary file not shown.
@ -29,8 +29,11 @@
|
|||||||
#define EXIT_SUCCESS 0
|
#define EXIT_SUCCESS 0
|
||||||
#define EXIT_FAILURE 1
|
#define EXIT_FAILURE 1
|
||||||
|
|
||||||
#define T_KEY_KILL 0xB /* ASCII code for ctrl-k */
|
/* ASCII key codes */
|
||||||
#define T_KEY_DISCARD 0x15 /* ASCII code for ctrl-u */
|
#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) */
|
/* Curses foreground colours (background is black) */
|
||||||
enum {
|
enum {
|
||||||
@ -80,12 +83,13 @@ struct ToxWindow {
|
|||||||
void(*onFileData)(ToxWindow *, Tox *, int, uint8_t, uint8_t *, uint16_t);
|
void(*onFileData)(ToxWindow *, Tox *, int, uint8_t, uint8_t *, uint16_t);
|
||||||
|
|
||||||
char name[TOX_MAX_NAME_LENGTH];
|
char name[TOX_MAX_NAME_LENGTH];
|
||||||
|
int num;
|
||||||
bool active;
|
bool active;
|
||||||
|
int x;
|
||||||
|
|
||||||
bool alert0;
|
bool alert0;
|
||||||
bool alert1;
|
bool alert1;
|
||||||
bool alert2;
|
bool alert2;
|
||||||
int num;
|
|
||||||
int x;
|
|
||||||
|
|
||||||
ChatContext *chatwin;
|
ChatContext *chatwin;
|
||||||
PromptBuf *promptbuf;
|
PromptBuf *promptbuf;
|
||||||
|
@ -221,7 +221,7 @@ void set_next_window(int ch)
|
|||||||
ToxWindow *inf = active_window;
|
ToxWindow *inf = active_window;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (ch == '\t') {
|
if (ch == '\t' || ch == T_KEY_NEXT) {
|
||||||
if (++active_window > end)
|
if (++active_window > end)
|
||||||
active_window = windows;
|
active_window = windows;
|
||||||
} else if (--active_window < windows)
|
} else if (--active_window < windows)
|
||||||
@ -348,7 +348,7 @@ void draw_active_window(Tox *m)
|
|||||||
ch = getch();
|
ch = getch();
|
||||||
#endif
|
#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);
|
set_next_window((int) ch);
|
||||||
else if (ch != ERR)
|
else if (ch != ERR)
|
||||||
a->onKey(a, m, ch);
|
a->onKey(a, m, ch);
|
||||||
|
Loading…
Reference in New Issue
Block a user