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
60eb5cb5
Commit
60eb5cb5
authored
Apr 22, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
May 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Introduce a new add_virtual_modes helper.
parent
b86cc9e6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
54 deletions
+54
-54
sysparams.c
dlls/win32u/sysparams.c
+54
-54
No files found.
dlls/win32u/sysparams.c
View file @
60eb5cb5
...
@@ -1777,7 +1777,7 @@ static BOOL default_update_display_devices( BOOL force, struct device_manager_ct
...
@@ -1777,7 +1777,7 @@ static BOOL default_update_display_devices( BOOL force, struct device_manager_ct
}
}
/* parse the desktop size specification */
/* parse the desktop size specification */
static
BOOL
parse_size
(
const
WCHAR
*
size
,
unsigned
int
*
width
,
unsigned
int
*
height
)
static
BOOL
parse_size
(
const
WCHAR
*
size
,
DWORD
*
width
,
DWORD
*
height
)
{
{
WCHAR
*
end
;
WCHAR
*
end
;
...
@@ -1790,7 +1790,7 @@ static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *he
...
@@ -1790,7 +1790,7 @@ static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *he
}
}
/* retrieve the default desktop size from the registry */
/* retrieve the default desktop size from the registry */
static
BOOL
get_default_desktop_size
(
unsigned
int
*
width
,
unsigned
int
*
height
)
static
BOOL
get_default_desktop_size
(
DWORD
*
width
,
DWORD
*
height
)
{
{
WCHAR
buffer
[
4096
];
WCHAR
buffer
[
4096
];
KEY_VALUE_PARTIAL_INFORMATION
*
value
=
(
void
*
)
buffer
;
KEY_VALUE_PARTIAL_INFORMATION
*
value
=
(
void
*
)
buffer
;
...
@@ -1808,9 +1808,9 @@ static BOOL get_default_desktop_size( unsigned int *width, unsigned int *height
...
@@ -1808,9 +1808,9 @@ static BOOL get_default_desktop_size( unsigned int *width, unsigned int *height
return
TRUE
;
return
TRUE
;
}
}
static
BOOL
add_virtual_source
(
struct
device_manager_ctx
*
ctx
)
static
void
add_virtual_modes
(
struct
device_manager_ctx
*
ctx
,
const
DEVMODEW
*
current
,
const
DEVMODEW
*
initial
,
const
DEVMODEW
*
maximum
)
{
{
struct
gdi_monitor
monitor
=
{
0
};
static
struct
screen_size
static
struct
screen_size
{
{
unsigned
int
width
;
unsigned
int
width
;
...
@@ -1848,17 +1848,57 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx )
...
@@ -1848,17 +1848,57 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx )
{
1920
,
1200
},
{
1920
,
1200
},
{
2560
,
1600
}
{
2560
,
1600
}
};
};
UINT
depths
[]
=
{
8
,
16
,
initial
->
dmBitsPerPel
},
i
,
j
,
modes_count
;
DEVMODEW
*
modes
;
if
(
!
(
modes
=
malloc
(
ARRAY_SIZE
(
depths
)
*
(
ARRAY_SIZE
(
screen_sizes
)
+
2
)
*
sizeof
(
*
modes
)
)))
return
;
for
(
modes_count
=
i
=
0
;
i
<
ARRAY_SIZE
(
depths
);
++
i
)
{
DEVMODEW
mode
=
{
.
dmFields
=
DM_DISPLAYORIENTATION
|
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_DISPLAYFLAGS
|
DM_DISPLAYFREQUENCY
,
.
dmDisplayFrequency
=
60
,
.
dmBitsPerPel
=
depths
[
i
],
};
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
screen_sizes
);
++
j
)
{
mode
.
dmPelsWidth
=
screen_sizes
[
j
].
width
;
mode
.
dmPelsHeight
=
screen_sizes
[
j
].
height
;
if
(
mode
.
dmPelsWidth
>
maximum
->
dmPelsWidth
||
mode
.
dmPelsHeight
>
maximum
->
dmPelsWidth
)
continue
;
if
(
mode
.
dmPelsWidth
==
maximum
->
dmPelsWidth
&&
mode
.
dmPelsHeight
==
maximum
->
dmPelsWidth
)
continue
;
if
(
mode
.
dmPelsWidth
==
initial
->
dmPelsWidth
&&
mode
.
dmPelsHeight
==
initial
->
dmPelsHeight
)
continue
;
modes
[
modes_count
++
]
=
mode
;
}
mode
.
dmPelsWidth
=
initial
->
dmPelsWidth
;
mode
.
dmPelsHeight
=
initial
->
dmPelsHeight
;
modes
[
modes_count
++
]
=
mode
;
if
(
maximum
->
dmPelsWidth
!=
initial
->
dmPelsWidth
||
maximum
->
dmPelsWidth
!=
initial
->
dmPelsHeight
)
{
mode
.
dmPelsWidth
=
maximum
->
dmPelsWidth
;
mode
.
dmPelsHeight
=
maximum
->
dmPelsHeight
;
modes
[
modes_count
++
]
=
mode
;
}
}
add_modes
(
current
,
modes_count
,
modes
,
ctx
);
free
(
modes
);
}
UINT
screen_width
,
screen_height
,
max_width
,
max_height
,
modes_count
;
static
BOOL
add_virtual_source
(
struct
device_manager_ctx
*
ctx
)
unsigned
int
depths
[]
=
{
8
,
16
,
0
};
{
DEVMODEW
current
,
initial
=
ctx
->
primary
,
maximum
=
ctx
->
primary
;
struct
source
virtual_source
=
struct
source
virtual_source
=
{
{
.
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
,
.
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
,
.
id
=
ctx
->
source_count
,
.
id
=
ctx
->
source_count
,
.
gpu
=
&
ctx
->
gpu
,
.
gpu
=
&
ctx
->
gpu
,
};
};
DEVMODEW
current
,
*
modes
;
struct
gdi_monitor
monitor
=
{
0
};
UINT
i
,
j
;
/* Wine specific config key where source settings will be held, symlinked with the logically indexed config key */
/* Wine specific config key where source settings will be held, symlinked with the logically indexed config key */
snprintf
(
virtual_source
.
path
,
sizeof
(
virtual_source
.
path
),
"%s
\\
%s
\\
Video
\\
%s
\\
Sources
\\
%s"
,
config_keyA
,
snprintf
(
virtual_source
.
path
,
sizeof
(
virtual_source
.
path
),
"%s
\\
%s
\\
Video
\\
%s
\\
Sources
\\
%s"
,
config_keyA
,
...
@@ -1874,22 +1914,18 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx )
...
@@ -1874,22 +1914,18 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx )
ctx
->
gpu
.
source_count
++
;
ctx
->
gpu
.
source_count
++
;
ctx
->
source_count
++
;
ctx
->
source_count
++
;
max_width
=
ctx
->
primary
.
dmPelsWidth
;
if
(
!
get_default_desktop_size
(
&
initial
.
dmPelsWidth
,
&
initial
.
dmPelsHeight
))
max_height
=
ctx
->
primary
.
dmPelsHeight
;
depths
[
ARRAY_SIZE
(
depths
)
-
1
]
=
ctx
->
primary
.
dmBitsPerPel
;
if
(
!
get_default_desktop_size
(
&
screen_width
,
&
screen_height
))
{
{
screen_width
=
max_w
idth
;
initial
.
dmPelsWidth
=
maximum
.
dmPelsW
idth
;
screen_height
=
max_h
eight
;
initial
.
dmPelsHeight
=
maximum
.
dmPelsH
eight
;
}
}
if
(
!
read_source_mode
(
ctx
->
source_key
,
ENUM_CURRENT_SETTINGS
,
&
current
))
if
(
!
read_source_mode
(
ctx
->
source_key
,
ENUM_CURRENT_SETTINGS
,
&
current
))
{
{
current
=
ctx
->
primary
;
current
=
ctx
->
primary
;
current
.
dmDisplayFrequency
=
60
;
current
.
dmDisplayFrequency
=
60
;
current
.
dmPelsWidth
=
screen_w
idth
;
current
.
dmPelsWidth
=
initial
.
dmPelsW
idth
;
current
.
dmPelsHeight
=
screen_h
eight
;
current
.
dmPelsHeight
=
initial
.
dmPelsH
eight
;
}
}
monitor
.
rc_monitor
.
right
=
current
.
dmPelsWidth
;
monitor
.
rc_monitor
.
right
=
current
.
dmPelsWidth
;
...
@@ -1897,43 +1933,7 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx )
...
@@ -1897,43 +1933,7 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx )
monitor
.
rc_work
.
right
=
current
.
dmPelsWidth
;
monitor
.
rc_work
.
right
=
current
.
dmPelsWidth
;
monitor
.
rc_work
.
bottom
=
current
.
dmPelsHeight
;
monitor
.
rc_work
.
bottom
=
current
.
dmPelsHeight
;
add_monitor
(
&
monitor
,
ctx
);
add_monitor
(
&
monitor
,
ctx
);
add_virtual_modes
(
ctx
,
&
current
,
&
initial
,
&
maximum
);
if
(
!
(
modes
=
malloc
(
ARRAY_SIZE
(
depths
)
*
(
ARRAY_SIZE
(
screen_sizes
)
+
2
)
*
sizeof
(
*
modes
)
)))
return
FALSE
;
for
(
modes_count
=
i
=
0
;
i
<
ARRAY_SIZE
(
depths
);
++
i
)
{
DEVMODEW
mode
=
{
.
dmFields
=
DM_DISPLAYORIENTATION
|
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_DISPLAYFLAGS
|
DM_DISPLAYFREQUENCY
,
.
dmDisplayFrequency
=
60
,
.
dmBitsPerPel
=
depths
[
i
],
};
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
screen_sizes
);
++
j
)
{
mode
.
dmPelsWidth
=
screen_sizes
[
j
].
width
;
mode
.
dmPelsHeight
=
screen_sizes
[
j
].
height
;
if
(
mode
.
dmPelsWidth
>
max_width
||
mode
.
dmPelsHeight
>
max_height
)
continue
;
if
(
mode
.
dmPelsWidth
==
max_width
&&
mode
.
dmPelsHeight
==
max_height
)
continue
;
if
(
mode
.
dmPelsWidth
==
screen_width
&&
mode
.
dmPelsHeight
==
screen_height
)
continue
;
modes
[
modes_count
++
]
=
mode
;
}
mode
.
dmPelsWidth
=
screen_width
;
mode
.
dmPelsHeight
=
screen_height
;
modes
[
modes_count
++
]
=
mode
;
if
(
max_width
!=
screen_width
||
max_height
!=
screen_height
)
{
mode
.
dmPelsWidth
=
max_width
;
mode
.
dmPelsHeight
=
max_height
;
modes
[
modes_count
++
]
=
mode
;
}
}
add_modes
(
&
current
,
modes_count
,
modes
,
ctx
);
free
(
modes
);
return
TRUE
;
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