Hi!
I have read much about Xlib and Xkb extension, till I have found the next comment: /* tell the libX11 that we will do input method handling ourselves * that keep libX11 from doing anything whith dead keys, allowing Wine * to have total control over dead keys, that is this line allows * them to work in Wine, even whith a libX11 including the dead key * patches from Th.Quinot (http://Web.FdN.FR/~tquinot/dead-keys.en.html) */ TSXOpenIM( display, NULL, NULL, NULL);
So I have realized, that the keysym conversion should be done manually. So I have replaced the error reporting with manual conversion.
I have looked at 'X11/keysymdef.h' to determine the meaning of the third byte (0xff00) of the KeySym, and built a confversion map to a windows codepage.
If a codepage is found, then it is used in a MultiByteToWideChar to convert the last byte of KeySym.
And it works. Tested with Hungarian, Serbian (cirillic) and Croatian (latinic - else same as serbian) keyboards, and it works perfectly. But it should work with all of them...
So please apply.
ChangeLog: Fixed KEYBOARD_ToUnicode to work with non Latin1 chars.
On Saturday 12 October 2002 22:34, Rizsanyi Zsolt wrote:
The problem is that XLookupString is used, which according to the Xlib documentation works only for Latin1 chars. It does _not_ takes locale settings into account. It is explicitly stated in the docs that XLookupString is for the cases when you dont need locale handling. If you want to handle locales you have to use the input method framework (described in a separate Xlib chapter). And I could not find a simple solution from those docs (tough this was the first case I have looked in the X's postscript documentation).
Regards Zsolt
Rizsanyi Zsolt wrote:
On Wednesday 09 October 2002 14:25, Rizsanyi Zsolt wrote:
Hi!
When running MS Word 97 I get the next error messages when I try to write some of the Hungarian characters. So I'm reporting it as requested in the message :)
err:keyboard:X11DRV_ToUnicode Please report: no char for keysym 01F5 (odoubleacute) : err:keyboard:X11DRV_ToUnicode (virtKey=DB,scanCode=1A,keycode=22,state=10) err:keyboard:X11DRV_ToUnicode Please report: no char for keysym 01FB (udoubleacute) : err:keyboard:X11DRV_ToUnicode (virtKey=DC,scanCode=2B,keycode=33,state=10)
Is it trivial to fix, or there are some problems with it? I would like if that could work... I'm also willing to code it if that is needed :)
I have investigated it, and the problem is in this code (from dlls/x11drv/keyboard.c):
else TRACE("Found keycode %d (0x%2X)\n",e.keycode,e.keycode);
ret = XLookupString(&e, (LPVOID)lpChar, 2, &keysym, NULL); wine_tsx11_unlock();
if (ret == 0) · { · BYTE dead_char;
· dead_char = KEYBOARD_MapDeadKeysym(keysym); · if (dead_char) · { · MultiByteToWideChar(main_key_tab[kbd_layout].layout_cp, 0, &dead_char, 1, bufW, bufW_siz e); · ret = -1; · } · else · { · char· *ksname;
· ksname = TSXKeysymToString(keysym); · if (!ksname) · · ksname = "No Name"; · if ((keysym >> 8) != 0xff) · · { · · ERR("Please report: no char for keysym %04lX (%s) :\n", keysym, ksname); · · ERR("(virtKey=%X,scanCode=%X,keycode=%X,state=%X)\n", virtKey, scanCode, e.keycode, e.state); · · } · } · }
The problems come from that the XLookupString is used to convert the keycode to the display string. It does properly display that the pressed key is odoubleacute, but because XLookupString works only for Latin1 characters, so the string representation is not returned.
I dont see how this situation should be handled. Maybe another X function should be used instead of XLookupString (one which works with chars other than Latin1).
I'm not too good in X programming so please HELP!!
Thanks Zsolt