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
f254aec4
Commit
f254aec4
authored
Jun 12, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Store the actual screen DPI on startup.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3179a5da
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
1 deletion
+51
-1
Makefile.in
dlls/wineandroid.drv/Makefile.in
+1
-1
WineActivity.java
dlls/wineandroid.drv/WineActivity.java
+2
-0
android.h
dlls/wineandroid.drv/android.h
+8
-0
init.c
dlls/wineandroid.drv/init.c
+18
-0
window.c
dlls/wineandroid.drv/window.c
+22
-0
No files found.
dlls/wineandroid.drv/Makefile.in
View file @
f254aec4
MODULE
=
wineandroid.drv
IMPORTS
=
user32 gdi32 ntoskrnl
IMPORTS
=
user32 gdi32
advapi32
ntoskrnl
C_SRCS
=
\
device.c
\
...
...
dlls/wineandroid.drv/WineActivity.java
View file @
f254aec4
...
...
@@ -53,6 +53,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
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
);
...
...
@@ -508,6 +509,7 @@ public class WineActivity extends Activity
top_view
=
new
TopView
(
this
,
hwnd
);
setContentView
(
top_view
);
progress_dialog
.
dismiss
();
wine_config_changed
(
getResources
().
getConfiguration
().
densityDpi
);
}
public
void
create_window
(
int
hwnd
,
int
parent
,
int
pid
)
...
...
dlls/wineandroid.drv/android.h
View file @
f254aec4
...
...
@@ -81,10 +81,12 @@ enum android_window_messages
extern
HWND
get_capture_window
(
void
)
DECLSPEC_HIDDEN
;
extern
void
init_monitors
(
int
width
,
int
height
)
DECLSPEC_HIDDEN
;
extern
void
set_screen_dpi
(
DWORD
dpi
)
DECLSPEC_HIDDEN
;
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
jboolean
motion_event
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jint
action
,
jint
x
,
jint
y
,
jint
state
,
jint
vscroll
)
DECLSPEC_HIDDEN
;
...
...
@@ -94,6 +96,7 @@ extern jboolean keyboard_event( JNIEnv *env, jobject obj, jint win, jint action,
enum
event_type
{
DESKTOP_CHANGED
,
CONFIG_CHANGED
,
SURFACE_CHANGED
,
MOTION_EVENT
,
KEYBOARD_EVENT
,
...
...
@@ -111,6 +114,11 @@ union event_data
struct
{
enum
event_type
type
;
unsigned
int
dpi
;
}
cfg
;
struct
{
enum
event_type
type
;
HWND
hwnd
;
ANativeWindow
*
window
;
unsigned
int
width
;
...
...
dlls/wineandroid.drv/init.c
View file @
f254aec4
...
...
@@ -28,6 +28,7 @@
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "android.h"
#include "wine/server.h"
#include "wine/library.h"
...
...
@@ -82,6 +83,22 @@ void init_monitors( int width, int height )
}
/******************************************************************************
* set_screen_dpi
*/
void
set_screen_dpi
(
DWORD
dpi
)
{
static
const
WCHAR
dpi_key_name
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'F'
,
'o'
,
'n'
,
't'
,
's'
,
0
};
static
const
WCHAR
dpi_value_name
[]
=
{
'L'
,
'o'
,
'g'
,
'P'
,
'i'
,
'x'
,
'e'
,
'l'
,
's'
,
0
};
HKEY
hkey
;
if
(
!
RegCreateKeyW
(
HKEY_CURRENT_CONFIG
,
dpi_key_name
,
&
hkey
))
{
RegSetValueExW
(
hkey
,
dpi_value_name
,
0
,
REG_DWORD
,
(
void
*
)
&
dpi
,
sizeof
(
DWORD
)
);
RegCloseKey
(
hkey
);
}
}
/**********************************************************************
* fetch_display_metrics
*/
...
...
@@ -390,6 +407,7 @@ const struct gdi_dc_funcs * CDECL ANDROID_get_gdi_driver( unsigned int version )
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_motion_event"
,
"(IIIIII)Z"
,
motion_event
},
{
"wine_keyboard_event"
,
"(IIII)Z"
,
keyboard_event
},
...
...
dlls/wineandroid.drv/window.c
View file @
f254aec4
...
...
@@ -224,6 +224,23 @@ void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height )
/***********************************************************************
* config_changed
*
* JNI callback, runs in the context of the Java thread.
*/
void
config_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
dpi
)
{
union
event_data
data
;
memset
(
&
data
,
0
,
sizeof
(
data
)
);
data
.
type
=
CONFIG_CHANGED
;
data
.
cfg
.
dpi
=
dpi
;
p__android_log_print
(
ANDROID_LOG_INFO
,
"wine"
,
"config_changed: %u dpi"
,
dpi
);
send_event
(
&
data
);
}
/***********************************************************************
* surface_changed
*
* JNI callback, runs in the context of the Java thread.
...
...
@@ -428,6 +445,11 @@ static int process_events( DWORD mask )
SWP_NOZORDER
|
SWP_NOACTIVATE
|
SWP_NOREDRAW
);
break
;
case
CONFIG_CHANGED
:
TRACE
(
"CONFIG_CHANGED dpi %u
\n
"
,
event
->
data
.
cfg
.
dpi
);
set_screen_dpi
(
event
->
data
.
cfg
.
dpi
);
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
);
...
...
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