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
be285af5
Commit
be285af5
authored
Jun 07, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Implement SetParent and forward it to Java.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b6a00bc0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
0 deletions
+85
-0
WineActivity.java
dlls/wineandroid.drv/WineActivity.java
+26
-0
android.h
dlls/wineandroid.drv/android.h
+1
-0
device.c
dlls/wineandroid.drv/device.c
+39
-0
window.c
dlls/wineandroid.drv/window.c
+18
-0
wineandroid.drv.spec
dlls/wineandroid.drv/wineandroid.drv.spec
+1
-0
No files found.
dlls/wineandroid.drv/WineActivity.java
View file @
be285af5
...
...
@@ -337,6 +337,20 @@ public class WineActivity extends Activity
visible
=
(
style
&
WS_VISIBLE
)
!=
0
;
}
public
void
set_parent
(
WineWindow
new_parent
)
{
Log
.
i
(
LOGTAG
,
String
.
format
(
"set parent hwnd %08x parent %08x -> %08x"
,
hwnd
,
parent
==
null
?
0
:
parent
.
hwnd
,
new_parent
==
null
?
0
:
new_parent
.
hwnd
));
parent
=
new_parent
;
if
(
new_parent
==
null
)
{
window_view
=
new
WineView
(
WineActivity
.
this
,
this
);
window_view
.
layout
(
0
,
0
,
1
,
1
);
// make sure the surface gets created
}
else
window_view
=
null
;
}
public
int
get_hwnd
()
{
return
hwnd
;
...
...
@@ -452,6 +466,13 @@ public class WineActivity extends Activity
if
(
win
!=
null
)
win
.
destroy
();
}
public
void
set_window_parent
(
int
hwnd
,
int
parent
,
int
pid
)
{
WineWindow
win
=
get_window
(
hwnd
);
if
(
win
==
null
)
return
;
win
.
set_parent
(
get_window
(
parent
));
}
public
void
window_pos_changed
(
int
hwnd
,
int
flags
,
int
insert_after
,
int
owner
,
int
style
,
Rect
window_rect
,
Rect
client_rect
,
Rect
visible_rect
)
{
...
...
@@ -475,6 +496,11 @@ public class WineActivity extends Activity
runOnUiThread
(
new
Runnable
()
{
public
void
run
()
{
destroy_window
(
hwnd
);
}}
);
}
public
void
setParent
(
final
int
hwnd
,
final
int
parent
,
final
int
pid
)
{
runOnUiThread
(
new
Runnable
()
{
public
void
run
()
{
set_window_parent
(
hwnd
,
parent
,
pid
);
}}
);
}
public
void
windowPosChanged
(
final
int
hwnd
,
final
int
flags
,
final
int
insert_after
,
final
int
owner
,
final
int
style
,
final
int
window_left
,
final
int
window_top
,
...
...
dlls/wineandroid.drv/android.h
View file @
be285af5
...
...
@@ -60,6 +60,7 @@ extern void destroy_ioctl_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern
int
ioctl_window_pos_changed
(
HWND
hwnd
,
const
RECT
*
window_rect
,
const
RECT
*
client_rect
,
const
RECT
*
visible_rect
,
UINT
style
,
UINT
flags
,
HWND
after
,
HWND
owner
)
DECLSPEC_HIDDEN
;
extern
int
ioctl_set_window_parent
(
HWND
hwnd
,
HWND
parent
)
DECLSPEC_HIDDEN
;
/**************************************************************************
...
...
dlls/wineandroid.drv/device.c
View file @
be285af5
...
...
@@ -61,6 +61,7 @@ enum android_ioctl
IOCTL_CREATE_WINDOW
,
IOCTL_DESTROY_WINDOW
,
IOCTL_WINDOW_POS_CHANGED
,
IOCTL_SET_WINDOW_PARENT
,
IOCTL_DEQUEUE_BUFFER
,
IOCTL_QUEUE_BUFFER
,
IOCTL_CANCEL_BUFFER
,
...
...
@@ -188,6 +189,12 @@ struct ioctl_android_set_swap_interval
int
interval
;
};
struct
ioctl_android_set_window_parent
{
struct
ioctl_header
hdr
;
int
parent
;
};
static
inline
BOOL
is_in_desktop_process
(
void
)
{
return
thread
!=
NULL
;
...
...
@@ -832,12 +839,35 @@ static NTSTATUS setSwapInterval_ioctl( void *data, DWORD in_size, DWORD out_size
return
android_error_to_status
(
ret
);
}
static
NTSTATUS
setWindowParent_ioctl
(
void
*
data
,
DWORD
in_size
,
DWORD
out_size
,
ULONG_PTR
*
ret_size
)
{
static
jmethodID
method
;
jobject
object
;
struct
ioctl_android_set_window_parent
*
res
=
data
;
struct
native_win_data
*
win_data
;
DWORD
pid
=
current_client_id
();
if
(
in_size
<
sizeof
(
*
res
))
return
STATUS_INVALID_PARAMETER
;
if
(
!
(
win_data
=
get_ioctl_native_win_data
(
&
res
->
hdr
)))
return
STATUS_INVALID_HANDLE
;
TRACE
(
"hwnd %08x parent %08x
\n
"
,
res
->
hdr
.
hwnd
,
res
->
parent
);
if
(
!
(
object
=
load_java_method
(
&
method
,
"setParent"
,
"(III)V"
)))
return
STATUS_NOT_SUPPORTED
;
wrap_java_call
();
(
*
jni_env
)
->
CallVoidMethod
(
jni_env
,
object
,
method
,
res
->
hdr
.
hwnd
,
res
->
parent
,
pid
);
unwrap_java_call
();
return
STATUS_SUCCESS
;
}
typedef
NTSTATUS
(
*
ioctl_func
)(
void
*
in
,
DWORD
in_size
,
DWORD
out_size
,
ULONG_PTR
*
ret_size
);
static
const
ioctl_func
ioctl_funcs
[]
=
{
createWindow_ioctl
,
/* IOCTL_CREATE_WINDOW */
destroyWindow_ioctl
,
/* IOCTL_DESTROY_WINDOW */
windowPosChanged_ioctl
,
/* IOCTL_WINDOW_POS_CHANGED */
setWindowParent_ioctl
,
/* IOCTL_SET_WINDOW_PARENT */
dequeueBuffer_ioctl
,
/* IOCTL_DEQUEUE_BUFFER */
queueBuffer_ioctl
,
/* IOCTL_QUEUE_BUFFER */
cancelBuffer_ioctl
,
/* IOCTL_CANCEL_BUFFER */
...
...
@@ -1356,3 +1386,12 @@ int ioctl_window_pos_changed( HWND hwnd, const RECT *window_rect, const RECT *cl
req
.
owner
=
HandleToLong
(
owner
);
return
android_ioctl
(
IOCTL_WINDOW_POS_CHANGED
,
&
req
,
sizeof
(
req
),
NULL
,
NULL
);
}
int
ioctl_set_window_parent
(
HWND
hwnd
,
HWND
parent
)
{
struct
ioctl_android_set_window_parent
req
;
req
.
hdr
.
hwnd
=
HandleToLong
(
hwnd
);
req
.
parent
=
parent
==
GetDesktopWindow
()
?
0
:
HandleToLong
(
parent
);
return
android_ioctl
(
IOCTL_SET_WINDOW_PARENT
,
&
req
,
sizeof
(
req
),
NULL
,
NULL
);
}
dlls/wineandroid.drv/window.c
View file @
be285af5
...
...
@@ -1015,6 +1015,24 @@ UINT CDECL ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
}
/*****************************************************************
* ANDROID_SetParent
*/
void
CDECL
ANDROID_SetParent
(
HWND
hwnd
,
HWND
parent
,
HWND
old_parent
)
{
struct
android_win_data
*
data
;
if
(
parent
==
old_parent
)
return
;
if
(
!
(
data
=
get_win_data
(
hwnd
)))
return
;
TRACE
(
"win %p parent %p -> %p
\n
"
,
hwnd
,
old_parent
,
parent
);
data
->
parent
=
(
parent
==
GetDesktopWindow
())
?
0
:
parent
;
ioctl_set_window_parent
(
hwnd
,
parent
);
release_win_data
(
data
);
}
/***********************************************************************
* ANDROID_SetWindowStyle
*/
...
...
dlls/wineandroid.drv/wineandroid.drv.spec
View file @
be285af5
...
...
@@ -10,6 +10,7 @@
@ cdecl DestroyWindow(long) ANDROID_DestroyWindow
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) ANDROID_MsgWaitForMultipleObjectsEx
@ cdecl SetLayeredWindowAttributes(long long long long) ANDROID_SetLayeredWindowAttributes
@ cdecl SetParent(long long long) ANDROID_SetParent
@ cdecl SetWindowRgn(long long long) ANDROID_SetWindowRgn
@ cdecl SetWindowStyle(ptr long ptr) ANDROID_SetWindowStyle
@ cdecl ShowWindow(long long ptr long) ANDROID_ShowWindow
...
...
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