Alexandre Julliard : wineandroid: Create a TextureView for every top-level window.
Alexandre Julliard
julliard at winehq.org
Fri Jun 2 17:03:27 CDT 2017
Module: wine
Branch: master
Commit: 2645cc2a7f65b962f47d25327ab0f96506c6b8d7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2645cc2a7f65b962f47d25327ab0f96506c6b8d7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jun 2 11:35:12 2017 +0200
wineandroid: Create a TextureView for every top-level window.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wineandroid.drv/WineActivity.java | 71 ++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/dlls/wineandroid.drv/WineActivity.java b/dlls/wineandroid.drv/WineActivity.java
index 28523a1..2eca5fc 100644
--- a/dlls/wineandroid.drv/WineActivity.java
+++ b/dlls/wineandroid.drv/WineActivity.java
@@ -25,10 +25,13 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Rect;
+import android.graphics.SurfaceTexture;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
+import android.view.Surface;
+import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import java.io.BufferedReader;
@@ -286,6 +289,9 @@ public class WineActivity extends Activity
protected boolean visible;
protected Rect visible_rect;
protected Rect client_rect;
+ protected WineWindow parent;
+ protected WineView window_view;
+ protected Surface window_surface;
public WineWindow( int w, WineWindow parent )
{
@@ -295,7 +301,13 @@ public class WineActivity extends Activity
style = 0;
visible = false;
visible_rect = client_rect = new Rect( 0, 0, 0, 0 );
+ this.parent = parent;
win_map.put( w, this );
+ if (parent == null)
+ {
+ window_view = new WineView( WineActivity.this, this );
+ window_view.layout( 0, 0, 1, 1 ); // make sure the surface gets created
+ }
}
public void destroy()
@@ -315,6 +327,12 @@ public class WineActivity extends Activity
Log.i( LOGTAG, String.format( "pos changed hwnd %08x after %08x owner %08x style %08x win %s client %s visible %s flags %08x",
hwnd, insert_after, owner, style, window_rect, client_rect, visible_rect, flags ));
+ if (parent == null)
+ {
+ window_view.layout( visible_rect.left, visible_rect.top, visible_rect.right, visible_rect.bottom );
+ if (!visible && (style & WS_VISIBLE) != 0) top_view.addView( window_view );
+ else if (visible && (style & WS_VISIBLE) == 0) top_view.removeView( window_view );
+ }
visible = (style & WS_VISIBLE) != 0;
}
@@ -322,6 +340,59 @@ public class WineActivity extends Activity
{
return hwnd;
}
+
+ public void set_surface( SurfaceTexture surftex )
+ {
+ if (surftex == null) window_surface = null;
+ else if (window_surface == null) window_surface = new Surface( surftex );
+ Log.i( LOGTAG, String.format( "set window surface hwnd %08x %s", hwnd, window_surface ));
+ }
+ }
+
+ // View used for all Wine windows, backed by a TextureView
+
+ protected class WineView extends TextureView implements TextureView.SurfaceTextureListener
+ {
+ private WineWindow window;
+
+ public WineView( Context c, WineWindow win )
+ {
+ super( c );
+ window = win;
+ setSurfaceTextureListener( this );
+ setVisibility( VISIBLE );
+ setOpaque( false );
+ }
+
+ public WineWindow get_window()
+ {
+ return window;
+ }
+
+ public void onSurfaceTextureAvailable( SurfaceTexture surftex, int width, int height )
+ {
+ Log.i( LOGTAG, String.format( "onSurfaceTextureAvailable win %08x %dx%d",
+ window.hwnd, width, height ));
+ window.set_surface( surftex );
+ }
+
+ public void onSurfaceTextureSizeChanged( SurfaceTexture surftex, int width, int height )
+ {
+ Log.i( LOGTAG, String.format( "onSurfaceTextureSizeChanged win %08x %dx%d",
+ window.hwnd, width, height ));
+ window.set_surface( surftex );
+ }
+
+ public boolean onSurfaceTextureDestroyed( SurfaceTexture surftex )
+ {
+ Log.i( LOGTAG, String.format( "onSurfaceTextureDestroyed win %08x", window.hwnd ));
+ window.set_surface( null );
+ return true;
+ }
+
+ public void onSurfaceTextureUpdated(SurfaceTexture surftex)
+ {
+ }
}
// The top-level desktop view group
More information about the wine-cvs
mailing list