Commit ee0aad5c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Keep the primary current mode in the device manager context.

parent 72e42962
...@@ -924,9 +924,7 @@ struct device_manager_ctx ...@@ -924,9 +924,7 @@ struct device_manager_ctx
HKEY source_key; HKEY source_key;
/* for the virtual desktop settings */ /* for the virtual desktop settings */
BOOL is_primary; BOOL is_primary;
UINT primary_bpp; DEVMODEW primary;
UINT primary_width;
UINT primary_height;
}; };
static void link_device( const char *instance, const char *class ) static void link_device( const char *instance, const char *class )
...@@ -1828,13 +1826,7 @@ static void desktop_add_monitor( const struct gdi_monitor *monitor, void *param ...@@ -1828,13 +1826,7 @@ static void desktop_add_monitor( const struct gdi_monitor *monitor, void *param
static void desktop_add_mode( const DEVMODEW *mode, BOOL current, void *param ) static void desktop_add_mode( const DEVMODEW *mode, BOOL current, void *param )
{ {
struct device_manager_ctx *ctx = param; struct device_manager_ctx *ctx = param;
if (ctx->is_primary && current) ctx->primary = *mode;
if (ctx->is_primary && current)
{
ctx->primary_bpp = mode->dmBitsPerPel;
ctx->primary_width = mode->dmPelsWidth;
ctx->primary_height = mode->dmPelsHeight;
}
} }
static const struct gdi_device_manager desktop_device_manager = static const struct gdi_device_manager desktop_device_manager =
...@@ -1891,20 +1883,16 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct ...@@ -1891,20 +1883,16 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct
struct device_manager_ctx desktop_ctx = {0}; struct device_manager_ctx desktop_ctx = {0};
UINT screen_width, screen_height, max_width, max_height; UINT screen_width, screen_height, max_width, max_height;
unsigned int depths[] = {8, 16, 0}; unsigned int depths[] = {8, 16, 0};
DEVMODEW current, mode = DEVMODEW current;
{
.dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY,
.dmDisplayFrequency = 60,
};
UINT i, j; UINT i, j;
if (!force) return TRUE; if (!force) return TRUE;
/* in virtual desktop mode, read the device list from the user driver but expose virtual devices */ /* in virtual desktop mode, read the device list from the user driver but expose virtual devices */
if (!update_display_devices( &desktop_device_manager, TRUE, &desktop_ctx )) return FALSE; if (!update_display_devices( &desktop_device_manager, TRUE, &desktop_ctx )) return FALSE;
max_width = desktop_ctx.primary_width; max_width = desktop_ctx.primary.dmPelsWidth;
max_height = desktop_ctx.primary_height; max_height = desktop_ctx.primary.dmPelsHeight;
depths[ARRAY_SIZE(depths) - 1] = desktop_ctx.primary_bpp; depths[ARRAY_SIZE(depths) - 1] = desktop_ctx.primary.dmBitsPerPel;
if (!get_default_desktop_size( &screen_width, &screen_height )) if (!get_default_desktop_size( &screen_width, &screen_height ))
{ {
...@@ -1916,9 +1904,7 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct ...@@ -1916,9 +1904,7 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct
add_source( "Default", source_flags, ctx ); add_source( "Default", source_flags, ctx );
if (!read_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, &current )) if (!read_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, &current ))
{ {
current = mode; current = desktop_ctx.primary;
current.dmFields |= DM_POSITION;
current.dmBitsPerPel = desktop_ctx.primary_bpp;
current.dmPelsWidth = screen_width; current.dmPelsWidth = screen_width;
current.dmPelsHeight = screen_height; current.dmPelsHeight = screen_height;
} }
...@@ -1931,7 +1917,12 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct ...@@ -1931,7 +1917,12 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct
for (i = 0; i < ARRAY_SIZE(depths); ++i) for (i = 0; i < ARRAY_SIZE(depths); ++i)
{ {
mode.dmBitsPerPel = 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) for (j = 0; j < ARRAY_SIZE(screen_sizes); ++j)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment