Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.h @ 761:4532a9fe0e8c
Handle some keyboard escape sequences
Some sequences are not caught by ncurses, so I've made a basic escape
sequences interpreter.
The patch defines a few sequences for xterm and Gnome terminal (ctrl-arrows).
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 19 Mar 2006 12:41:46 +0100 |
parents | 0d5fb1d9077c |
children | 6866ee749225 |
comparison
equal
deleted
inserted
replaced
760:715952c2f37f | 761:4532a9fe0e8c |
---|---|
3 | 3 |
4 #include <ncurses.h> | 4 #include <ncurses.h> |
5 #include <glib.h> | 5 #include <glib.h> |
6 | 6 |
7 #include "logprint.h" | 7 #include "logprint.h" |
8 | |
9 // Length of the timestamp & flag prefix in the chat buffer window | |
10 #define PREFIX_WIDTH 17 | |
11 | |
12 #define INPUTLINE_LENGTH 1024 | |
13 | |
14 // Only used in screen.c; this is the maximum line number | |
15 // in a multi-line message. Should be < 1000 | |
16 // Note: message length is limited by the HBB_BLOCKSIZE size too | |
17 #define MULTILINE_MAX_LINE_NUMBER 299 | |
8 | 18 |
9 enum colors { | 19 enum colors { |
10 COLOR_GENERAL = 3, | 20 COLOR_GENERAL = 3, |
11 COLOR_HIGHLIGHT, | 21 COLOR_HIGHLIGHT, |
12 COLOR_STATUS, | 22 COLOR_STATUS, |
17 COLOR_max | 27 COLOR_max |
18 }; | 28 }; |
19 | 29 |
20 int COLOR_ATTRIB[COLOR_max]; | 30 int COLOR_ATTRIB[COLOR_max]; |
21 | 31 |
22 // Length of the timestamp & flag prefix in the chat buffer window | 32 extern int update_roster; |
23 #define PREFIX_WIDTH 17 | |
24 | 33 |
25 #define INPUTLINE_LENGTH 1024 | 34 typedef struct { |
35 int value; | |
36 enum { | |
37 MKEY_META = 1, | |
38 MKEY_EQUIV | |
39 } mcode; | |
40 } keycode; | |
26 | 41 |
27 // Only used in screen.c; this is the maximum line number | 42 void scr_Getch(keycode *kcode); |
28 // in a multi-line message. Should be < 1000 | 43 int process_key(keycode kcode); |
29 // Note: message length is limited by the HBB_BLOCKSIZE size too | |
30 #define MULTILINE_MAX_LINE_NUMBER 299 | |
31 | |
32 extern int update_roster; | |
33 | 44 |
34 void scr_InitCurses(void); | 45 void scr_InitCurses(void); |
35 void scr_TerminateCurses(void); | 46 void scr_TerminateCurses(void); |
36 void scr_DrawMainWindow(unsigned int fullinit); | 47 void scr_DrawMainWindow(unsigned int fullinit); |
37 void scr_DrawRoster(void); | 48 void scr_DrawRoster(void); |
49 void scr_setmsgflag_if_needed(const char *jid); | 60 void scr_setmsgflag_if_needed(const char *jid); |
50 void scr_append_multiline(const char *line); | 61 void scr_append_multiline(const char *line); |
51 inline const char *scr_get_multiline(void); | 62 inline const char *scr_get_multiline(void); |
52 | 63 |
53 inline void scr_Beep(void); | 64 inline void scr_Beep(void); |
54 int scr_Getch(void); | |
55 | |
56 int process_key(int); | |
57 | 65 |
58 void scr_CheckAutoAway(bool activity); | 66 void scr_CheckAutoAway(bool activity); |
59 | 67 |
60 // For commands... | 68 // For commands... |
61 void scr_RosterTop(void); | 69 void scr_RosterTop(void); |