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
23b28323
Commit
23b28323
authored
Jun 25, 2019
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Jun 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Use generic GetMonitorInfo.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
074abfe0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
61 deletions
+72
-61
driver.c
dlls/user32/driver.c
+0
-23
sysparams.c
dlls/user32/sysparams.c
+54
-0
user_private.h
dlls/user32/user_private.h
+1
-0
display.c
dlls/winex11.drv/display.c
+12
-0
winex11.drv.spec
dlls/winex11.drv/winex11.drv.spec
+0
-1
x11drv.h
dlls/winex11.drv/x11drv.h
+2
-0
xinerama.c
dlls/winex11.drv/xinerama.c
+3
-37
No files found.
dlls/user32/driver.c
View file @
23b28323
...
...
@@ -197,8 +197,6 @@ void USER_unload_driver(void)
* These are fallbacks for entry points that are not implemented in the real driver.
*/
#define NULLDRV_DEFAULT_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1))
static
HKL
CDECL
nulldrv_ActivateKeyboardLayout
(
HKL
layout
,
UINT
flags
)
{
return
0
;
...
...
@@ -359,27 +357,6 @@ static BOOL CDECL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVM
return
FALSE
;
}
static
BOOL
CDECL
nulldrv_GetMonitorInfo
(
HMONITOR
handle
,
LPMONITORINFO
info
)
{
RECT
r
=
{
0
,
0
,
640
,
480
};
static
const
WCHAR
device
[]
=
{
'W'
,
'i'
,
'n'
,
'D'
,
'i'
,
's'
,
'c'
,
0
};
TRACE
(
"(%p, %p)
\n
"
,
handle
,
info
);
if
(
handle
!=
NULLDRV_DEFAULT_HMONITOR
)
{
SetLastError
(
ERROR_INVALID_MONITOR_HANDLE
);
return
FALSE
;
}
info
->
rcMonitor
=
r
;
info
->
rcWork
=
r
;
info
->
dwFlags
=
MONITORINFOF_PRIMARY
;
if
(
info
->
cbSize
>=
sizeof
(
MONITORINFOEXW
))
lstrcpyW
(
((
MONITORINFOEXW
*
)
info
)
->
szDevice
,
device
);
return
TRUE
;
}
static
BOOL
CDECL
nulldrv_CreateDesktopWindow
(
HWND
hwnd
)
{
return
TRUE
;
...
...
dlls/user32/sysparams.c
View file @
23b28323
...
...
@@ -252,6 +252,8 @@ static const WCHAR CSrgb[] = {'%','u',' ','%','u',' ','%','u',0};
/* Wine specific monitor properties */
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_STATEFLAGS
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
2
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_RCMONITOR
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
3
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_RCWORK
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
4
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_ADAPTERNAME
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
5
);
#define NULLDRV_DEFAULT_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1))
...
...
@@ -3720,6 +3722,58 @@ HMONITOR WINAPI MonitorFromWindow(HWND hWnd, DWORD dwFlags)
return
MonitorFromRect
(
&
rect
,
dwFlags
);
}
BOOL
CDECL
nulldrv_GetMonitorInfo
(
HMONITOR
handle
,
MONITORINFO
*
info
)
{
SP_DEVINFO_DATA
device_data
=
{
sizeof
(
device_data
)};
WCHAR
adapter_name
[
CCHDEVICENAME
];
HDEVINFO
devinfo
;
DWORD
error
=
0
;
HANDLE
mutex
;
DWORD
type
;
BOOL
ret
;
TRACE
(
"(%p, %p)
\n
"
,
handle
,
info
);
/* Fallback to report one monitor */
if
(
handle
==
NULLDRV_DEFAULT_HMONITOR
)
{
RECT
default_rect
=
{
0
,
0
,
640
,
480
};
info
->
rcMonitor
=
default_rect
;
info
->
rcWork
=
default_rect
;
info
->
dwFlags
=
MONITORINFOF_PRIMARY
;
if
(
info
->
cbSize
>=
sizeof
(
MONITORINFOEXW
))
lstrcpyW
(
((
MONITORINFOEXW
*
)
info
)
->
szDevice
,
DEFAULT_ADAPTER_NAME
);
return
TRUE
;
}
/* Use SetupAPI to get monitors */
mutex
=
get_display_device_init_mutex
();
devinfo
=
SetupDiGetClassDevsW
(
&
GUID_DEVCLASS_MONITOR
,
NULL
,
NULL
,
0
);
if
(
SetupDiEnumDeviceInfo
(
devinfo
,
(
DWORD
)(
UINT_PTR
)
handle
-
1
,
&
device_data
))
{
SetupDiGetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_MONITOR_RCMONITOR
,
&
type
,
(
BYTE
*
)
&
info
->
rcMonitor
,
sizeof
(
info
->
rcMonitor
),
NULL
,
0
);
SetupDiGetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_MONITOR_RCWORK
,
&
type
,
(
BYTE
*
)
&
info
->
rcWork
,
sizeof
(
info
->
rcWork
),
NULL
,
0
);
SetupDiGetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_MONITOR_ADAPTERNAME
,
&
type
,
(
BYTE
*
)
adapter_name
,
sizeof
(
adapter_name
),
NULL
,
0
);
info
->
dwFlags
=
!
lstrcmpW
(
DEFAULT_ADAPTER_NAME
,
adapter_name
)
?
MONITORINFOF_PRIMARY
:
0
;
if
(
info
->
cbSize
>=
sizeof
(
MONITORINFOEXW
))
lstrcpyW
(
((
MONITORINFOEXW
*
)
info
)
->
szDevice
,
adapter_name
);
ret
=
TRUE
;
}
else
{
error
=
ERROR_INVALID_MONITOR_HANDLE
;
ret
=
FALSE
;
}
SetupDiDestroyDeviceInfoList
(
devinfo
);
release_display_device_init_mutex
(
mutex
);
if
(
error
)
SetLastError
(
ERROR_INVALID_MONITOR_HANDLE
);
return
ret
;
}
/***********************************************************************
* GetMonitorInfoA (USER32.@)
*/
...
...
dlls/user32/user_private.h
View file @
23b28323
...
...
@@ -123,6 +123,7 @@ extern const USER_DRIVER *USER_Driver DECLSPEC_HIDDEN;
extern
void
USER_unload_driver
(
void
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_EnumDisplayMonitors
(
HDC
hdc
,
RECT
*
rect
,
MONITORENUMPROC
proc
,
LPARAM
lp
)
DECLSPEC_HIDDEN
;
extern
BOOL
CDECL
nulldrv_GetMonitorInfo
(
HMONITOR
handle
,
MONITORINFO
*
info
)
DECLSPEC_HIDDEN
;
struct
received_message_info
;
...
...
dlls/winex11.drv/display.c
View file @
23b28323
...
...
@@ -42,12 +42,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
/* Wine specific monitor properties */
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_STATEFLAGS
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
2
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_RCMONITOR
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
3
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_RCWORK
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
4
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_MONITOR_ADAPTERNAME
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5b
,
5
);
static
const
WCHAR
driver_descW
[]
=
{
'D'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
'D'
,
'e'
,
's'
,
'c'
,
0
};
static
const
WCHAR
video_idW
[]
=
{
'V'
,
'i'
,
'd'
,
'e'
,
'o'
,
'I'
,
'D'
,
0
};
static
const
WCHAR
symbolic_link_valueW
[]
=
{
'S'
,
'y'
,
'm'
,
'b'
,
'o'
,
'l'
,
'i'
,
'c'
,
'L'
,
'i'
,
'n'
,
'k'
,
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
static
const
WCHAR
gpu_idW
[]
=
{
'G'
,
'P'
,
'U'
,
'I'
,
'D'
,
0
};
static
const
WCHAR
mointor_id_fmtW
[]
=
{
'M'
,
'o'
,
'n'
,
'i'
,
't'
,
'o'
,
'r'
,
'I'
,
'D'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
adapter_name_fmtW
[]
=
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
'D'
,
'I'
,
'S'
,
'P'
,
'L'
,
'A'
,
'Y'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
state_flagsW
[]
=
{
'S'
,
't'
,
'a'
,
't'
,
'e'
,
'F'
,
'l'
,
'a'
,
'g'
,
's'
,
0
};
static
const
WCHAR
guid_fmtW
[]
=
{
'{'
,
'%'
,
'0'
,
'8'
,
'x'
,
'-'
,
'%'
,
'0'
,
'4'
,
'x'
,
'-'
,
'%'
,
'0'
,
'4'
,
'x'
,
'-'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'-'
,
...
...
@@ -281,6 +284,15 @@ static BOOL X11DRV_InitMonitor(HDEVINFO devinfo, const struct x11drv_monitor *mo
if
(
!
SetupDiSetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_MONITOR_RCMONITOR
,
DEVPROP_TYPE_BINARY
,
(
const
BYTE
*
)
&
monitor
->
rc_monitor
,
sizeof
(
monitor
->
rc_monitor
),
0
))
goto
done
;
/* RcWork */
if
(
!
SetupDiSetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_MONITOR_RCWORK
,
DEVPROP_TYPE_BINARY
,
(
const
BYTE
*
)
&
monitor
->
rc_work
,
sizeof
(
monitor
->
rc_work
),
0
))
goto
done
;
/* Adapter name */
sprintfW
(
bufferW
,
adapter_name_fmtW
,
video_index
+
1
);
if
(
!
SetupDiSetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_MONITOR_ADAPTERNAME
,
DEVPROP_TYPE_STRING
,
(
const
BYTE
*
)
bufferW
,
(
strlenW
(
bufferW
)
+
1
)
*
sizeof
(
WCHAR
),
0
))
goto
done
;
ret
=
TRUE
;
done:
...
...
dlls/winex11.drv/winex11.drv.spec
View file @
23b28323
...
...
@@ -21,7 +21,6 @@
@ cdecl ClipCursor(ptr) X11DRV_ClipCursor
@ cdecl ChangeDisplaySettingsEx(ptr ptr long long long) X11DRV_ChangeDisplaySettingsEx
@ cdecl EnumDisplaySettingsEx(ptr long ptr long) X11DRV_EnumDisplaySettingsEx
@ cdecl GetMonitorInfo(long ptr) X11DRV_GetMonitorInfo
@ cdecl CreateDesktopWindow(long) X11DRV_CreateDesktopWindow
@ cdecl CreateWindow(long) X11DRV_CreateWindow
@ cdecl DestroyWindow(long) X11DRV_DestroyWindow
...
...
dlls/winex11.drv/x11drv.h
View file @
23b28323
...
...
@@ -697,6 +697,8 @@ struct x11drv_monitor
WCHAR
name
[
128
];
/* RcMonitor in MONITORINFO struct */
RECT
rc_monitor
;
/* RcWork in MONITORINFO struct */
RECT
rc_work
;
/* StateFlags in DISPLAY_DEVICE struct */
DWORD
state_flags
;
};
...
...
dlls/winex11.drv/xinerama.c
View file @
23b28323
...
...
@@ -57,18 +57,6 @@ static inline MONITORINFOEXW *get_primary(void)
return
&
monitors
[
idx
];
}
static
inline
HMONITOR
index_to_monitor
(
int
index
)
{
return
(
HMONITOR
)(
UINT_PTR
)(
index
+
1
);
}
static
inline
int
monitor_to_index
(
HMONITOR
handle
)
{
UINT_PTR
index
=
(
UINT_PTR
)
handle
;
if
(
index
<
1
||
index
>
nb_monitors
)
return
-
1
;
return
index
-
1
;
}
static
void
query_work_area
(
RECT
*
rc_work
)
{
Atom
type
;
...
...
@@ -154,8 +142,6 @@ static int query_screens(void)
monitors
[
i
].
dwFlags
=
0
;
if
(
!
IntersectRect
(
&
monitors
[
i
].
rcWork
,
&
rc_work
,
&
monitors
[
i
].
rcMonitor
))
monitors
[
i
].
rcWork
=
monitors
[
i
].
rcMonitor
;
/* FIXME: using the same device name for all monitors for now */
lstrcpyW
(
monitors
[
i
].
szDevice
,
default_monitor
.
szDevice
);
}
get_primary
()
->
dwFlags
|=
MONITORINFOF_PRIMARY
;
...
...
@@ -322,6 +308,7 @@ static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct x11drv_monitor *
{
lstrcpyW
(
monitor
[
index
].
name
,
generic_nonpnp_monitorW
);
monitor
[
index
].
rc_monitor
=
monitors
[
i
].
rcMonitor
;
monitor
[
index
].
rc_work
=
monitors
[
i
].
rcWork
;
/* Xinerama only reports monitors already attached */
monitor
[
index
].
state_flags
=
DISPLAY_DEVICE_ATTACHED
;
if
(
!
IsRectEmpty
(
&
monitors
[
i
].
rcMonitor
))
...
...
@@ -371,8 +358,8 @@ void xinerama_init( unsigned int width, unsigned int height )
OffsetRect
(
&
monitors
[
i
].
rcMonitor
,
rect
.
left
,
rect
.
top
);
OffsetRect
(
&
monitors
[
i
].
rcWork
,
rect
.
left
,
rect
.
top
);
UnionRect
(
&
virtual_screen_rect
,
&
virtual_screen_rect
,
&
monitors
[
i
].
rcMonitor
);
TRACE
(
"monitor
%p
: %s work %s%s
\n
"
,
i
ndex_to_monitor
(
i
)
,
wine_dbgstr_rect
(
&
monitors
[
i
].
rcMonitor
),
TRACE
(
"monitor
0x%x
: %s work %s%s
\n
"
,
i
,
wine_dbgstr_rect
(
&
monitors
[
i
].
rcMonitor
),
wine_dbgstr_rect
(
&
monitors
[
i
].
rcWork
),
(
monitors
[
i
].
dwFlags
&
MONITORINFOF_PRIMARY
)
?
" (primary)"
:
""
);
}
...
...
@@ -390,24 +377,3 @@ void xinerama_init( unsigned int width, unsigned int height )
TRACE
(
"virtual size: %s primary: %s
\n
"
,
wine_dbgstr_rect
(
&
virtual_screen_rect
),
wine_dbgstr_rect
(
&
primary
->
rcMonitor
)
);
}
/***********************************************************************
* X11DRV_GetMonitorInfo (X11DRV.@)
*/
BOOL
CDECL
X11DRV_GetMonitorInfo
(
HMONITOR
handle
,
LPMONITORINFO
info
)
{
int
i
=
monitor_to_index
(
handle
);
if
(
i
==
-
1
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
info
->
rcMonitor
=
monitors
[
i
].
rcMonitor
;
info
->
rcWork
=
monitors
[
i
].
rcWork
;
info
->
dwFlags
=
monitors
[
i
].
dwFlags
;
if
(
info
->
cbSize
>=
sizeof
(
MONITORINFOEXW
))
lstrcpyW
(
((
MONITORINFOEXW
*
)
info
)
->
szDevice
,
monitors
[
i
].
szDevice
);
return
TRUE
;
}
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