Small fix in wineconsole
Anatoly
vostok at etersoft.ru
Wed Nov 8 08:02:29 CST 2006
Hello!
Now we can read cyrillic symbols from keybord!!!
Changelog:
This patch reads out 4 bytes and translates them in WCHAR - values . It
is necessary for work of the console with UTF-8.
-------------- next part --------------
Index: programs/wineconsole/curses.c
===================================================================
RCS file: /home/wine/wine/programs/wineconsole/curses.c,v
retrieving revision 1.29
diff -u -p -u -r1.29 curses.c
--- programs/wineconsole/curses.c 5 Oct 2006 18:16:40 -0000 1.29
+++ programs/wineconsole/curses.c 8 Nov 2006 13:23:02 -0000
@@ -489,6 +495,12 @@ static unsigned WCCURSES_FillSimpleChar(
unsigned inchar;
unsigned numEvent = 0;
DWORD cks = 0;
+ WCHAR incharW;
+ unsigned uSizeUTF = 4;
+ int i=0;
+ unsigned incharWBuf[4] = {0,0,0,0};
+ unsigned char incharCBuf[4];
+ unsigned incharBuffer;
switch (real_inchar)
{
@@ -517,6 +529,22 @@ static unsigned WCCURSES_FillSimpleChar(
inchar = real_inchar;
break;
}
+
+ incharWBuf[0] = inchar;
+ i=1;
+ while( ((incharBuffer = wgetch(stdscr)) != ERR) && (i<4) )
+ {
+ incharWBuf[i] = incharBuffer;
+ i++;
+ }
+
+ for(i=0;i<uSizeUTF;i++)
+ incharCBuf[i] =(unsigned char) incharWBuf[i];
+ incharCBuf[uSizeUTF] = '\0';
+
+ MultiByteToWideChar(CP_UNIXCP, 0,&incharCBuf[0],uSizeUTF,&incharW, 1);
+ ir[numEvent].Event.KeyEvent.uChar.UnicodeChar = incharW;
+
if ((inchar & ~0xFF) != 0) WINE_FIXME("What a char (%u)\n", inchar);
vk = vkkeyscan_table[inchar];
if (vk & 0x0100)
@@ -538,8 +566,6 @@ static unsigned WCCURSES_FillSimpleChar(
ir[numEvent].Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
ir[numEvent].Event.KeyEvent.wVirtualKeyCode = vk;
ir[numEvent].Event.KeyEvent.wVirtualScanCode = mapvkey_0[vk & 0x00ff]; /* VirtualKeyCodes to ScanCode */
- ir[numEvent].Event.KeyEvent.uChar.UnicodeChar = (unsigned char)inchar;
-
ir[numEvent + 1] = ir[numEvent];
ir[numEvent + 1].Event.KeyEvent.bKeyDown = 0;
More information about the wine-patches
mailing list