diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-12-03 16:34:41 +1100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-12-03 16:34:41 +1100 |
commit | 0b38fab97b33ff625ef8b171176d719d76df951e (patch) | |
tree | 2cfd071cc556a71f50b1092f7976eaca5c27dd3a | |
parent | ec9d90b809f5ed8507f7e6a5746d2991c54f5912 (diff) |
Temporary key events with fbdev
This is temporary as I need to implement a proper keyboard handling,
probably via the event device, and an input method mecanism for
translating unhandled raw key down events into ucs4.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | twin_fbdev.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/twin_fbdev.c b/twin_fbdev.c index a1d9472..b8b6fdb 100644 --- a/twin_fbdev.c +++ b/twin_fbdev.c @@ -217,20 +217,31 @@ static twin_bool_t twin_fbdev_read_events(int file, twin_file_op_t ops, { twin_fbdev_t *tf = closure; unsigned char events[16]; - int i, count; + twin_event_t evt; + int i, count, down; count = read(file, events, 16); for (i = 0; i < count; i++) { unsigned char e = events[i]; - /* Handle special keys */ + down = !!(e & 0x80); + e &= 0x7f; + + /* XXX Handle special keys (make more configurable) */ switch(e) { case KEY_F1...KEY_F10: - ioctl(tf->vt_fd, VT_ACTIVATE, e - KEY_F1 + 1); + if (down) + ioctl(tf->vt_fd, VT_ACTIVATE, e - KEY_F1 + 1); break; case KEY_ESC: - kill(0, SIGINT); + if (down) + kill(0, SIGINT); + break; + default: + evt.kind = down ? TwinEventKeyDown : TwinEventKeyUp; + evt.u.key.key = e; + twin_screen_dispatch(tf->screen, &evt); break; } } |