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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-06-01 09:41:05 +02:00
parent 4123bbdd84
commit bcd99f5c37
3 changed files with 46 additions and 1 deletions

View File

@ -70,7 +70,6 @@ private void loadWine( String cmdline )
Locale.getDefault().getCountry() + ".UTF-8"; Locale.getDefault().getCountry() + ".UTF-8";
copyAssetFiles(); copyAssetFiles();
runOnUiThread( new Runnable() { public void run() { progress_dialog.dismiss(); }});
HashMap<String,String> env = new HashMap<String,String>(); HashMap<String,String> env = new HashMap<String,String>();
env.put( "WINELOADER", loader.toString() ); env.put( "WINELOADER", loader.toString() );
@ -96,6 +95,8 @@ private void loadWine( String cmdline )
log.delete(); log.delete();
} }
createProgressDialog( 0, "Setting up the Windows environment..." );
System.load( libdir.toString() + "/libwine.so" ); System.load( libdir.toString() + "/libwine.so" );
prefix.mkdirs(); prefix.mkdirs();

View File

@ -281,6 +281,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 * ANDROID_MsgWaitForMultipleObjectsEx
*/ */
@ -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", 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 ); 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;
}

View File

@ -11,3 +11,6 @@
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) ANDROID_MsgWaitForMultipleObjectsEx @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) ANDROID_MsgWaitForMultipleObjectsEx
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) ANDROID_WindowPosChanging @ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) ANDROID_WindowPosChanging
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) ANDROID_WindowPosChanged @ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) ANDROID_WindowPosChanged
# Desktop
@ cdecl wine_create_desktop(long long) ANDROID_create_desktop