Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a5904bc6
Commit
a5904bc6
authored
May 31, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Initialize screen dimensions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e5069b10
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
208 additions
and
4 deletions
+208
-4
Makefile.in
dlls/wineandroid.drv/Makefile.in
+1
-0
android.h
dlls/wineandroid.drv/android.h
+50
-0
init.c
dlls/wineandroid.drv/init.c
+152
-4
wineandroid.drv.spec
dlls/wineandroid.drv/wineandroid.drv.spec
+5
-0
No files found.
dlls/wineandroid.drv/Makefile.in
View file @
a5904bc6
MODULE
=
wineandroid.drv
IMPORTS
=
user32 gdi32
C_SRCS
=
\
init.c
...
...
dlls/wineandroid.drv/android.h
0 → 100644
View file @
a5904bc6
/*
* Android driver definitions
*
* Copyright 2013 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_ANDROID_H
#define __WINE_ANDROID_H
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <jni.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/gdi_driver.h"
/**************************************************************************
* USER driver
*/
extern
unsigned
int
screen_width
DECLSPEC_HIDDEN
;
extern
unsigned
int
screen_height
DECLSPEC_HIDDEN
;
extern
RECT
virtual_screen_rect
DECLSPEC_HIDDEN
;
extern
MONITORINFOEXW
default_monitor
DECLSPEC_HIDDEN
;
extern
void
init_monitors
(
int
width
,
int
height
)
DECLSPEC_HIDDEN
;
extern
JavaVM
*
wine_get_java_vm
(
void
);
extern
jobject
wine_get_java_object
(
void
);
#endif
/* __WINE_ANDROID_H */
dlls/wineandroid.drv/init.c
View file @
a5904bc6
...
...
@@ -28,13 +28,30 @@
#include "windef.h"
#include "winbase.h"
#include "
wingdi
.h"
#include "win
us
er.h"
#include "wine/
gdi_driver
.h"
#include "
android
.h"
#include "win
e/serv
er.h"
#include "wine/
library
.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
android
);
unsigned
int
screen_width
=
0
;
unsigned
int
screen_height
=
0
;
RECT
virtual_screen_rect
=
{
0
,
0
,
0
,
0
};
MONITORINFOEXW
default_monitor
=
{
sizeof
(
default_monitor
),
/* cbSize */
{
0
,
0
,
0
,
0
},
/* rcMonitor */
{
0
,
0
,
0
,
0
},
/* rcWork */
MONITORINFOF_PRIMARY
,
/* dwFlags */
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
'D'
,
'I'
,
'S'
,
'P'
,
'L'
,
'A'
,
'Y'
,
'1'
,
0
}
/* szDevice */
};
static
const
unsigned
int
screen_bpp
=
32
;
/* we don't support other modes */
static
int
device_init_done
;
typedef
struct
{
struct
gdi_physdev
dev
;
...
...
@@ -42,6 +59,65 @@ typedef struct
static
const
struct
gdi_dc_funcs
android_drv_funcs
;
/******************************************************************************
* init_monitors
*/
void
init_monitors
(
int
width
,
int
height
)
{
static
const
WCHAR
trayW
[]
=
{
'S'
,
'h'
,
'e'
,
'l'
,
'l'
,
'_'
,
'T'
,
'r'
,
'a'
,
'y'
,
'W'
,
'n'
,
'd'
,
0
};
RECT
rect
;
HWND
hwnd
=
FindWindowW
(
trayW
,
NULL
);
virtual_screen_rect
.
right
=
width
;
virtual_screen_rect
.
bottom
=
height
;
default_monitor
.
rcMonitor
=
default_monitor
.
rcWork
=
virtual_screen_rect
;
if
(
!
hwnd
||
!
IsWindowVisible
(
hwnd
))
return
;
if
(
!
GetWindowRect
(
hwnd
,
&
rect
))
return
;
if
(
rect
.
top
)
default_monitor
.
rcWork
.
bottom
=
rect
.
top
;
else
default_monitor
.
rcWork
.
top
=
rect
.
bottom
;
TRACE
(
"found tray %p %s work area %s
\n
"
,
hwnd
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
default_monitor
.
rcWork
));
}
/**********************************************************************
* fetch_display_metrics
*/
static
void
fetch_display_metrics
(
void
)
{
if
(
wine_get_java_vm
())
return
;
/* for Java threads it will be set when the top view is created */
SERVER_START_REQ
(
get_window_rectangles
)
{
req
->
handle
=
wine_server_user_handle
(
GetDesktopWindow
()
);
req
->
relative
=
COORDS_CLIENT
;
if
(
!
wine_server_call
(
req
))
{
screen_width
=
reply
->
window
.
right
;
screen_height
=
reply
->
window
.
bottom
;
}
}
SERVER_END_REQ
;
init_monitors
(
screen_width
,
screen_height
);
TRACE
(
"screen %ux%u
\n
"
,
screen_width
,
screen_height
);
}
/**********************************************************************
* device_init
*
* Perform initializations needed upon creation of the first device.
*/
static
void
device_init
(
void
)
{
device_init_done
=
TRUE
;
fetch_display_metrics
();
}
/******************************************************************************
* create_android_physdev
*/
...
...
@@ -49,6 +125,8 @@ static ANDROID_PDEVICE *create_android_physdev(void)
{
ANDROID_PDEVICE
*
physdev
;
if
(
!
device_init_done
)
device_init
();
if
(
!
(
physdev
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
physdev
)
)))
return
NULL
;
return
physdev
;
}
...
...
@@ -92,6 +170,76 @@ static BOOL ANDROID_DeleteDC( PHYSDEV dev )
}
/***********************************************************************
* ANDROID_GetDeviceCaps
*/
static
INT
ANDROID_GetDeviceCaps
(
PHYSDEV
dev
,
INT
cap
)
{
switch
(
cap
)
{
case
HORZRES
:
return
screen_width
;
case
VERTRES
:
return
screen_height
;
case
DESKTOPHORZRES
:
return
virtual_screen_rect
.
right
-
virtual_screen_rect
.
left
;
case
DESKTOPVERTRES
:
return
virtual_screen_rect
.
bottom
-
virtual_screen_rect
.
top
;
case
BITSPIXEL
:
return
screen_bpp
;
default:
dev
=
GET_NEXT_PHYSDEV
(
dev
,
pGetDeviceCaps
);
return
dev
->
funcs
->
pGetDeviceCaps
(
dev
,
cap
);
}
}
/***********************************************************************
* ANDROID_GetMonitorInfo
*/
BOOL
CDECL
ANDROID_GetMonitorInfo
(
HMONITOR
handle
,
LPMONITORINFO
info
)
{
if
(
handle
!=
(
HMONITOR
)
1
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
info
->
rcMonitor
=
default_monitor
.
rcMonitor
;
info
->
rcWork
=
default_monitor
.
rcWork
;
info
->
dwFlags
=
default_monitor
.
dwFlags
;
if
(
info
->
cbSize
>=
sizeof
(
MONITORINFOEXW
))
lstrcpyW
(
((
MONITORINFOEXW
*
)
info
)
->
szDevice
,
default_monitor
.
szDevice
);
return
TRUE
;
}
/***********************************************************************
* ANDROID_EnumDisplayMonitors
*/
BOOL
CDECL
ANDROID_EnumDisplayMonitors
(
HDC
hdc
,
LPRECT
rect
,
MONITORENUMPROC
proc
,
LPARAM
lp
)
{
if
(
hdc
)
{
POINT
origin
;
RECT
limit
,
monrect
;
if
(
!
GetDCOrgEx
(
hdc
,
&
origin
))
return
FALSE
;
if
(
GetClipBox
(
hdc
,
&
limit
)
==
ERROR
)
return
FALSE
;
if
(
rect
&&
!
IntersectRect
(
&
limit
,
&
limit
,
rect
))
return
TRUE
;
monrect
=
default_monitor
.
rcMonitor
;
OffsetRect
(
&
monrect
,
-
origin
.
x
,
-
origin
.
y
);
if
(
IntersectRect
(
&
monrect
,
&
monrect
,
&
limit
))
if
(
!
proc
(
(
HMONITOR
)
1
,
hdc
,
&
monrect
,
lp
))
return
FALSE
;
}
else
{
RECT
unused
;
if
(
!
rect
||
IntersectRect
(
&
unused
,
&
default_monitor
.
rcMonitor
,
rect
))
if
(
!
proc
(
(
HMONITOR
)
1
,
0
,
&
default_monitor
.
rcMonitor
,
lp
))
return
FALSE
;
}
return
TRUE
;
}
static
const
struct
gdi_dc_funcs
android_drv_funcs
=
{
NULL
,
/* pAbortDoc */
...
...
@@ -131,7 +279,7 @@ static const struct gdi_dc_funcs android_drv_funcs =
NULL
,
/* pGetCharABCWidths */
NULL
,
/* pGetCharABCWidthsI */
NULL
,
/* pGetCharWidth */
NULL
,
/* pGetDeviceCaps */
ANDROID_GetDeviceCaps
,
/* pGetDeviceCaps */
NULL
,
/* pGetDeviceGammaRamp */
NULL
,
/* pGetFontData */
NULL
,
/* pGetFontRealizationInfo */
...
...
dlls/wineandroid.drv/wineandroid.drv.spec
View file @
a5904bc6
# GDI driver
@ cdecl wine_get_gdi_driver(long) ANDROID_get_gdi_driver
# USER driver
@ cdecl EnumDisplayMonitors(long ptr ptr long) ANDROID_EnumDisplayMonitors
@ cdecl GetMonitorInfo(long ptr) ANDROID_GetMonitorInfo
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