From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/wineandroid.drv/android.h | 7 +++++++ dlls/wineandroid.drv/keyboard.c | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 93e3c2201bf..a7581d1b67f 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -187,4 +187,11 @@ extern JavaVM **p_java_vm; extern jobject *p_java_object; extern unsigned short *p_java_gdt_sel;
+/* string helpers */ + +static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) +{ + while (len--) *dst++ = (unsigned char)*src++; +} + #endif /* __WINE_ANDROID_H */ diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c index 00a55c697c6..e92079c0f59 100644 --- a/dlls/wineandroid.drv/keyboard.c +++ b/dlls/wineandroid.drv/keyboard.c @@ -32,7 +32,6 @@ #include "config.h"
#include "android.h" -#include "wine/unicode.h" #include "wine/server.h" #include "wine/debug.h"
@@ -802,9 +801,11 @@ INT ANDROID_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
if (!len) { - static const WCHAR format[] = {'K','e','y',' ','0','x','%','0','2','x',0}; - snprintfW( buffer, size, format, vkey ); - len = strlenW( buffer ); + char name[16]; + len = sprintf( name, "Key 0x%02x", vkey ); + len = min( len + 1, size ); + ascii_to_unicode( buffer, name, len ); + if (len) buffer[--len] = 0; }
TRACE( "lparam 0x%08x -> %s\n", lparam, debugstr_w( buffer ));