From: edmonds@cs.ubc.ca (Brian Edmonds) Subject: Re: swapping Ctrl/Caps ?? Date: 28 Mar 1993 17:27:52 GMT
lok@cs.tu-berlin.de (Andreas Stang) wrote:
. I spend the afternoon trying to get `Ctrl' on the `Caps Lock' key, but it
. didn't work. Is there anybody who has an Idea how to modify keyboard.c?
. (0.99pl6 and US-Keyboard)
The solution I've been using for almost a year now is quite simple. It
actually doesn't swap the keys, but instead turns caps into a ctrl, and
recognizes shift-caps as the new capslock key.
Perhaps Linus could modify keyboard.c so I wouldn't have to patch it
every time. :) All that you have to do is add a few lines at the top
of the caps() and uncaps() functions as follows:
static void caps(int sc)
{
if( ! kbd_flag( KG_LSHIFT | KG_RSHIFT ) )
{
ctrl( sc );
return;
}
if (kbd_flag(KG_CAPSLOCK))
return; /* key already pressed: defeat repeat */
set_kbd_flag(KG_CAPSLOCK);
chg_vc_kbd_flag(kbd,VC_CAPSLOCK);
}
static void uncaps(int sc)
{
if( ! kbd_flag( KG_LSHIFT | KG_RSHIFT ) )
{
unctrl( sc );
return;
}
clr_kbd_flag(KG_CAPSLOCK);
}
This is taken from the 99.6 kernel, though it likely hasn't changed
much to 99.7. Linus will probably want to add a #ifdef block around
this so it's compile time selectable.
========================================================================
Brian Edmonds (MSc CompSci) edmonds@cs.ubc.ca