Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
8a8d1b93
Commit
8a8d1b93
authored
Jul 09, 2003
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 09, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for CP_UNIXCP.
parent
37da1e67
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
126 additions
and
64 deletions
+126
-64
locale.c
dlls/kernel/locale.c
+86
-8
clipboard.c
dlls/x11drv/clipboard.c
+4
-12
keyboard.c
dlls/x11drv/keyboard.c
+0
-0
window.c
dlls/x11drv/window.c
+2
-19
configuring.sgml
documentation/configuring.sgml
+0
-12
config
documentation/samples/config
+0
-3
winnls.h
include/winnls.h
+2
-0
codepage.c
memory/codepage.c
+32
-8
properties.h
programs/winecfg/properties.h
+0
-1
winecfg.c
programs/winecfg/winecfg.c
+0
-1
No files found.
dlls/kernel/locale.c
View file @
8a8d1b93
...
...
@@ -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
{
...
...
@@ -334,9 +387,18 @@ 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
);
}
...
...
dlls/x11drv/clipboard.c
View file @
8a8d1b93
...
...
@@ -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 */
...
...
dlls/x11drv/keyboard.c
View file @
8a8d1b93
This diff is collapsed.
Click to expand it.
dlls/x11drv/window.c
View file @
8a8d1b93
...
...
@@ -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
)))
...
...
documentation/configuring.sgml
View file @
8a8d1b93
...
...
@@ -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>
...
...
documentation/samples/config
View file @
8a8d1b93
...
...
@@ -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"
...
...
include/winnls.h
View file @
8a8d1b93
...
...
@@ -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
...
...
memory/codepage.c
View file @
8a8d1b93
...
...
@@ -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
;
...
...
programs/winecfg/properties.h
View file @
8a8d1b93
...
...
@@ -68,7 +68,6 @@ typedef struct
int
nTakeFocus
;
int
nDXGrab
;
int
nDoubleBuffered
;
int
nTextCP
;
int
nXVideoPort
;
int
nSynchronous
;
}
X11DRV_DESC
;
...
...
programs/winecfg/winecfg.c
View file @
8a8d1b93
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment