Small fix in wineconsole(out UTF)
Anatoly
vostok at etersoft.ru
Wed Nov 8 08:08:36 CST 2006
Hello!
Now we can out cyrillic symbols (and not only).
Changelog:
Now separately we deduce in wineconsole colors and attributes. Then
itself symbol in WCHAR - values.
-------------- 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:34:40 -0000
@@ -355,29 +355,35 @@ static void WCCURSES_Refresh(const struc
unsigned int x;
int y;
CHAR_INFO* cell;
- DWORD attr;
- char ch;
-
+ WCHAR incharW[2];
+ DWORD attr = 0;
+ attr_t xAttr = 0;
for (y = tp; y <= bm; y++)
{
cell = &data->cells[y * data->curcfg.sb_width];
for (x = 0; x < data->curcfg.sb_width; x++)
{
- WideCharToMultiByte(CP_ACP, 0, &cell[x].Char.UnicodeChar, 1,
- &ch, 1, NULL, NULL);
- attr = ((BYTE)ch < 32 || (BYTE)ch > 127) ? 32 : (BYTE)ch;
-
- if (cell[x].Attributes & FOREGROUND_RED) attr |= COLOR_PAIR(COLOR_RED);
- if (cell[x].Attributes & FOREGROUND_BLUE) attr |= COLOR_PAIR(COLOR_BLUE);
- if (cell[x].Attributes & FOREGROUND_GREEN) attr |= COLOR_PAIR(COLOR_GREEN);
- if (cell[x].Attributes & BACKGROUND_RED) attr |= COLOR_PAIR(COLOR_RED << 3);
- if (cell[x].Attributes & BACKGROUND_BLUE) attr |= COLOR_PAIR(COLOR_BLUE << 3);
- if (cell[x].Attributes & BACKGROUND_GREEN) attr |= COLOR_PAIR(COLOR_GREEN << 3);
-
- if (cell[x].Attributes & FOREGROUND_INTENSITY) attr |= A_BOLD;
+ incharW[0] = cell[x].Char.UnicodeChar;
+ incharW[1] = '\0';
+ attr = 0;
+ xAttr = 0;
+
+ if (cell[x].Attributes & FOREGROUND_RED) attr |= COLOR_RED;
+ if (cell[x].Attributes & FOREGROUND_BLUE) attr |= COLOR_BLUE;
+ if (cell[x].Attributes & FOREGROUND_GREEN) attr |= COLOR_GREEN;
+ if (cell[x].Attributes & BACKGROUND_RED) attr |= COLOR_RED << 3;
+ if (cell[x].Attributes & BACKGROUND_BLUE) attr |= COLOR_BLUE << 3;
+ if (cell[x].Attributes & BACKGROUND_GREEN) attr |= COLOR_GREEN << 3;
+ if (cell[x].Attributes & FOREGROUND_INTENSITY)
+ xAttr |= A_BOLD;
+ else
+ xAttr |= A_NORMAL;
+
PRIVATE(data)->line[x] = attr;
+ wattr_set(PRIVATE(data)->pad,xAttr,1,NULL);
+ wcolor_set(PRIVATE(data)->pad,attr,NULL);
+ mvwaddnwstr(PRIVATE(data)->pad, y, x,(wchar_t*)&incharW[0],1);
}
- mvwaddchnstr(PRIVATE(data)->pad, y, 0, PRIVATE(data)->line, data->curcfg.sb_width);
}
WCCURSES_PosCursor(data);
More information about the wine-patches
mailing list