From 2fb8ea4d55a489619dde46d1020e4a6c9a3c0d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Zalewski?= Date: Tue, 3 Oct 2006 21:08:32 +0200 Subject: [PATCH] wineconsole: Make the user backend work on non-latin1 locales. --- programs/wineconsole/user.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c index 2afd47a4d5a..fffd40fc8a4 100644 --- a/programs/wineconsole/user.c +++ b/programs/wineconsole/user.c @@ -21,12 +21,15 @@ #include #include #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 struct inner_data* data, const TEXTMETRIC* 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 inner_data* data, const LOGFONT* lf) { 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(struct inner_data* data) 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;