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
9c99d9bc
Commit
9c99d9bc
authored
Jul 27, 2020
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Jul 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Migrate NoRes display settings handler to a new interface.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2116b497
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
12 deletions
+81
-12
settings.c
dlls/winex11.drv/settings.c
+81
-12
No files found.
dlls/winex11.drv/settings.c
View file @
9c99d9bc
...
...
@@ -169,30 +169,99 @@ void X11DRV_Settings_SetHandler(const struct x11drv_settings_handler *new_handle
* Default handlers if resolution switching is not enabled
*
*/
static
int
X11DRV_nores_GetCurrentMode
(
vo
id
)
static
BOOL
nores_get_id
(
const
WCHAR
*
device_name
,
ULONG_PTR
*
id
)
{
return
0
;
WCHAR
primary_adapter
[
CCHDEVICENAME
];
if
(
!
get_primary_adapter
(
primary_adapter
))
return
FALSE
;
*
id
=
!
lstrcmpiW
(
device_name
,
primary_adapter
)
?
1
:
0
;
return
TRUE
;
}
static
BOOL
nores_get_modes
(
ULONG_PTR
id
,
DWORD
flags
,
DEVMODEW
**
new_modes
,
UINT
*
mode_count
)
{
RECT
primary
=
get_host_primary_monitor_rect
();
DEVMODEW
*
modes
;
modes
=
heap_calloc
(
1
,
sizeof
(
*
modes
));
if
(
!
modes
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
modes
[
0
].
dmSize
=
sizeof
(
*
modes
);
modes
[
0
].
dmDriverExtra
=
0
;
modes
[
0
].
dmFields
=
DM_DISPLAYORIENTATION
|
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_DISPLAYFLAGS
|
DM_DISPLAYFREQUENCY
;
modes
[
0
].
u1
.
s2
.
dmDisplayOrientation
=
DMDO_DEFAULT
;
modes
[
0
].
dmBitsPerPel
=
screen_bpp
;
modes
[
0
].
dmPelsWidth
=
primary
.
right
;
modes
[
0
].
dmPelsHeight
=
primary
.
bottom
;
modes
[
0
].
u2
.
dmDisplayFlags
=
0
;
modes
[
0
].
dmDisplayFrequency
=
60
;
*
new_modes
=
modes
;
*
mode_count
=
1
;
return
TRUE
;
}
static
LONG
X11DRV_nores_SetCurrentMode
(
int
mode
)
static
void
nores_free_modes
(
DEVMODEW
*
modes
)
{
if
(
mode
==
0
)
return
DISP_CHANGE_SUCCESSFUL
;
TRACE
(
"Ignoring mode change request mode=%d
\n
"
,
mode
);
return
DISP_CHANGE_FAILED
;
heap_free
(
modes
);
}
static
BOOL
nores_get_current_mode
(
ULONG_PTR
id
,
DEVMODEW
*
mode
)
{
RECT
primary
=
get_host_primary_monitor_rect
();
mode
->
dmFields
=
DM_DISPLAYORIENTATION
|
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_DISPLAYFLAGS
|
DM_DISPLAYFREQUENCY
|
DM_POSITION
;
mode
->
u1
.
s2
.
dmDisplayOrientation
=
DMDO_DEFAULT
;
mode
->
u2
.
dmDisplayFlags
=
0
;
mode
->
u1
.
s2
.
dmPosition
.
x
=
0
;
mode
->
u1
.
s2
.
dmPosition
.
y
=
0
;
if
(
id
!=
1
)
{
FIXME
(
"Non-primary adapters are unsupported.
\n
"
);
mode
->
dmBitsPerPel
=
0
;
mode
->
dmPelsWidth
=
0
;
mode
->
dmPelsHeight
=
0
;
mode
->
dmDisplayFrequency
=
0
;
return
TRUE
;
}
mode
->
dmBitsPerPel
=
screen_bpp
;
mode
->
dmPelsWidth
=
primary
.
right
;
mode
->
dmPelsHeight
=
primary
.
bottom
;
mode
->
dmDisplayFrequency
=
60
;
return
TRUE
;
}
static
LONG
nores_set_current_mode
(
ULONG_PTR
id
,
DEVMODEW
*
mode
)
{
WARN
(
"NoRes settings handler, ignoring mode change request.
\n
"
);
return
DISP_CHANGE_SUCCESSFUL
;
}
/* default handler only gets the current X desktop resolution */
void
X11DRV_Settings_Init
(
void
)
{
RECT
primary
=
get_host_primary_monitor_rect
()
;
struct
x11drv_settings_handler
nores_handler
;
depths
=
screen_bpp
==
32
?
depths_32
:
depths_24
;
X11DRV_Settings_SetHandlers
(
"NoRes"
,
X11DRV_nores_GetCurrentMode
,
X11DRV_nores_SetCurrentMode
,
1
,
0
);
X11DRV_Settings_AddOneMode
(
primary
.
right
-
primary
.
left
,
primary
.
bottom
-
primary
.
top
,
0
,
60
);
nores_handler
.
name
=
"NoRes"
;
nores_handler
.
priority
=
0
;
nores_handler
.
get_id
=
nores_get_id
;
nores_handler
.
get_modes
=
nores_get_modes
;
nores_handler
.
free_modes
=
nores_free_modes
;
nores_handler
.
get_current_mode
=
nores_get_current_mode
;
nores_handler
.
set_current_mode
=
nores_set_current_mode
;
X11DRV_Settings_SetHandler
(
&
nores_handler
);
}
static
BOOL
get_display_device_reg_key
(
const
WCHAR
*
device_name
,
WCHAR
*
key
,
unsigned
len
)
...
...
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