Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2645cc2a
Commit
2645cc2a
authored
Jun 02, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Create a TextureView for every top-level window.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
97005de1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
WineActivity.java
dlls/wineandroid.drv/WineActivity.java
+71
-0
No files found.
dlls/wineandroid.drv/WineActivity.java
View file @
2645cc2a
...
@@ -25,10 +25,13 @@ import android.app.ProgressDialog;
...
@@ -25,10 +25,13 @@ import android.app.ProgressDialog;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
import
android.graphics.SurfaceTexture
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.Surface
;
import
android.view.TextureView
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
...
@@ -286,6 +289,9 @@ public class WineActivity extends Activity
...
@@ -286,6 +289,9 @@ public class WineActivity extends Activity
protected
boolean
visible
;
protected
boolean
visible
;
protected
Rect
visible_rect
;
protected
Rect
visible_rect
;
protected
Rect
client_rect
;
protected
Rect
client_rect
;
protected
WineWindow
parent
;
protected
WineView
window_view
;
protected
Surface
window_surface
;
public
WineWindow
(
int
w
,
WineWindow
parent
)
public
WineWindow
(
int
w
,
WineWindow
parent
)
{
{
...
@@ -295,7 +301,13 @@ public class WineActivity extends Activity
...
@@ -295,7 +301,13 @@ public class WineActivity extends Activity
style
=
0
;
style
=
0
;
visible
=
false
;
visible
=
false
;
visible_rect
=
client_rect
=
new
Rect
(
0
,
0
,
0
,
0
);
visible_rect
=
client_rect
=
new
Rect
(
0
,
0
,
0
,
0
);
this
.
parent
=
parent
;
win_map
.
put
(
w
,
this
);
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
()
public
void
destroy
()
...
@@ -315,6 +327,12 @@ public class WineActivity extends Activity
...
@@ -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"
,
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
));
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
;
visible
=
(
style
&
WS_VISIBLE
)
!=
0
;
}
}
...
@@ -322,6 +340,59 @@ public class WineActivity extends Activity
...
@@ -322,6 +340,59 @@ public class WineActivity extends Activity
{
{
return
hwnd
;
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
// The top-level desktop view group
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment