Module: wine Branch: master Commit: 2fb8ea4d55a489619dde46d1020e4a6c9a3c0d1a URL: http://source.winehq.org/git/wine.git/?a=commit;h=2fb8ea4d55a489619dde46d102...
Author: Mikołaj Zalewski mikolaj@zalewski.pl Date: Tue Oct 3 21:08:32 2006 +0200
wineconsole: Make the user backend work on non-latin1 locales.
---
programs/wineconsole/user.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c index 2afd47a..fffd40f 100644 --- a/programs/wineconsole/user.c +++ b/programs/wineconsole/user.c @@ -21,12 +21,15 @@ #include <stdio.h> #include <stdlib.h> #include "winecon_user.h" +#include "winnls.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wineconsole); WINE_DECLARE_DEBUG_CHANNEL(wc_font);
+UINT g_uiDefaultCharset; + /* mapping console colors to RGB values */ COLORREF WCUSER_ColorMap[16] = { @@ -342,7 +345,7 @@ BOOL WCUSER_ValidateFontMetric(const str ret = (tm->tmMaxCharWidth * data->curcfg.win_width < GetSystemMetrics(SM_CXSCREEN) && tm->tmHeight * data->curcfg.win_height < GetSystemMetrics(SM_CYSCREEN)); return ret && !tm->tmItalic && !tm->tmUnderlined && !tm->tmStruckOut && - (tm->tmCharSet == DEFAULT_CHARSET || tm->tmCharSet == ANSI_CHARSET); + (tm->tmCharSet == DEFAULT_CHARSET || tm->tmCharSet == g_uiDefaultCharset); }
/****************************************************************** @@ -354,7 +357,7 @@ BOOL WCUSER_ValidateFont(const struct in { return (lf->lfPitchAndFamily & 3) == FIXED_PITCH && /* (lf->lfPitchAndFamily & 0xF0) == FF_MODERN && */ - (lf->lfCharSet == DEFAULT_CHARSET || lf->lfCharSet == ANSI_CHARSET); + (lf->lfCharSet == DEFAULT_CHARSET || lf->lfCharSet == g_uiDefaultCharset); }
/****************************************************************** @@ -1382,6 +1385,12 @@ enum init_return WCUSER_InitBackend(stru static const WCHAR wClassName[] = {'W','i','n','e','C','o','n','s','o','l','e','C','l','a','s','s',0};
WNDCLASS wndclass; + CHARSETINFO ci; + + if (!TranslateCharsetInfo((DWORD *)(INT_PTR)GetACP(), &ci, TCI_SRCCODEPAGE)) + return init_failed; + g_uiDefaultCharset = ci.ciCharset; + WINE_TRACE_(wc_font)("Code page %d => Default charset: %d\n", GetACP(), g_uiDefaultCharset);
data->private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct inner_data_user)); if (!data->private) return init_failed;