mirror of
https://github.com/reactos/wine.git
synced 2025-01-19 10:13:01 +00:00
Added support for CP_UNIXCP.
This commit is contained in:
parent
37da1e6757
commit
8a8d1b93ca
@ -43,7 +43,60 @@ WINE_DEFAULT_DEBUG_CHANNEL(nls);
|
||||
|
||||
#define LOCALE_LOCALEINFOFLAGSMASK (LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP|LOCALE_RETURN_NUMBER)
|
||||
|
||||
extern void CODEPAGE_Init( UINT ansi, UINT oem, UINT mac, LCID lcid );
|
||||
extern void CODEPAGE_Init( UINT ansi_cp, UINT oem_cp, UINT mac_cp, UINT unix_cp, LCID lcid );
|
||||
|
||||
/* Charset to codepage map, sorted by name. */
|
||||
static const struct charset_entry
|
||||
{
|
||||
const char *charset_name;
|
||||
UINT codepage;
|
||||
} charset_names[] =
|
||||
{
|
||||
{ "CP1250", 1250 },
|
||||
{ "CP1251", 1251 },
|
||||
{ "CP1252", 1252 },
|
||||
{ "CP1253", 1253 },
|
||||
{ "CP1254", 1254 },
|
||||
{ "CP1255", 1255 },
|
||||
{ "CP1256", 1256 },
|
||||
{ "CP1257", 1257 },
|
||||
{ "CP1258", 1258 },
|
||||
{ "IBM037", 37 },
|
||||
{ "IBM1026", 1026 },
|
||||
{ "IBM424", 424 },
|
||||
{ "IBM437", 437 },
|
||||
{ "IBM500", 500 },
|
||||
{ "IBM850", 850 },
|
||||
{ "IBM852", 852 },
|
||||
{ "IBM855", 855 },
|
||||
{ "IBM857", 857 },
|
||||
{ "IBM860", 860 },
|
||||
{ "IBM861", 861 },
|
||||
{ "IBM862", 862 },
|
||||
{ "IBM863", 863 },
|
||||
{ "IBM864", 864 },
|
||||
{ "IBM865", 865 },
|
||||
{ "IBM866", 866 },
|
||||
{ "IBM869", 869 },
|
||||
{ "IBM874", 874 },
|
||||
{ "IBM875", 875 },
|
||||
{ "ISO-8859-1", 28591 },
|
||||
{ "ISO-8859-10", 28600 },
|
||||
{ "ISO-8859-13", 28603 },
|
||||
{ "ISO-8859-14", 28604 },
|
||||
{ "ISO-8859-15", 28605 },
|
||||
{ "ISO-8859-2", 28592 },
|
||||
{ "ISO-8859-3", 28593 },
|
||||
{ "ISO-8859-4", 28594 },
|
||||
{ "ISO-8859-5", 28595 },
|
||||
{ "ISO-8859-6", 28596 },
|
||||
{ "ISO-8859-7", 28597 },
|
||||
{ "ISO-8859-8", 28598 },
|
||||
{ "ISO-8859-9", 28599 },
|
||||
{ "KOI8-R", 20866 },
|
||||
{ "KOI8-U", 20866 },
|
||||
{ "UTF-8", CP_UTF8 }
|
||||
};
|
||||
|
||||
#define NLS_MAX_LANGUAGES 20
|
||||
typedef struct {
|
||||
@ -333,10 +386,19 @@ END:
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* charset_cmp (internal)
|
||||
*/
|
||||
static int charset_cmp( const void *name, const void *entry )
|
||||
{
|
||||
const struct charset_entry *charset = (struct charset_entry *)entry;
|
||||
return strcasecmp( (char *)name, charset->charset_name );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* init_default_lcid
|
||||
*/
|
||||
static LCID init_default_lcid(void)
|
||||
static LCID init_default_lcid( UINT *unix_cp )
|
||||
{
|
||||
char buf[256];
|
||||
char *lang,*country,*charset,*dialect,*next;
|
||||
@ -359,6 +421,19 @@ static LCID init_default_lcid(void)
|
||||
country=strchr(lang,'_'); if (country) *country++='\0';
|
||||
|
||||
ret = get_language_id(lang, country, charset, dialect);
|
||||
if (ret && charset)
|
||||
{
|
||||
const struct charset_entry *entry;
|
||||
entry = bsearch( charset, charset_names, sizeof(charset_names)/sizeof(charset_names[0]),
|
||||
sizeof(charset_names[0]), charset_cmp );
|
||||
if (entry)
|
||||
{
|
||||
*unix_cp = entry->codepage;
|
||||
TRACE("charset %s was mapped to cp %u\n", charset, *unix_cp);
|
||||
}
|
||||
else
|
||||
FIXME("charset %s was not recognized\n", charset);
|
||||
}
|
||||
|
||||
lang=next;
|
||||
} while (lang && !ret);
|
||||
@ -1316,20 +1391,23 @@ int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
|
||||
*/
|
||||
void LOCALE_Init(void)
|
||||
{
|
||||
UINT ansi = 1252, oem = 437, mac = 10000;
|
||||
LCID lcid = init_default_lcid();
|
||||
UINT ansi_cp = 1252, oem_cp = 437, mac_cp = 10000, unix_cp = -1;
|
||||
LCID lcid = init_default_lcid( &unix_cp );
|
||||
|
||||
NtSetDefaultLocale( FALSE, lcid );
|
||||
NtSetDefaultLocale( TRUE, lcid );
|
||||
|
||||
GetLocaleInfoW( lcid, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(LPWSTR)&ansi, sizeof(ansi)/sizeof(WCHAR) );
|
||||
(LPWSTR)&ansi_cp, sizeof(ansi_cp)/sizeof(WCHAR) );
|
||||
GetLocaleInfoW( lcid, LOCALE_IDEFAULTMACCODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(LPWSTR)&mac, sizeof(mac)/sizeof(WCHAR) );
|
||||
(LPWSTR)&mac_cp, sizeof(mac_cp)/sizeof(WCHAR) );
|
||||
GetLocaleInfoW( lcid, LOCALE_IDEFAULTCODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(LPWSTR)&oem, sizeof(oem)/sizeof(WCHAR) );
|
||||
(LPWSTR)&oem_cp, sizeof(oem_cp)/sizeof(WCHAR) );
|
||||
if (unix_cp == -1)
|
||||
GetLocaleInfoW( lcid, LOCALE_IDEFAULTUNIXCODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(LPWSTR)&unix_cp, sizeof(unix_cp)/sizeof(WCHAR) );
|
||||
|
||||
CODEPAGE_Init( ansi, oem, mac, lcid );
|
||||
CODEPAGE_Init( ansi_cp, oem_cp, mac_cp, unix_cp, lcid );
|
||||
update_registry( lcid );
|
||||
}
|
||||
|
||||
|
@ -955,7 +955,6 @@ HANDLE X11DRV_CLIPBOARD_ImportXAString(LPBYTE lpdata, UINT cBytes)
|
||||
if ((lpstr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cBytes + inlcount + 1)))
|
||||
{
|
||||
UINT count;
|
||||
UINT text_cp = CP_ACP;
|
||||
|
||||
for (i = 0, inlcount = 0; i <= cBytes; i++)
|
||||
{
|
||||
@ -965,16 +964,13 @@ HANDLE X11DRV_CLIPBOARD_ImportXAString(LPBYTE lpdata, UINT cBytes)
|
||||
lpstr[inlcount++] = lpdata[i];
|
||||
}
|
||||
|
||||
GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTUNIXCODEPAGE |
|
||||
LOCALE_RETURN_NUMBER, (WCHAR *)&text_cp, (sizeof(UINT)/sizeof(WCHAR)));
|
||||
|
||||
count = MultiByteToWideChar(text_cp, 0, lpstr, -1, NULL, 0);
|
||||
count = MultiByteToWideChar(CP_UNIXCP, 0, lpstr, -1, NULL, 0);
|
||||
hUnicodeText = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, count * sizeof(WCHAR));
|
||||
|
||||
if(hUnicodeText)
|
||||
{
|
||||
WCHAR *textW = GlobalLock(hUnicodeText);
|
||||
MultiByteToWideChar(text_cp, 0, lpstr, -1, textW, count);
|
||||
MultiByteToWideChar(CP_UNIXCP, 0, lpstr, -1, textW, count);
|
||||
GlobalUnlock(hUnicodeText);
|
||||
}
|
||||
|
||||
@ -1104,21 +1100,17 @@ HANDLE X11DRV_CLIPBOARD_ExportXAString(LPWINE_CLIPDATA lpData, LPDWORD lpBytes)
|
||||
UINT size;
|
||||
LPWSTR uni_text;
|
||||
LPSTR text, lpstr;
|
||||
UINT text_cp = CP_ACP;
|
||||
|
||||
*lpBytes = 0; /* Assume return has zero bytes */
|
||||
|
||||
GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTUNIXCODEPAGE |
|
||||
LOCALE_RETURN_NUMBER, (WCHAR *)&text_cp, (sizeof(UINT)/sizeof(WCHAR)));
|
||||
|
||||
uni_text = GlobalLock(lpData->hData32);
|
||||
|
||||
size = WideCharToMultiByte(text_cp, 0, uni_text, -1, NULL, 0, NULL, NULL);
|
||||
size = WideCharToMultiByte(CP_UNIXCP, 0, uni_text, -1, NULL, 0, NULL, NULL);
|
||||
|
||||
text = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
if (!text)
|
||||
return None;
|
||||
WideCharToMultiByte(text_cp, 0, uni_text, -1, text, size, NULL, NULL);
|
||||
WideCharToMultiByte(CP_UNIXCP, 0, uni_text, -1, text, size, NULL, NULL);
|
||||
|
||||
/* remove carriage returns */
|
||||
|
||||
|
@ -670,63 +670,62 @@ static const char main_key_vnc[MAIN_LEN][4] =
|
||||
/*** Layout table. Add your keyboard mappings to this list */
|
||||
static const struct {
|
||||
const char *comment;
|
||||
const UINT layout_cp; /* Code page for this layout */
|
||||
const char (*key)[MAIN_LEN][4];
|
||||
const WORD (*scan)[MAIN_LEN]; /* scan codes mapping */
|
||||
const WORD (*vkey)[MAIN_LEN]; /* virtual key codes mapping */
|
||||
} main_key_tab[]={
|
||||
{"United States keyboard layout", 28591, &main_key_US, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"United States keyboard layout (phantom key version)", 28591, &main_key_US_phantom, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"United States keyboard layout (dvorak)", 28591, &main_key_US_dvorak, &main_key_scan_dvorak, &main_key_vkey_dvorak},
|
||||
{"British keyboard layout", 28605, &main_key_UK, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout", 28605, &main_key_DE, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout without dead keys", 28605, &main_key_DE_nodead, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout for logitech desktop pro", 28605, &main_key_DE_logitech, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout without dead keys 105", 28605, &main_key_DE_nodead_105, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Swiss German keyboard layout", 28605, &main_key_SG, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Swedish keyboard layout", 28605, &main_key_SE, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Estonian keyboard layout", 28605, &main_key_ET, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Norwegian keyboard layout", 28605, &main_key_NO, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Danish keyboard layout", 28605, &main_key_DA, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"French keyboard layout", 28605, &main_key_FR, &main_key_scan_qwerty, &main_key_vkey_azerty},
|
||||
{"Canadian French keyboard layout", 28591, &main_key_CF, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Belgian keyboard layout", 28605, &main_key_BE, &main_key_scan_qwerty, &main_key_vkey_azerty},
|
||||
{"Swiss French keyboard layout", 28605, &main_key_SF, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Portuguese keyboard layout", 28605, &main_key_PT, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Brazilian ABNT-2 keyboard layout", 28591, &main_key_PT_br, &main_key_scan_abnt_qwerty, &main_key_vkey_abnt_qwerty},
|
||||
{"Brazilian ABNT-2 keyboard layout ALT GR", 28591, &main_key_PT_br_alt_gr,&main_key_scan_abnt_qwerty, &main_key_vkey_abnt_qwerty},
|
||||
{"United States International keyboard layout", 28591, &main_key_US_intl, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Finnish keyboard layout", 28605, &main_key_FI, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Bulgarian bds keyboard layout", 1251, &main_key_BG_bds, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Bulgarian phonetic keyboard layout", 1251, &main_key_BG_phonetic, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Belarusian keyboard layout", 1251, &main_key_BY, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Russian keyboard layout", 20866, &main_key_RU, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Russian keyboard layout (phantom key version)", 20866, &main_key_RU_phantom, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Russian keyboard layout KOI8-R", 20866, &main_key_RU_koi8r, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Ukrainian keyboard layout KOI8-U", 20866, &main_key_UA, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Spanish keyboard layout", 28605, &main_key_ES, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Italian keyboard layout", 28605, &main_key_IT, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Icelandic keyboard layout", 28605, &main_key_IS, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Hungarian keyboard layout", 28592, &main_key_HU, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Polish (programmer's) keyboard layout", 28592, &main_key_PL, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Slovenian keyboard layout", 28592, &main_key_SI, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Croatian keyboard layout", 28592, &main_key_HR, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Croatian keyboard layout (specific)", 28592, &main_key_HR_jelly, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Japanese 106 keyboard layout", 932, &main_key_JA_jp106, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Japanese pc98x1 keyboard layout", 932, &main_key_JA_pc98x1, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Slovak keyboard layout", 28592, &main_key_SK, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Slovak and Czech keyboard layout without dead keys", 28592, &main_key_SK_prog, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Czech keyboard layout", 28592, &main_key_CS, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Czech keyboard layout cz", 28592, &main_key_CZ, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Czech keyboard layout cz_qwerty", 28592, &main_key_CZ_qwerty, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Latin American keyboard layout", 28591, &main_key_LA, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Lithuanian (Baltic) keyboard layout", 28603, &main_key_LT_B, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Turkish keyboard layout", 28599, &main_key_TK, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Israeli keyboard layout", 28598, &main_key_IL, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"VNC keyboard layout", 28605, &main_key_vnc, &main_key_scan_vnc, &main_key_vkey_vnc},
|
||||
{"Greek keyboard layout", 28597, &main_key_EL, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"United States keyboard layout", &main_key_US, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"United States keyboard layout (phantom key version)", &main_key_US_phantom, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"United States keyboard layout (dvorak)", &main_key_US_dvorak, &main_key_scan_dvorak, &main_key_vkey_dvorak},
|
||||
{"British keyboard layout", &main_key_UK, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout", &main_key_DE, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout without dead keys", &main_key_DE_nodead, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout for logitech desktop pro", &main_key_DE_logitech, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"German keyboard layout without dead keys 105", &main_key_DE_nodead_105, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Swiss German keyboard layout", &main_key_SG, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Swedish keyboard layout", &main_key_SE, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Estonian keyboard layout", &main_key_ET, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Norwegian keyboard layout", &main_key_NO, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Danish keyboard layout", &main_key_DA, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"French keyboard layout", &main_key_FR, &main_key_scan_qwerty, &main_key_vkey_azerty},
|
||||
{"Canadian French keyboard layout", &main_key_CF, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Belgian keyboard layout", &main_key_BE, &main_key_scan_qwerty, &main_key_vkey_azerty},
|
||||
{"Swiss French keyboard layout", &main_key_SF, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Portuguese keyboard layout", &main_key_PT, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Brazilian ABNT-2 keyboard layout", &main_key_PT_br, &main_key_scan_abnt_qwerty, &main_key_vkey_abnt_qwerty},
|
||||
{"Brazilian ABNT-2 keyboard layout ALT GR", &main_key_PT_br_alt_gr,&main_key_scan_abnt_qwerty, &main_key_vkey_abnt_qwerty},
|
||||
{"United States International keyboard layout", &main_key_US_intl, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Finnish keyboard layout", &main_key_FI, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Bulgarian bds keyboard layout", &main_key_BG_bds, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Bulgarian phonetic keyboard layout", &main_key_BG_phonetic, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Belarusian keyboard layout", &main_key_BY, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Russian keyboard layout", &main_key_RU, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Russian keyboard layout (phantom key version)", &main_key_RU_phantom, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Russian keyboard layout KOI8-R", &main_key_RU_koi8r, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Ukrainian keyboard layout KOI8-U", &main_key_UA, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Spanish keyboard layout", &main_key_ES, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Italian keyboard layout", &main_key_IT, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Icelandic keyboard layout", &main_key_IS, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Hungarian keyboard layout", &main_key_HU, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Polish (programmer's) keyboard layout", &main_key_PL, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Slovenian keyboard layout", &main_key_SI, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Croatian keyboard layout", &main_key_HR, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Croatian keyboard layout (specific)", &main_key_HR_jelly, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Japanese 106 keyboard layout", &main_key_JA_jp106, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Japanese pc98x1 keyboard layout", &main_key_JA_pc98x1, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Slovak keyboard layout", &main_key_SK, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Slovak and Czech keyboard layout without dead keys", &main_key_SK_prog, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Czech keyboard layout", &main_key_CS, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Czech keyboard layout cz", &main_key_CZ, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Czech keyboard layout cz_qwerty", &main_key_CZ_qwerty, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Latin American keyboard layout", &main_key_LA, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Lithuanian (Baltic) keyboard layout", &main_key_LT_B, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Turkish keyboard layout", &main_key_TK, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"Israeli keyboard layout", &main_key_IL, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
{"VNC keyboard layout", &main_key_vnc, &main_key_scan_vnc, &main_key_vkey_vnc},
|
||||
{"Greek keyboard layout", &main_key_EL, &main_key_scan_qwerty, &main_key_vkey_qwerty},
|
||||
|
||||
{NULL, 0, NULL, NULL, NULL} /* sentinel */
|
||||
{NULL, NULL, NULL, NULL} /* sentinel */
|
||||
};
|
||||
static unsigned kbd_layout=0; /* index into above table of layouts */
|
||||
|
||||
@ -1847,7 +1846,7 @@ INT X11DRV_ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
||||
dead_char = KEYBOARD_MapDeadKeysym(keysym);
|
||||
if (dead_char)
|
||||
{
|
||||
MultiByteToWideChar(main_key_tab[kbd_layout].layout_cp, 0, &dead_char, 1, bufW, bufW_size);
|
||||
MultiByteToWideChar(CP_UNIXCP, 0, &dead_char, 1, bufW, bufW_size);
|
||||
ret = -1;
|
||||
}
|
||||
else
|
||||
@ -1906,9 +1905,8 @@ INT X11DRV_ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
||||
/* perform translation to unicode */
|
||||
if(ret)
|
||||
{
|
||||
TRACE_(key)("Translating char 0x%02x from code page %d to unicode\n",
|
||||
*(BYTE *)lpChar, main_key_tab[kbd_layout].layout_cp);
|
||||
ret = MultiByteToWideChar(main_key_tab[kbd_layout].layout_cp, 0, lpChar, ret, bufW, bufW_size);
|
||||
TRACE_(key)("Translating char 0x%02x to unicode\n", *(BYTE *)lpChar);
|
||||
ret = MultiByteToWideChar(CP_UNIXCP, 0, lpChar, ret, bufW, bufW_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,36 +794,19 @@ BOOL X11DRV_SetWindowText( HWND hwnd, LPCWSTR text )
|
||||
UINT count;
|
||||
char *buffer;
|
||||
char *utf8_buffer;
|
||||
static UINT text_cp = (UINT)-1;
|
||||
Window win;
|
||||
XTextProperty prop;
|
||||
|
||||
if ((win = X11DRV_get_whole_window( hwnd )))
|
||||
{
|
||||
if (text_cp == (UINT)-1)
|
||||
{
|
||||
HKEY hkey;
|
||||
/* default value */
|
||||
text_cp = CP_ACP;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\x11drv", &hkey))
|
||||
{
|
||||
char buffer[20];
|
||||
DWORD type, count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "TextCP", 0, &type, buffer, &count))
|
||||
text_cp = atoi(buffer);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
TRACE("text_cp = %u\n", text_cp);
|
||||
}
|
||||
|
||||
/* allocate new buffer for window text */
|
||||
count = WideCharToMultiByte(text_cp, 0, text, -1, NULL, 0, NULL, NULL);
|
||||
count = WideCharToMultiByte(CP_UNIXCP, 0, text, -1, NULL, 0, NULL, NULL);
|
||||
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, count )))
|
||||
{
|
||||
ERR("Not enough memory for window text\n");
|
||||
return FALSE;
|
||||
}
|
||||
WideCharToMultiByte(text_cp, 0, text, -1, buffer, count, NULL, NULL);
|
||||
WideCharToMultiByte(CP_UNIXCP, 0, text, -1, buffer, count, NULL, NULL);
|
||||
|
||||
count = WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), NULL, 0, NULL, NULL);
|
||||
if (!(utf8_buffer = HeapAlloc( GetProcessHeap(), 0, count )))
|
||||
|
@ -2851,18 +2851,6 @@ with the <literal>GraphicsDriver</literal> option in the
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>TextCP</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Codepage to be used for rendering the text in X11
|
||||
output. Some sample values would be 437 (USA, Canada),
|
||||
850 (Europe), 852 (Central/Eastern Europe), 855
|
||||
(Cyrillic). For additional suitable values, see e.g. the Linux
|
||||
kernel's codepage configuration page.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
@ -135,9 +135,6 @@ WINE REGISTRY Version 2
|
||||
; Create the desktop window with a double-buffered visual
|
||||
; (useful to play OpenGL games)
|
||||
"DesktopDoubleBuffered" = "N"
|
||||
; Code page used for captions in managed mode
|
||||
; 0 means default ANSI code page (CP_ACP == 0)
|
||||
"TextCP" = "0"
|
||||
; Use this if you have more than one port for video on your setup
|
||||
; (Wine uses for now the first 'input image' it finds).
|
||||
;; "XVideoPort" = "43"
|
||||
|
@ -176,6 +176,8 @@ extern "C" {
|
||||
#define CP_UTF7 65000
|
||||
#define CP_UTF8 65001
|
||||
|
||||
#define CP_UNIXCP 65010 /* Wine extension */
|
||||
|
||||
#define WC_DISCARDNS 0x00000010
|
||||
#define WC_SEPCHARS 0x00000020
|
||||
#define WC_DEFAULTCHAR 0x00000040
|
||||
|
@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(string);
|
||||
static const union cptable *ansi_cptable;
|
||||
static const union cptable *oem_cptable;
|
||||
static const union cptable *mac_cptable;
|
||||
static const union cptable *unix_cptable; /* NULL if UTF8 */
|
||||
static LCID default_lcid = MAKELCID( MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT), SORT_DEFAULT );
|
||||
|
||||
/* setup default codepage info before we can get at the locale stuff */
|
||||
@ -44,9 +45,11 @@ static void init_codepages(void)
|
||||
ansi_cptable = wine_cp_get_table( 1252 );
|
||||
oem_cptable = wine_cp_get_table( 437 );
|
||||
mac_cptable = wine_cp_get_table( 10000 );
|
||||
unix_cptable = wine_cp_get_table( 28591 );
|
||||
assert( ansi_cptable );
|
||||
assert( oem_cptable );
|
||||
assert( mac_cptable );
|
||||
assert( unix_cptable );
|
||||
}
|
||||
|
||||
/* find the table for a given codepage, handling CP_ACP etc. pseudo-codepages */
|
||||
@ -83,21 +86,27 @@ static const union cptable *get_codepage_table( unsigned int codepage )
|
||||
/* initialize default code pages from locale info */
|
||||
/* FIXME: should be done in init_codepages, but it can't right now */
|
||||
/* since it needs KERNEL32 to be loaded for the locale info. */
|
||||
void CODEPAGE_Init( UINT ansi, UINT oem, UINT mac, LCID lcid )
|
||||
void CODEPAGE_Init( UINT ansi_cp, UINT oem_cp, UINT mac_cp, UINT unix_cp, LCID lcid )
|
||||
{
|
||||
extern void __wine_init_codepages( const union cptable *ansi, const union cptable *oem );
|
||||
extern void __wine_init_codepages( const union cptable *ansi_cp, const union cptable *oem_cp );
|
||||
const union cptable *table;
|
||||
|
||||
default_lcid = lcid;
|
||||
if (!ansi_cptable) init_codepages(); /* just in case */
|
||||
|
||||
if ((table = wine_cp_get_table( ansi ))) ansi_cptable = table;
|
||||
if ((table = wine_cp_get_table( oem ))) oem_cptable = table;
|
||||
if ((table = wine_cp_get_table( mac ))) mac_cptable = table;
|
||||
if ((table = wine_cp_get_table( ansi_cp ))) ansi_cptable = table;
|
||||
if ((table = wine_cp_get_table( oem_cp ))) oem_cptable = table;
|
||||
if ((table = wine_cp_get_table( mac_cp ))) mac_cptable = table;
|
||||
if (unix_cp == CP_UTF8)
|
||||
unix_cptable = NULL;
|
||||
else if ((table = wine_cp_get_table( unix_cp )))
|
||||
unix_cptable = table;
|
||||
|
||||
__wine_init_codepages( ansi_cptable, oem_cptable );
|
||||
|
||||
TRACE( "ansi=%03d oem=%03d mac=%03d\n", ansi_cptable->info.codepage,
|
||||
oem_cptable->info.codepage, mac_cptable->info.codepage );
|
||||
TRACE( "ansi=%03d oem=%03d mac=%03d unix=%03d\n",
|
||||
ansi_cptable->info.codepage, oem_cptable->info.codepage,
|
||||
mac_cptable->info.codepage, unix_cp );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@ -336,9 +345,16 @@ INT WINAPI MultiByteToWideChar( UINT page, DWORD flags, LPCSTR src, INT srclen,
|
||||
switch(page)
|
||||
{
|
||||
case CP_UTF7:
|
||||
FIXME("UTF not supported\n");
|
||||
FIXME("UTF-7 not supported\n");
|
||||
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
|
||||
return 0;
|
||||
case CP_UNIXCP:
|
||||
if (unix_cptable)
|
||||
{
|
||||
ret = wine_cp_mbstowcs( unix_cptable, flags, src, srclen, dst, dstlen );
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case CP_UTF8:
|
||||
ret = wine_utf8_mbstowcs( flags, src, srclen, dst, dstlen );
|
||||
break;
|
||||
@ -412,6 +428,14 @@ INT WINAPI WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen,
|
||||
FIXME("UTF-7 not supported\n");
|
||||
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
|
||||
return 0;
|
||||
case CP_UNIXCP:
|
||||
if (unix_cptable)
|
||||
{
|
||||
ret = wine_cp_wcstombs( unix_cptable, flags, src, srclen, dst, dstlen,
|
||||
defchar, used ? &used_tmp : NULL );
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case CP_UTF8:
|
||||
ret = wine_utf8_wcstombs( src, srclen, dst, dstlen );
|
||||
break;
|
||||
|
@ -68,7 +68,6 @@ typedef struct
|
||||
int nTakeFocus;
|
||||
int nDXGrab;
|
||||
int nDoubleBuffered;
|
||||
int nTextCP;
|
||||
int nXVideoPort;
|
||||
int nSynchronous;
|
||||
} X11DRV_DESC;
|
||||
|
@ -214,7 +214,6 @@ int loadConfig (WINECFG_DESC* pCfg)
|
||||
pCfg->sX11Drv.nTakeFocus = 1;
|
||||
pCfg->sX11Drv.nDXGrab = 0;
|
||||
pCfg->sX11Drv.nDoubleBuffered = 0;
|
||||
pCfg->sX11Drv.nTextCP = 0;
|
||||
pCfg->sX11Drv.nXVideoPort = 43;
|
||||
pCfg->sX11Drv.nSynchronous = 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user