gdkkeysyms.h question
- From: Andreas Leitner <leitner eiffel com>
- To: gtk-list redhat com
- Subject: gdkkeysyms.h question
- Date: Thu, 16 Sep 1999 18:26:40 -0700
In a key-press handler I get access to the GdkEventKey structure which
provides me with the following information:
--
struct _GdkEventKey
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 time;
guint state;
guint keyval;
gint length;
gchar *string;
};
--
Now say I want to know whether the TAB key has been pressed. My first
approach to do that was to have a look at `keyval'. In fact it tells me
something that does help me, but it does it in a complicated way. For
the TAB key I found _four_ definitions in gdkkeysyms.h:
--
#define GDK_Tab 0xFF09
#define GDK_KP_Tab 0xFF89
#define GDK_ISO_Left_Tab 0xFE20
#define GDK_3270_BackTab 0xFD05
--
Here is what some tests have showed:
-- keyval state
WinNT remote via X-Win32:
pressing TAB GDK_TAB 0
pressing SHIFT-TAB GDK_KP_TAB 1
SparcStation 10:
pressing TAB GDK_TAB 0
pressing SHIFT-TAB GDK_TAB 1
Linux (x86/Debian):
pressing TAB GDK_TAB 0
pressing SHIFT-TAB GDK_ISO_LEFT_TAB 1
--
This isn't exactly what I expected. Now I don't know much about how X
works, but shouldn't such situations be avoided in a high level library
(GDK is supposed to be a higher abstraction on top of X or any other
windowing system, is it?)
Of course I can test `string', it always will hold the tab character,
but that does not look like a clean solution, because it relies on the
fact that TAB has a entry in the ASCII table. There are a lot more
constants in gdkkeysyms.h that have similar semantic and are not in the
ASCII set. How do I handle them? I could check anytime if the value
matches any of the constants that refer to the key in question, but
that's not very clean either.
Besides on the NT PC which connects remotely to a Linux Box and uses
X-Win32 as a X-server, I cannot use SHIFT-TAB to go the a previous
Widget, because the code in GtkWindow is hard coded to only two TAB
constants.
Does anybody know a good way to avoid such situations?
many thanks in advance,
Andreas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]