Re: detect keypress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 13, 2006 at 13:24:38 +0100, jerome lacoste wrote:
> Daniel seems to have issues to detect whether a key is pressed on
> linux outside of an event loop:
> 
> Article in French:
> http://www.glazman.org/weblog/dotclear/index.php?2006/01/13/1496-un-truc-qui-me-gave-gravement
> 
> Basically he writes a code block that should do what he wants but:
> 
> "Mais ça, qui semble ?tre la seule mani?re de faire, NE MARCHE PAS
> parce que X bloque l'acc?s non-root ? /dev/tty ou /dev/console"
> 
> translates to
> 
> "This, which seems to be the only way to achieve my goals, doesn't
> work because X block non-root access to /dev/tty or /dev/console."
> 
> Anyone has an idea on how to solve this?

What the *heck* is he trying to do?!?! Obviously the access to /dev/tty
and /dev/console is denied in X. It *must* be denied in X. It may not
even be related to the terminal the user is sitting at(1)!!!

X manages the keyboard. LET IT DO IT'S JOB! If you need it to tell you
when a (specific) key is pressed globally, just grab it (XGrabKey). If
you want to know when a key is pressed and no application was
interested, listen on the root window. If you want to know when a key is
pressed when particular window has focus, listen on that window. You can
also become an input method, which sees everything that goes on on the
keyboard.

(1) There can be more than one display and more than one keyboard
attached to a computer and each may have different X-server running. But
only one of them might have any console associated. Or the console might
be on a serial port. Or you might be running on one machnie, but the
user might be sitting in front of an X-terminal half a world away...

-- 
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux