Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/main.c @ 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 | ee03b56b93ee |
children | 464be13343a9 |
comparison
equal
deleted
inserted
replaced
760:715952c2f37f | 761:4532a9fe0e8c |
---|---|
189 int optval, optval2; | 189 int optval, optval2; |
190 int key; | 190 int key; |
191 unsigned int ping; | 191 unsigned int ping; |
192 int ret; | 192 int ret; |
193 unsigned int refresh = 0; | 193 unsigned int refresh = 0; |
194 keycode kcode; | |
194 | 195 |
195 credits(); | 196 credits(); |
196 | 197 |
197 signal(SIGTERM, sig_handler); | 198 signal(SIGTERM, sig_handler); |
198 signal(SIGINT, sig_handler); | 199 signal(SIGINT, sig_handler); |
269 scr_LogPrint(LPRINT_LOGNORM, "Can't connect: no password supplied"); | 270 scr_LogPrint(LPRINT_LOGNORM, "Can't connect: no password supplied"); |
270 | 271 |
271 scr_LogPrint(LPRINT_DEBUG, "Entering into main loop..."); | 272 scr_LogPrint(LPRINT_DEBUG, "Entering into main loop..."); |
272 | 273 |
273 for (ret = 0 ; ret != 255 ; ) { | 274 for (ret = 0 ; ret != 255 ; ) { |
274 key = scr_Getch(); | 275 scr_Getch(&kcode); |
276 key = kcode.value; | |
275 | 277 |
276 /* The refresh is really an ugly hack, but we need to call doupdate() | 278 /* The refresh is really an ugly hack, but we need to call doupdate() |
277 from time to time to catch the RESIZE events, because getch keep | 279 from time to time to catch the RESIZE events, because getch keep |
278 returning ERR until a real key is pressed :-( | 280 returning ERR until a real key is pressed :-( |
279 However, it allows us to handle an autoaway check here... | 281 However, it allows us to handle an autoaway check here... |
280 */ | 282 */ |
281 if (key != ERR) { | 283 if (key != ERR) { |
282 ret = process_key(key); | 284 ret = process_key(kcode); |
283 refresh = 0; | 285 refresh = 0; |
284 } else if (refresh++ > 1) { | 286 } else if (refresh++ > 1) { |
285 doupdate(); | 287 doupdate(); |
286 refresh = 0; | 288 refresh = 0; |
287 scr_CheckAutoAway(FALSE); | 289 scr_CheckAutoAway(FALSE); |