Commit 44ee3bf8 authored by Alexandre Julliard's avatar Alexandre Julliard

wineandroid: Hold on to the native window until we get a new one.

parent 83bed850
...@@ -311,6 +311,8 @@ public class WineActivity extends Activity ...@@ -311,6 +311,8 @@ public class WineActivity extends Activity
protected WineWindow parent; protected WineWindow parent;
protected Surface window_surface; protected Surface window_surface;
protected Surface client_surface; protected Surface client_surface;
protected SurfaceTexture window_surftex;
protected SurfaceTexture client_surftex;
protected WineWindowGroup window_group; protected WineWindowGroup window_group;
protected WineWindowGroup client_group; protected WineWindowGroup client_group;
...@@ -442,14 +444,22 @@ public class WineActivity extends Activity ...@@ -442,14 +444,22 @@ public class WineActivity extends Activity
if (is_client) if (is_client)
{ {
if (surftex == null) client_surface = null; if (surftex == null) client_surface = null;
else if (client_surface == null) client_surface = new Surface( surftex ); else if (surftex != client_surftex)
{
client_surftex = surftex;
client_surface = new Surface( surftex );
}
Log.i( LOGTAG, String.format( "set client surface hwnd %08x %s", hwnd, client_surface )); Log.i( LOGTAG, String.format( "set client surface hwnd %08x %s", hwnd, client_surface ));
wine_surface_changed( hwnd, client_surface, true ); wine_surface_changed( hwnd, client_surface, true );
} }
else else
{ {
if (surftex == null) window_surface = null; if (surftex == null) window_surface = null;
else if (window_surface == null) window_surface = new Surface( surftex ); else if (surftex != window_surftex)
{
window_surftex = surftex;
window_surface = new Surface( surftex );
}
Log.i( LOGTAG, String.format( "set window surface hwnd %08x %s", hwnd, window_surface )); Log.i( LOGTAG, String.format( "set window surface hwnd %08x %s", hwnd, window_surface ));
wine_surface_changed( hwnd, window_surface, false ); wine_surface_changed( hwnd, window_surface, false );
} }
...@@ -567,7 +577,7 @@ public class WineActivity extends Activity ...@@ -567,7 +577,7 @@ public class WineActivity extends Activity
Log.i( LOGTAG, String.format( "onSurfaceTextureDestroyed win %08x %s", Log.i( LOGTAG, String.format( "onSurfaceTextureDestroyed win %08x %s",
window.hwnd, is_client ? "client" : "whole" )); window.hwnd, is_client ? "client" : "whole" ));
window.set_surface( null, is_client ); window.set_surface( null, is_client );
return true; return false; // hold on to the texture since the app may still be using it
} }
public void onSurfaceTextureUpdated(SurfaceTexture surftex) public void onSurfaceTextureUpdated(SurfaceTexture surftex)
......
...@@ -463,6 +463,8 @@ static void CALLBACK register_native_window_callback( ULONG_PTR arg1, ULONG_PTR ...@@ -463,6 +463,8 @@ static void CALLBACK register_native_window_callback( ULONG_PTR arg1, ULONG_PTR
BOOL opengl = arg3; BOOL opengl = arg3;
struct native_win_data *data = get_native_win_data( hwnd, opengl ); struct native_win_data *data = get_native_win_data( hwnd, opengl );
if (!win) return; /* do nothing and hold on to the window until we get a new surface */
if (!data || data->parent == win) if (!data || data->parent == win)
{ {
if (win) pANativeWindow_release( win ); if (win) pANativeWindow_release( win );
......
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