Re: detect keypress

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

 



Jan Hudec wrote:

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...

I am just trying to know the state of the capslock key at arbitrary time,
and that means outside of an event callback.

Anyway, apparently XkbGetIndicatorState() is the answer.

</Daniel>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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