winex11: Directly use ntdll for utf8 conversion.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6afcd71a82
commit
bd721f0371
|
@ -914,12 +914,11 @@ static void *import_text_html( Atom type, const void *data, size_t size, size_t
|
|||
/* Firefox uses UTF-16LE with byte order mark. Convert to UTF-8 without the BOM. */
|
||||
if (size >= sizeof(WCHAR) && ((const WCHAR *)data)[0] == 0xfeff)
|
||||
{
|
||||
len = WideCharToMultiByte( CP_UTF8, 0, (const WCHAR *)data + 1, size / sizeof(WCHAR) - 1,
|
||||
NULL, 0, NULL, NULL );
|
||||
if (!(text = malloc( len ))) return 0;
|
||||
WideCharToMultiByte( CP_UTF8, 0, (const WCHAR *)data + 1, size / sizeof(WCHAR) - 1,
|
||||
text, len, NULL, NULL );
|
||||
size = len;
|
||||
DWORD str_len;
|
||||
RtlUnicodeToUTF8N( NULL, 0, &str_len, (const WCHAR *)data + 1, size - sizeof(WCHAR) );
|
||||
if (!(text = malloc( str_len ))) return NULL;
|
||||
RtlUnicodeToUTF8N( text, str_len, &str_len, (const WCHAR *)data + 1, size - sizeof(WCHAR) );
|
||||
size = str_len;
|
||||
data = text;
|
||||
}
|
||||
|
||||
|
|
|
@ -437,22 +437,23 @@ static void sync_window_opacity( Display *display, Window win,
|
|||
*/
|
||||
static void sync_window_text( Display *display, Window win, const WCHAR *text )
|
||||
{
|
||||
UINT count;
|
||||
DWORD count, len;
|
||||
char *buffer, *utf8_buffer;
|
||||
XTextProperty prop;
|
||||
|
||||
/* allocate new buffer for window text */
|
||||
len = lstrlenW( text );
|
||||
count = WideCharToMultiByte(CP_UNIXCP, 0, text, -1, NULL, 0, NULL, NULL);
|
||||
if (!(buffer = malloc( count ))) return;
|
||||
WideCharToMultiByte(CP_UNIXCP, 0, text, -1, buffer, count, NULL, NULL);
|
||||
|
||||
count = WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), NULL, 0, NULL, NULL);
|
||||
RtlUnicodeToUTF8N( NULL, 0, &count, text, len * sizeof(WCHAR) );
|
||||
if (!(utf8_buffer = malloc( count )))
|
||||
{
|
||||
free( buffer );
|
||||
return;
|
||||
}
|
||||
WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL);
|
||||
RtlUnicodeToUTF8N( utf8_buffer, count, &count, text, len * sizeof(WCHAR) );
|
||||
|
||||
if (XmbTextListToTextProperty( display, &buffer, 1, XStdICCTextStyle, &prop ) == Success)
|
||||
{
|
||||
|
|
|
@ -652,6 +652,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
|
|||
VkPhysicalDeviceIDProperties id;
|
||||
VkInstance vk_instance = NULL;
|
||||
VkDisplayKHR vk_display;
|
||||
DWORD len;
|
||||
BOOL ret = FALSE;
|
||||
VkResult vr;
|
||||
|
||||
|
@ -723,7 +724,8 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
|
|||
gpu->vendor_id = properties2.properties.vendorID;
|
||||
gpu->device_id = properties2.properties.deviceID;
|
||||
}
|
||||
MultiByteToWideChar( CP_UTF8, 0, properties2.properties.deviceName, -1, gpu->name, ARRAY_SIZE(gpu->name) );
|
||||
RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name), &len, properties2.properties.deviceName,
|
||||
strlen( properties2.properties.deviceName ) + 1 );
|
||||
ret = TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
@ -749,6 +751,7 @@ static BOOL xrandr14_get_gpus2( struct gdi_gpu **new_gpus, int *count, BOOL get_
|
|||
INT primary_provider = -1;
|
||||
RECT primary_rect;
|
||||
BOOL ret = FALSE;
|
||||
DWORD len;
|
||||
INT i, j;
|
||||
|
||||
screen_resources = xrandr_get_screen_resources();
|
||||
|
@ -803,7 +806,8 @@ static BOOL xrandr14_get_gpus2( struct gdi_gpu **new_gpus, int *count, BOOL get_
|
|||
if (get_properties)
|
||||
{
|
||||
if (!get_gpu_properties_from_vulkan( &gpus[i], provider_info ))
|
||||
MultiByteToWideChar( CP_UTF8, 0, provider_info->name, -1, gpus[i].name, ARRAY_SIZE(gpus[i].name) );
|
||||
RtlUTF8ToUnicodeN( gpus[i].name, sizeof(gpus[i].name), &len, provider_info->name,
|
||||
strlen( provider_info->name ) + 1 );
|
||||
/* FIXME: Add an alternate method of getting PCI IDs, for systems that don't support Vulkan */
|
||||
}
|
||||
pXRRFreeProviderInfo( provider_info );
|
||||
|
|
Loading…
Reference in New Issue