Re: XForms: Keysym for capital letter in raw callback [followup]

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 2 Dec 98 15:13:52 PST

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

I was somewhat mistaken -- or at least misleading -- in my last
posting on this subject.

I did some checking and looking at the manual page for XLookupKeysym,
if you use 0 for the index, then you're going to get the text version
of the KeySym. From the <X11/X.h>:

/* modifier names. Used to build a SetModifierMapping request or
to read a GetModifierMapping request. These correspond to the
masks defined above. */
#define ShiftMapIndex 0
#define LockMapIndex 1
#define ControlMapIndex 2
#define Mod1MapIndex 3
#define Mod2MapIndex 4
#define Mod3MapIndex 5
#define Mod4MapIndex 6
#define Mod5MapIndex 7

The man page is not all that clear on the subject -- check the entry
in the O'Reilly _Xlib Reference Manual_ if you have it.

I suggest using XLookupString instead. This will give you more of the
translation you expect.

Here's what I do:

XKeyEvent *xkey_press = ( XKeyEvent *) xevent;
char buffer[80];
KeySym keysym;
XComposeStatus compose_status;
int l;

l = XLookupString( xkey_press, buffer, sizeof( buffer ),
&keysym, &compose_status );

switch ( buffer[0] ) {

case [...]

Refer to your favorite Xlib manual or docs for further information.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/