lkml.org 
[lkml]   [1998]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Keyboard hacking?
Hi,

> Has anybody ever modified keyboard.c (presumably the handle_scancode()
> routine, mostly) to cope with chorded input? The pseudocode'd be
> something like this:
>
> if scancode indicates a key-press event
> add this key to the array of currently-pressed keys
> else (key-release event)
> if previous scancode indicates a key-press event
> lookup the key that maps to the array of currently-pressed keys and
> return that.
> if there isn't one, beep or something
> endif
> remove this key from the array of currently-pressed keys
> endif
>
> I could probably figure out the code for it if I poked hard enough,
> but C isn't my forte so I thought I'd ask first.

There already _is_ an array of currently-pressed keys (key_down in keyboard.c),
you can simply use it. I would recommend adding a new keyboard mode in addition
to the cooked, raw and medium raw modes and handle it directly in the
handle_scancode() function.

Have a nice fortnight
--
Martin `MJ' Mares <mj@gts.cz> http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"A LISP programmer knows value of everything, but cost of nothing."

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.031 / U:1.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site