hardware keycode within cygwin
- From: Tor Lillqvist <tml iki fi>
- To: Tobias Werth <sitowert informatik stud uni-erlangen de>
- Cc: gtk-app-devel-list gnome org
- Subject: hardware keycode within cygwin
- Date: Fri, 11 Jun 2004 02:06:54 +0000
Tobias Werth writes:
I'm developing a GUI which should be able to run within cygwin and linux.
If the user presses a key over a special window, I need the lower level
hardware keycode.
Why?
By catching the key event under linux this is no problem, because in struct
GdKEventKey there is a member hardware_keycode. This works for several
linux-distros. But within cygwin this member doesn't contain the hardware
keycode.
With "within Cygwin", do you mean GTK+ built for Win32 or X11?
I assume for Win32. I hope you are not using the "native Win32" GTK
DLLs from a Cygwin program? That is not supported, although it might
work. (But not relevant for this discussion.)
It was a deliberate design decision back in 2002 (by me) to use the
Windows virtual key code for hardware_keycodes.
A virtual key code is a concept that in a sense is more close to X11's
keysyms than to X11's hardware keycodes. Except that you do have the
same (one-byte) virtual key codes on all keyboards, regardless of
keyboard locale, so even if the keyboard has no Latin letters on it,
most keys that are where Latin letters would be have a virtual keycode
identical to that letter in ASCII. I don't remember the rationale for
my choice. Presumably the things just "fell better into place" if
virtual key codes were used and not scancodes. This ChangeLog entry
maybe tells something:
2002-02-26 Tor Lillqvist <tml iki fi>
* gdk/win32/gdkkeys-win32.c: Implement the functions that until
now just were non-functional stubs. For "hardware keycodes", we
use Windows virtual keycodes. Not scancodes, although that at
first might seem more low-level and a better match to X11
keycodes.
The Windows API is really mixed up and confused with respect to
scancodes and virtual keycodes. (Surprised?) Some scancodes are
generated by two keys on the keyboard (!), and although the
keyboard messages do have a flag to indicate which key the user
pressed, other API that take a scan code as input don't let you
specify which actual key you mean.
Is there any other way to get the hardware keycode with gdk/gtk/glib
functions?
You could try playing with GDK event filters. They are called with the
raw Windows MSG.
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]