From: Fan WenJie fanwj@mail.ustc.edu.cn
Signed-off-by: Fan WenJie fanwj@mail.ustc.edu.cn --- dlls/wineandroid.drv/device.c | 2 +- dlls/wineandroid.drv/window.c | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c index 140ae82fe26..bfe00439d56 100644 --- a/dlls/wineandroid.drv/device.c +++ b/dlls/wineandroid.drv/device.c @@ -1187,7 +1187,7 @@ void start_android_device(void)
static int android_ioctl( enum android_ioctl code, void *in, DWORD in_size, void *out, DWORD *out_size ) { - static const WCHAR deviceW[] = {'\','\','.','\','W','i','n','e','A','n','d','r','o','i','d',0 }; + static const WCHAR deviceW[] = {'\','D','e','v','i','c','e','\','W','i','n','e','A','n','d','r','o','i','d',0 }; static HANDLE device; IO_STATUS_BLOCK iosb; NTSTATUS status; diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index d62a2c53909..b5eb1752222 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1210,6 +1210,18 @@ BOOL ANDROID_ProcessEvents( DWORD mask ) return FALSE; }
+static BOOL init_device(void) +{ + HWND hwnd = NtUserGetDesktopWindow(); + struct android_win_data *data; + + init_event_queue(); + start_android_device(); + if (!(data = alloc_win_data( hwnd ))) return FALSE; + release_win_data( data ); + return TRUE; +} + /********************************************************************** * ANDROID_CreateWindow */ @@ -1217,15 +1229,8 @@ BOOL ANDROID_CreateWindow( HWND hwnd ) { TRACE( "%p\n", hwnd );
- if (hwnd == NtUserGetDesktopWindow()) - { - struct android_win_data *data; - - init_event_queue(); - start_android_device(); - if (!(data = alloc_win_data( hwnd ))) return FALSE; - release_win_data( data ); - } + if (hwnd == NtUserGetDesktopWindow() && !screen_width) + return init_device(); return TRUE; }
@@ -1662,6 +1667,7 @@ LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) */ BOOL ANDROID_CreateDesktop( const WCHAR *name, UINT width, UINT height ) { + if (!(screen_width || init_device())) return FALSE; /* wait until we receive the surface changed event */ while (!screen_width) { @@ -1672,5 +1678,5 @@ BOOL ANDROID_CreateDesktop( const WCHAR *name, UINT width, UINT height ) } process_events( QS_ALLINPUT ); } - return 0; + return TRUE; }