Commit bcd99f5c authored by Alexandre Julliard's avatar Alexandre Julliard

wineandroid: Wait until we receive the desktop size before proceeding with startup.

parent 4123bbdd
......@@ -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();
......
......@@ -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;
}
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment