Re: XForms: KeyCodes in XForms

Frank Stefani (EAD-Frank.Stefani@t-online.de)
Tue, 09 Sep 1997 10:01:05 +0200

To subscribers of the xforms list from EAD-Frank.Stefani@t-online.de (Frank Stefani) :

Orn E. Hansen wrote:
>
> To subscribers of the xforms list from "Orn E. Hansen" <oe.hansen@oehansen.pp.se> :
>
> Hi,
>
> My system is a Linux system, with XFree 3.3, and glibc 2.0.
>
> Whenever I receive a keycode through the xforms routines, I receive, as
> an example, the character 'acute' instead of the keycode 'XF_dead_acute'
> which is defined in my keyboard table.
>
> The reason I point this out, is that my system is using ISO 8859/1, and
> it should translate 'XF_dead_acute' + 'a' as 'a'. But the through this
> behaviour I only receive it as 'acute' + 'a'. This does denote a small
> problem, as you'll have to translate from the characters instead of the
> keycodes. Which would be less a problem, if you could be sure that you
> would receive the keycodes for the 'dead' keys, instead of their
> representative characters.
>
> Is there a known limitation as to where this behaviour is coming from,
> and is it possible to do a neat workaround to it?
>

In your main() ore more precisely before fl_do_forms, try:

fl_register_raw_callback(fd_my_frm->my_frm, KeyPressMask, xevhandler);

and create the appropriate XEvent handler function:

int xevhandler(FL_FORM *form, void *xev)
{
XKeyEvent *xkey;
XButtonEvent *xbutton;
int keysym;

switch ( ((XKeyEvent *)xev)->type ) {
case KeyPress:
xkey = (XKeyEvent *)xev;
keysym = XKeycodeToKeysym(xkey->display, xkey->keycode, 0);
switch ( keysym ) {
case XK_KP_Enter:
/* do keypad enter key stuff */
break;
case XK_Return:
/* do 'big' return key stuff */
...
/* After customizing return key behaviour, this */
/* key shall be handled by the default handler */
/* as well, thus (!FL_PREEMPT) */
return(!FL_PREEMPT);
...
case XK_Meta_L:
case XK_Meta_R:
case XK_Alt_L:
/* These keys are marked as already handled by */
/* this function, thus (FL_PREEMPT) */
return(FL_PREEMPT);
...
} /* keysym */
case ButtonPress:
xbutton = (XButtonEvent*)xev;
switch ( xbutton->button ) {
case 1: /* Left mouse button */
...
break;
case 2: /* middle mouse button */

...
} /* switch xev-type */
} /* xevhandler */

HTH,
Frank.

-- 
---------------------------------------------------------------
     _/_/_/_/     _/_/     _/_/_/    EAD-Systeme GmbH
    _/          _/  _/    _/    _/   Nachfeldstr. 4
   _/_/_/     _/    _/   _/     _/   D-82490 Farchant, Germany
  _/        _/_/_/_/_/  _/     _/    Phone: +49 8821 9623-0
 _/_/_/_/ _/        _/ _/_/_/_/      Fax: +49 8821 9623-20
---------------------------------------------------------------
Email: EAD-Frank.Stefani@t-online.de
---------------------------------------------------------------

_________________________________________________ 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/