Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Aug 1997 20:43:34 +0200
From:      j@uriah.heep.sax.de (J Wunsch)
To:        hackers@FreeBSD.ORG
Cc:        root@goff.comtat.kazan.su (System Administrator)
Subject:   Re: How to get state of ctrl, alt, shift keys ?
Message-ID:  <19970809204334.WG16542@uriah.heep.sax.de>
In-Reply-To: =?iso-8859-1?Q?=3C199708081606=2ESAA02524=40sos=2Efreebsd=2Edk=3E=3B_fro?= =?iso-8859-1?Q?m_S=F8ren_Schmidt_on_Aug_8=2C_1997_18=3A06=3A44_%2B0200?=
References:  <AA5VpwpqZ5@goff.comtat.kazan.su> <199708081606.SAA02524@sos.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
As Søren Schmidt wrote:

> > Can anybody help me? I need for my programm to get stat of the keys
> > ctl,alt,shift - well, You know for this combinations, like Ctrl+PgUP
> > and so on. Question: How can I do this?

You should not do this.  Don't learn the bad things from other
systems.

> You can use the KDGKBSTATE ioctl to read the modifier keys, see <console.h>

This will be very hard to do on a serial terminal, in a telnet
session, or inside an xterm. ;-)  And that's exactly the reason why
this kind of hacks is deprecated.  It's probably very hard to guess a
number, but i think more than 75 % of the machines where a regular
user is sitting in front of the screen (i.e. not counting server
machines where the console isn't used by anyone regularly) are
probably using X11 these days.  Maybe even more.

> What do you want that for ?? If you need different value for ctrl/alt PgUP
> then you could modify the keymap to return different values, that should
> be alot easier...

...and more portable, too.  You could perhaps even modify an xterm
mapping for it if you are keen to do this.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970809204334.WG16542>