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
25272711
Commit
25272711
authored
Aug 17, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Sort adapter display modes after reading from the registry.
parent
e741f49a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
3 deletions
+49
-3
sysparams.c
dlls/win32u/sysparams.c
+49
-0
display.c
dlls/winex11.drv/display.c
+0
-3
No files found.
dlls/win32u/sysparams.c
View file @
25272711
...
...
@@ -546,6 +546,53 @@ static BOOL write_registry_settings( const WCHAR *adapter_path, const DEVMODEW *
return
ret
;
}
static
int
mode_compare
(
const
void
*
p1
,
const
void
*
p2
)
{
DWORD
a_width
,
a_height
,
b_width
,
b_height
;
const
DEVMODEW
*
a
=
p1
,
*
b
=
p2
;
int
ret
;
/* Depth in descending order */
if
((
ret
=
b
->
dmBitsPerPel
-
a
->
dmBitsPerPel
))
return
ret
;
/* Use the width and height in landscape mode for comparison */
if
(
a
->
dmDisplayOrientation
==
DMDO_DEFAULT
||
a
->
dmDisplayOrientation
==
DMDO_180
)
{
a_width
=
a
->
dmPelsWidth
;
a_height
=
a
->
dmPelsHeight
;
}
else
{
a_width
=
a
->
dmPelsHeight
;
a_height
=
a
->
dmPelsWidth
;
}
if
(
b
->
dmDisplayOrientation
==
DMDO_DEFAULT
||
b
->
dmDisplayOrientation
==
DMDO_180
)
{
b_width
=
b
->
dmPelsWidth
;
b_height
=
b
->
dmPelsHeight
;
}
else
{
b_width
=
b
->
dmPelsHeight
;
b_height
=
b
->
dmPelsWidth
;
}
/* Width in ascending order */
if
((
ret
=
a_width
-
b_width
))
return
ret
;
/* Height in ascending order */
if
((
ret
=
a_height
-
b_height
))
return
ret
;
/* Frequency in descending order */
if
((
ret
=
b
->
dmDisplayFrequency
-
a
->
dmDisplayFrequency
))
return
ret
;
/* Orientation in ascending order */
if
((
ret
=
a
->
dmDisplayOrientation
-
b
->
dmDisplayOrientation
))
return
ret
;
return
0
;
}
static
BOOL
read_display_adapter_settings
(
unsigned
int
index
,
struct
adapter
*
info
)
{
char
buffer
[
4096
];
...
...
@@ -606,6 +653,8 @@ static BOOL read_display_adapter_settings( unsigned int index, struct adapter *i
mode
=
NEXT_DEVMODEW
(
mode
);
}
info
->
mode_count
=
i
;
qsort
(
info
->
modes
,
info
->
mode_count
,
sizeof
(
*
info
->
modes
)
+
info
->
modes
->
dmDriverExtra
,
mode_compare
);
}
/* DeviceID */
...
...
dlls/winex11.drv/display.c
View file @
25272711
...
...
@@ -403,7 +403,6 @@ static DEVMODEW *get_full_mode(ULONG_PTR id, DEVMODEW *dev_mode)
if
(
!
settings_handler
.
get_modes
(
id
,
EDS_ROTATEDMODE
,
&
modes
,
&
mode_count
))
return
NULL
;
qsort
(
modes
,
mode_count
,
sizeof
(
*
modes
)
+
modes
[
0
].
dmDriverExtra
,
mode_compare
);
for
(
mode_idx
=
0
;
mode_idx
<
mode_count
;
++
mode_idx
)
{
found_mode
=
(
DEVMODEW
*
)((
BYTE
*
)
modes
+
(
sizeof
(
*
modes
)
+
modes
[
0
].
dmDriverExtra
)
*
mode_idx
);
...
...
@@ -1062,8 +1061,6 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage
if
(
!
settings_handler
.
get_modes
(
adapters
[
adapter
].
id
,
EDS_ROTATEDMODE
,
&
modes
,
&
mode_count
))
continue
;
qsort
(
modes
,
mode_count
,
sizeof
(
*
modes
)
+
modes
[
0
].
dmDriverExtra
,
mode_compare
);
for
(
mode
=
modes
;
mode_count
;
mode_count
--
)
{
TRACE
(
"mode: %p
\n
"
,
mode
);
...
...
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