pkgsrc/sysutils/whowatch/patches/patch-ac
wiz d2e2398c32 Clean up input handling.
Patches provided by Brett Lymn in private mail.
2000-10-16 01:34:38 +00:00

84 lines
1.7 KiB
Text

$NetBSD: patch-ac,v 1.2 2000/10/16 01:34:39 wiz Exp $
--- whowatch.c.orig Tue Jun 6 12:21:44 2000
+++ whowatch.c
@@ -20,8 +20,7 @@
#define ut_user ut_name
#endif
-enum key { ENTER=0x100, UP, DOWN, LEFT, RIGHT, DELETE, ESC, CTRL_K, CTRL_I,
- PG_DOWN, PG_UP, HOME, END };
+enum key { ENTER=KEY_MAX + 1, ESC, CTRL_K, CTRL_I};
enum State{ USERS_LIST, PROC_TREE, INIT_TREE } state;
@@ -334,30 +333,12 @@
int read_key()
{
int c;
- c = getc(stdin);
+ c = wgetch(info_win.wd);
switch (c){
case 0xD:
case 0xA: return ENTER;
case 0xB: return CTRL_K;
case 0x9: return CTRL_I;
- case 0x1B:
- getc(stdin);
- c = getc(stdin);
- switch(c) {
- case 0x41: return UP;
- case 0x42: return DOWN;
- case 0x34:
- case 0x38:
- case 0x46: return END;
- case 0x36:
- case 0x47: return PG_DOWN;
- case 0x31:
- case 0x37:
- case 0x48: return HOME;
- case 0x35:
- case 0x49: return PG_UP;
- }
- break;
default:
break;
}
@@ -420,6 +401,7 @@
signal_sent = 0;
}
switch(key){
+ case KEY_ENTER:
case ENTER:
werase(windows[state]->wd);
switch(state){
@@ -462,23 +444,23 @@
send_signal(9, pid);
tree_periodic();
break;
- case PG_DOWN:
+ case KEY_NPAGE:
page_down(windows[state], rfrsh[state]);
break;
- case PG_UP:
+ case KEY_PPAGE:
page_up(windows[state], rfrsh[state]);
break;
- case HOME:
+ case KEY_HOME:
key_home(windows[state], rfrsh[state]);
break;
- case END:
+ case KEY_END:
key_end(windows[state], rfrsh[state]);
break;
- case UP:
+ case KEY_UP:
cursor_up(windows[state]);
wrefresh(windows[state]->wd);
break;
- case DOWN:
+ case KEY_DOWN:
cursor_down(windows[state]);
wrefresh(windows[state]->wd);
break;