Terminfo driver needs to put terminal into 'keypad_xmit' mode when starting

This commit is contained in:
Paul LeoNerd Evans 2008-11-02 17:59:30 +00:00
parent 5107112a91
commit aef409c460
1 changed files with 23 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h>
struct ti_keyinfo { struct ti_keyinfo {
const char *seq; const char *seq;
@ -75,6 +76,25 @@ abort_free_ti:
return NULL; return NULL;
} }
static void start_driver(termkey_t *tk)
{
/* The terminfo database will contain keys in application cursor key mode.
* We may need to enable that mode
*/
if(keypad_xmit) {
// Can't call putp or tputs because they suck and don't give us fd control
write(tk->fd, keypad_xmit, strlen(keypad_xmit));
}
}
static void stop_driver(termkey_t *tk)
{
if(keypad_local) {
// Can't call putp or tputs because they suck and don't give us fd control
write(tk->fd, keypad_local, strlen(keypad_local));
}
}
static void free_driver(void *private) static void free_driver(void *private)
{ {
} }
@ -236,5 +256,8 @@ struct termkey_driver termkey_driver_ti = {
.new_driver = new_driver, .new_driver = new_driver,
.free_driver = free_driver, .free_driver = free_driver,
.start_driver = start_driver,
.stop_driver = stop_driver,
.getkey = getkey, .getkey = getkey,
}; };