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
f77bbd45
Commit
f77bbd45
authored
Jun 22, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Add infrastructure to support a separate TextureView for the window client area.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
95c4516b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
25 deletions
+45
-25
WineActivity.java
dlls/wineandroid.drv/WineActivity.java
+33
-17
android.h
dlls/wineandroid.drv/android.h
+3
-1
init.c
dlls/wineandroid.drv/init.c
+1
-1
window.c
dlls/wineandroid.drv/window.c
+8
-6
No files found.
dlls/wineandroid.drv/WineActivity.java
View file @
f77bbd45
...
...
@@ -54,7 +54,7 @@ public class WineActivity extends Activity
private
native
String
wine_init
(
String
[]
cmdline
,
String
[]
env
);
public
native
void
wine_desktop_changed
(
int
width
,
int
height
);
public
native
void
wine_config_changed
(
int
dpi
);
public
native
void
wine_surface_changed
(
int
hwnd
,
Surface
surface
);
public
native
void
wine_surface_changed
(
int
hwnd
,
Surface
surface
,
boolean
opengl
);
public
native
boolean
wine_motion_event
(
int
hwnd
,
int
action
,
int
x
,
int
y
,
int
state
,
int
vscroll
);
public
native
boolean
wine_keyboard_event
(
int
hwnd
,
int
action
,
int
keycode
,
int
state
);
...
...
@@ -299,6 +299,7 @@ public class WineActivity extends Activity
protected
WineWindow
parent
;
protected
WineView
window_view
;
protected
Surface
window_surface
;
protected
Surface
client_surface
;
public
WineWindow
(
int
w
,
WineWindow
parent
)
{
...
...
@@ -312,7 +313,7 @@ public class WineActivity extends Activity
win_map
.
put
(
w
,
this
);
if
(
parent
==
null
)
{
window_view
=
new
WineView
(
WineActivity
.
this
,
this
);
window_view
=
new
WineView
(
WineActivity
.
this
,
this
,
false
);
window_view
.
layout
(
0
,
0
,
1
,
1
);
// make sure the surface gets created
}
}
...
...
@@ -353,7 +354,7 @@ public class WineActivity extends Activity
parent
=
new_parent
;
if
(
new_parent
==
null
)
{
window_view
=
new
WineView
(
WineActivity
.
this
,
this
);
window_view
=
new
WineView
(
WineActivity
.
this
,
this
,
false
);
window_view
.
layout
(
0
,
0
,
1
,
1
);
// make sure the surface gets created
}
else
window_view
=
null
;
...
...
@@ -364,12 +365,22 @@ public class WineActivity extends Activity
return
hwnd
;
}
public
void
set_surface
(
SurfaceTexture
surftex
)
public
void
set_surface
(
SurfaceTexture
surftex
,
boolean
is_client
)
{
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
));
wine_surface_changed
(
hwnd
,
window_surface
);
if
(
is_client
)
{
if
(
surftex
==
null
)
client_surface
=
null
;
else
if
(
client_surface
==
null
)
client_surface
=
new
Surface
(
surftex
);
Log
.
i
(
LOGTAG
,
String
.
format
(
"set client surface hwnd %08x %s"
,
hwnd
,
client_surface
));
wine_surface_changed
(
hwnd
,
client_surface
,
true
);
}
else
{
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
));
wine_surface_changed
(
hwnd
,
window_surface
,
false
);
}
}
public
void
get_event_pos
(
MotionEvent
event
,
int
[]
pos
)
...
...
@@ -384,11 +395,13 @@ public class WineActivity extends Activity
protected
class
WineView
extends
TextureView
implements
TextureView
.
SurfaceTextureListener
{
private
WineWindow
window
;
private
boolean
is_client
;
public
WineView
(
Context
c
,
WineWindow
win
)
public
WineView
(
Context
c
,
WineWindow
win
,
boolean
client
)
{
super
(
c
);
window
=
win
;
is_client
=
client
;
setSurfaceTextureListener
(
this
);
setVisibility
(
VISIBLE
);
setOpaque
(
false
);
...
...
@@ -403,22 +416,23 @@ public class WineActivity extends Activity
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
);
Log
.
i
(
LOGTAG
,
String
.
format
(
"onSurfaceTextureAvailable win %08x %dx%d
%s
"
,
window
.
hwnd
,
width
,
height
,
is_client
?
"client"
:
"whole"
));
window
.
set_surface
(
surftex
,
is_client
);
}
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
);
Log
.
i
(
LOGTAG
,
String
.
format
(
"onSurfaceTextureSizeChanged win %08x %dx%d
%s
"
,
window
.
hwnd
,
width
,
height
,
is_client
?
"client"
:
"whole"
));
window
.
set_surface
(
surftex
,
is_client
);
}
public
boolean
onSurfaceTextureDestroyed
(
SurfaceTexture
surftex
)
{
Log
.
i
(
LOGTAG
,
String
.
format
(
"onSurfaceTextureDestroyed win %08x"
,
window
.
hwnd
));
window
.
set_surface
(
null
);
Log
.
i
(
LOGTAG
,
String
.
format
(
"onSurfaceTextureDestroyed win %08x %s"
,
window
.
hwnd
,
is_client
?
"client"
:
"whole"
));
window
.
set_surface
(
null
,
is_client
);
return
true
;
}
...
...
@@ -428,6 +442,7 @@ public class WineActivity extends Activity
public
boolean
onGenericMotionEvent
(
MotionEvent
event
)
{
if
(
is_client
)
return
false
;
// let the whole window handle it
if
(
window
.
parent
!=
null
)
return
false
;
// let the parent handle it
if
((
event
.
getSource
()
&
InputDevice
.
SOURCE_CLASS_POINTER
)
!=
0
)
...
...
@@ -445,6 +460,7 @@ public class WineActivity extends Activity
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
if
(
is_client
)
return
false
;
// let the whole window handle it
if
(
window
.
parent
!=
null
)
return
false
;
// let the parent handle it
int
[]
pos
=
new
int
[
2
];
...
...
dlls/wineandroid.drv/android.h
View file @
f77bbd45
...
...
@@ -87,7 +87,8 @@ extern void update_keyboard_lock_state( WORD vkey, UINT state ) DECLSPEC_HIDDEN;
/* JNI entry points */
extern
void
desktop_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
width
,
jint
height
)
DECLSPEC_HIDDEN
;
extern
void
config_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
dpi
)
DECLSPEC_HIDDEN
;
extern
void
surface_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jobject
surface
)
DECLSPEC_HIDDEN
;
extern
void
surface_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jobject
surface
,
jboolean
client
)
DECLSPEC_HIDDEN
;
extern
jboolean
motion_event
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jint
action
,
jint
x
,
jint
y
,
jint
state
,
jint
vscroll
)
DECLSPEC_HIDDEN
;
extern
jboolean
keyboard_event
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jint
action
,
...
...
@@ -121,6 +122,7 @@ union event_data
enum
event_type
type
;
HWND
hwnd
;
ANativeWindow
*
window
;
BOOL
client
;
unsigned
int
width
;
unsigned
int
height
;
}
surface
;
...
...
dlls/wineandroid.drv/init.c
View file @
f77bbd45
...
...
@@ -458,7 +458,7 @@ static const JNINativeMethod methods[] =
{
{
"wine_desktop_changed"
,
"(II)V"
,
desktop_changed
},
{
"wine_config_changed"
,
"(I)V"
,
config_changed
},
{
"wine_surface_changed"
,
"(ILandroid/view/Surface;)V"
,
surface_changed
},
{
"wine_surface_changed"
,
"(ILandroid/view/Surface;
Z
)V"
,
surface_changed
},
{
"wine_motion_event"
,
"(IIIIII)Z"
,
motion_event
},
{
"wine_keyboard_event"
,
"(IIII)Z"
,
keyboard_event
},
};
...
...
dlls/wineandroid.drv/window.c
View file @
f77bbd45
...
...
@@ -245,12 +245,13 @@ void config_changed( JNIEnv *env, jobject obj, jint dpi )
*
* JNI callback, runs in the context of the Java thread.
*/
void
surface_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jobject
surface
)
void
surface_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jobject
surface
,
jboolean
client
)
{
union
event_data
data
;
memset
(
&
data
,
0
,
sizeof
(
data
)
);
data
.
surface
.
hwnd
=
LongToHandle
(
win
);
data
.
surface
.
client
=
client
;
if
(
surface
)
{
int
width
,
height
;
...
...
@@ -261,8 +262,8 @@ void surface_changed( JNIEnv *env, jobject obj, jint win, jobject surface )
data
.
surface
.
window
=
win
;
data
.
surface
.
width
=
width
;
data
.
surface
.
height
=
height
;
p__android_log_print
(
ANDROID_LOG_INFO
,
"wine"
,
"surface_changed: %p %ux%u"
,
data
.
surface
.
hwnd
,
width
,
height
);
p__android_log_print
(
ANDROID_LOG_INFO
,
"wine"
,
"surface_changed: %p %
s %
ux%u"
,
data
.
surface
.
hwnd
,
client
?
"client"
:
"whole"
,
width
,
height
);
}
data
.
type
=
SURFACE_CHANGED
;
send_event
(
&
data
);
...
...
@@ -451,10 +452,11 @@ static int process_events( DWORD mask )
break
;
case
SURFACE_CHANGED
:
TRACE
(
"SURFACE_CHANGED %p %p size %ux%u
\n
"
,
event
->
data
.
surface
.
hwnd
,
event
->
data
.
surface
.
window
,
event
->
data
.
surface
.
width
,
event
->
data
.
surface
.
height
);
TRACE
(
"SURFACE_CHANGED %p %p %s size %ux%u
\n
"
,
event
->
data
.
surface
.
hwnd
,
event
->
data
.
surface
.
window
,
event
->
data
.
surface
.
client
?
"client"
:
"whole"
,
event
->
data
.
surface
.
width
,
event
->
data
.
surface
.
height
);
register_native_window
(
event
->
data
.
surface
.
hwnd
,
event
->
data
.
surface
.
window
,
FALSE
);
register_native_window
(
event
->
data
.
surface
.
hwnd
,
event
->
data
.
surface
.
window
,
event
->
data
.
surface
.
client
);
break
;
case
MOTION_EVENT
:
...
...
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