Alexandre Julliard : wineandroid: Wait until we receive the desktop size before proceeding with startup.
Alexandre Julliard
julliard at winehq.org
Thu Jun 1 18:49:37 CDT 2017
Module: wine
Branch: master
Commit: bcd99f5c370a85998dfc7ac3650d96c298e79c71
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bcd99f5c370a85998dfc7ac3650d96c298e79c71
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jun 1 09:41:05 2017 +0200
wineandroid: Wait until we receive the desktop size before proceeding with startup.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wineandroid.drv/WineActivity.java | 3 ++-
dlls/wineandroid.drv/window.c | 41 +++++++++++++++++++++++++++++++
dlls/wineandroid.drv/wineandroid.drv.spec | 3 +++
3 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/dlls/wineandroid.drv/WineActivity.java b/dlls/wineandroid.drv/WineActivity.java
index 3696493..cc43bbe 100644
--- a/dlls/wineandroid.drv/WineActivity.java
+++ b/dlls/wineandroid.drv/WineActivity.java
@@ -70,7 +70,6 @@ public class WineActivity extends Activity
Locale.getDefault().getCountry() + ".UTF-8";
copyAssetFiles();
- runOnUiThread( new Runnable() { public void run() { progress_dialog.dismiss(); }});
HashMap<String,String> env = new HashMap<String,String>();
env.put( "WINELOADER", loader.toString() );
@@ -96,6 +95,8 @@ public class WineActivity extends Activity
log.delete();
}
+ createProgressDialog( 0, "Setting up the Windows environment..." );
+
System.load( libdir.toString() + "/libwine.so" );
prefix.mkdirs();
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index 971fd56..ba9f3b4 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -282,6 +282,28 @@ static int process_events( DWORD mask )
/***********************************************************************
+ * wait_events
+ */
+static int wait_events( int timeout )
+{
+ assert( GetCurrentThreadId() == desktop_tid );
+
+ for (;;)
+ {
+ struct pollfd pollfd;
+ int ret;
+
+ pollfd.fd = event_pipe[0];
+ pollfd.events = POLLIN | POLLHUP;
+ ret = poll( &pollfd, 1, timeout );
+ if (ret == -1 && errno == EINTR) continue;
+ if (ret && (pollfd.revents & (POLLHUP | POLLERR))) ret = -1;
+ return ret;
+ }
+}
+
+
+/***********************************************************************
* ANDROID_MsgWaitForMultipleObjectsEx
*/
DWORD CDECL ANDROID_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
@@ -411,3 +433,22 @@ void CDECL ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flag
TRACE( "win %p window %s client %s style %08x flags %08x\n",
hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), new_style, swp_flags );
}
+
+
+/***********************************************************************
+ * ANDROID_create_desktop
+ */
+BOOL CDECL ANDROID_create_desktop( UINT width, UINT height )
+{
+ /* wait until we receive the surface changed event */
+ while (!screen_width)
+ {
+ if (wait_events( 2000 ) != 1)
+ {
+ ERR( "wait timed out\n" );
+ break;
+ }
+ process_events( QS_ALLINPUT );
+ }
+ return TRUE;
+}
diff --git a/dlls/wineandroid.drv/wineandroid.drv.spec b/dlls/wineandroid.drv/wineandroid.drv.spec
index 49402a8..84ed7fd 100644
--- a/dlls/wineandroid.drv/wineandroid.drv.spec
+++ b/dlls/wineandroid.drv/wineandroid.drv.spec
@@ -11,3 +11,6 @@
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) ANDROID_MsgWaitForMultipleObjectsEx
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) ANDROID_WindowPosChanging
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) ANDROID_WindowPosChanged
+
+# Desktop
+@ cdecl wine_create_desktop(long long) ANDROID_create_desktop
More information about the wine-cvs
mailing list