It is very sad that LyX still can't support X keyboard other than ISO-8859-1. It is one of those broken program for which I still need a broken xmodmap. And I also don't think using LyX own keymaps is a good thing, as the Xserver is ment to handle the keyboard. The problem is, that when I have eg. Polish keyboard layout defined in my Xserver configuration, and Polish locale (LC_CTYPE) chosen I should get my national (iso-8859-2) characters entered properly. But LyX seems to accept iso-8859-1 characters only, so I have to set my xmodmap so the keys generates iso-8859-1 characters corresponding to the same codes in iso-8859-2. GNOME, Qt applications and demos from xforms-0.89 don't suffer this problem. Even in LyX keyboard in dialog boxes seems to work OK for me. I was searching for the problem, using xforms-0.88 and 0.89, and chacking the LyX source. I hace prepared an analysis of the problems I found for the author of xforms. It is also attached to this mail (I dont thing it is neccessery do describe the problem twice). I hope it will help You inprove LyX. Greets, Jacek PS. The LyX is the best program for writting text document I have ever seen. Thanks for that!
Date: Fri, 16 Jun 2000 13:12:08 +0200 From: Jacek Konieczny <[EMAIL PROTECTED]> To: "T.C. Zhao" <[EMAIL PROTECTED]> Subject: Re: Keyboard bug in xforms On Sun, Jun 11, 2000 at 02:36:26PM -0700, T.C. Zhao wrote: > You can download and try the current version > from http://world.std.com/~xforms > and let me know if there is any improvement. > > Added some code to handle locale, but not > entire sure got it right. The demos seem to work better --- keyboard is read properly (ISO-8859-2 characters), but the font "iso-8859-1" is always used. It is ok, as most programs allow to change font, so the font charset can also be set. But maybe it would be better if the font encoding would be taken from locale too? But it can make problems too: how would english menu look like written i chinesee font? The new version however don't seem to fix keyboard problems in LyX. There is a separate keyboard support in the main window, but it seems xforms keyboard support is still used in dialogs. But even using xforms-0.88 I got ISO-8859-2 characters there (in dialogs). But not in the main window. I have checked the LyX code, and I found out that it uses X input method. However XOpenIM always fails. I have written a little prog (attached) to check how does it work. I found out XOpenIM fails if no "@im" locale modifier is set. In the attached program if "" is given to SetLocaleModifiers, setting XMODIFIERS enviroment variable to "@im=none" helps. In LyX however it does not. XOpenIM does not fail, but still no ISO-8859-2 characters are entered. The funniest thin is, that setting this variable breakes xforms handling of keyboard. Both in xforms demos and in LyX dialog boxes: instead of one iso-8859-2 character four characters are entered --- one proper, and other random. It seems it is a bug of xforms-0.89 (xform-0.88 doesn't suffer this problem). It can also be a bug in XFree86-4.0, as xedit (using Xt) has the sum problem, but even when XMODIFIERS is not set. The little test program is attached. It seems to properly recognize typed characters. I hope I was at leas a little bit helpful. Greets, Jacek
#include <X11/Xlib.h> #include <stdio.h> #include <locale.h> int DoEvents(Display* display,XIC xic){ XEvent ev; char key[11]; do{ XNextEvent(display,&ev); fprintf(stderr,"Event: %i\n",ev.type); if (ev.type==KeyPress){ fprintf(stderr,"KeyPress: \n"); XLookupString(&ev,key,10,NULL,NULL); fprintf(stderr,"XLookupString: '%s'\n",key); XmbLookupString(xic,&ev.xkey,key,10,NULL,NULL); fprintf(stderr,"XmbLookupString: '%s'\n",key); } }while(key[0]!='q'); return 0; } int DoIC(Display *display,XIM xim){ XIC xic; Window window; XSetWindowAttributes atr; int r; atr.background_pixel=0; atr.event_mask=KeyPress|KeyRelease|ButtonPress|ButtonRelease|CreateNotify; atr.do_not_propagate_mask=0; window=XCreateWindow(display,DefaultRootWindow(display),0,0,100,100,1,CopyFromParent,InputOutput,CopyFromParent,CWBackPixel|CWEventMask|CWDontPropagate,&atr); fprintf(stderr,"Window: %i\n",window); XMapWindow(display,window); xic=XCreateIC( xim,XNInputStyle, XIMPreeditNothing | XIMStatusNothing , XNClientWindow, window , XNFocusWindow, window,0); fprintf(stderr,"XIC: %i\n",xic); if (xic) { r=DoEvents(display,xic); XDestroyIC(xic); return r; } return 1; } int DoIM(Display *display){ XIM xim; int r; xim=XOpenIM(display,NULL,"XIMTest","XIMTest"); fprintf(stderr,"XIM: %i\n",xim); if (xim) { r=DoIC(display,xim); XCloseIM(xim); return r; } return 1; } int DoLocale(Display *display){ int r; char *old_modifiers; setlocale(LC_ALL,""); if (XSupportsLocale()){ fprintf(stderr,"XLocale supported!\n"); old_modifiers=XSetLocaleModifiers("@im=none"); /* or old_modifiers=XSetLocaleModifiers(""); to check how XMODIFIERS variable works */ fprintf(stderr,"Old locale modifiers: '%s' (%p)\n",old_modifiers,old_modifiers); r=DoIM(display); } else{ fprintf(stderr,"XLocale not supported!\n"); return 1; } return r; } int main(){ Display *display; int r; display=XOpenDisplay(NULL); fprintf(stderr,"Display: %p\n",display); if (display) { r=DoLocale(display); XCloseDisplay(display); return r; } return 1; }