diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-09 19:45:43 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-09 19:45:43 +0000 |
commit | 09edf2377f3c534d930a604d9fe6a97265e372e2 (patch) | |
tree | b68aa20d852329dd0a36567fe31105b79205cbe0 | |
parent | de74ffa67f91b4b3415eabd54ae9a2c931a88a1b (diff) | |
download | termo-09edf2377f3c534d930a604d9fe6a97265e372e2.tar.gz termo-09edf2377f3c534d930a604d9fe6a97265e372e2.tar.xz termo-09edf2377f3c534d930a604d9fe6a97265e372e2.zip |
Driver getkey() can return TERMKEY_RES_NONE which attempts getkey_simple() afterwards
-rw-r--r-- | driver-csi.c | 2 | ||||
-rw-r--r-- | driver-ti.c | 3 | ||||
-rw-r--r-- | termkey.c | 34 |
3 files changed, 33 insertions, 6 deletions
diff --git a/driver-csi.c b/driver-csi.c index 05c7fa5..c03c98f 100644 --- a/driver-csi.c +++ b/driver-csi.c @@ -309,7 +309,7 @@ static termkey_result getkey(termkey_t *tk, void *info, termkey_key *key, int fo return getkey_csi(tk, csi, 1, key, force); } else - return (*tk->method.getkey_simple)(tk, key, force); + return TERMKEY_RES_NONE; } static termkey_keysym register_csi_ss3(termkey_csi *csi, termkey_type type, termkey_keysym sym, unsigned char cmd, const char *name) diff --git a/driver-ti.c b/driver-ti.c index 7c1d458..3d1f467 100644 --- a/driver-ti.c +++ b/driver-ti.c @@ -135,8 +135,7 @@ static termkey_result getkey(termkey_t *tk, void *info, termkey_key *key, int fo } } - // No special seq. Must be a simple key then - return (*tk->method.getkey_simple)(tk, key, force); + return TERMKEY_RES_NONE; } static struct { @@ -382,7 +382,11 @@ static termkey_result getkey_simple(termkey_t *tk, termkey_key *key, int force) tk->buffcount--; // Run the full driver - termkey_result metakey_result = (*tk->driver.getkey)(tk, tk->driver_info, key, force); + termkey_result metakey_result; + if(force) + metakey_result = termkey_getkey_force(tk, key); + else + metakey_result = termkey_getkey(tk, key); tk->buffstart--; tk->buffcount++; @@ -504,12 +508,36 @@ static termkey_result getkey_simple(termkey_t *tk, termkey_key *key, int force) termkey_result termkey_getkey(termkey_t *tk, termkey_key *key) { - return (*tk->driver.getkey)(tk, tk->driver_info, key, 0); + termkey_result ret = (*tk->driver.getkey)(tk, tk->driver_info, key, 0); + + switch(ret) { + case TERMKEY_RES_KEY: + case TERMKEY_RES_EOF: + case TERMKEY_RES_AGAIN: + return ret; + + case TERMKEY_RES_NONE: + break; + } + + return getkey_simple(tk, key, 0); } termkey_result termkey_getkey_force(termkey_t *tk, termkey_key *key) { - return (*tk->driver.getkey)(tk, tk->driver_info, key, 1); + termkey_result ret = (*tk->driver.getkey)(tk, tk->driver_info, key, 1); + + switch(ret) { + case TERMKEY_RES_KEY: + case TERMKEY_RES_EOF: + return ret; + + case TERMKEY_RES_AGAIN: + case TERMKEY_RES_NONE: + break; + } + + return getkey_simple(tk, key, 1); } termkey_result termkey_waitkey(termkey_t *tk, termkey_key *key) |