Rémi Bernon : win32u: Add a BOOL force parameter to update_display_cache.
Module: wine Branch: master Commit: 8a9c34edb54d8403405701ceeb0807d53d562fbf URL: https://gitlab.winehq.org/wine/wine/-/commit/8a9c34edb54d8403405701ceeb0807d... Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Sep 14 11:45:22 2022 +0200 win32u: Add a BOOL force parameter to update_display_cache. And call it recursively with force = TRUE instead of calling graphics driver pUpdateDisplayDevices separately. --- dlls/win32u/sysparams.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index da1b3bbcd2e..d2e5a2f1e2b 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1512,7 +1512,7 @@ static BOOL update_display_cache_from_registry(void) return ret; } -static BOOL update_display_cache(void) +static BOOL update_display_cache( BOOL force ) { HWINSTA winstation = NtUserGetProcessWindowStation(); struct device_manager_ctx ctx = {0}; @@ -1529,17 +1529,7 @@ static BOOL update_display_cache(void) return TRUE; } - user_driver->pUpdateDisplayDevices( &device_manager, FALSE, &ctx ); - release_display_manager_ctx( &ctx ); - - if (update_display_cache_from_registry()) return TRUE; - if (ctx.gpu_count) - { - ERR( "driver reported devices, but we failed to read them\n" ); - return FALSE; - } - - if (!user_driver->pUpdateDisplayDevices( &device_manager, TRUE, &ctx )) + if (!user_driver->pUpdateDisplayDevices( &device_manager, force, &ctx ) && force) { static const DEVMODEW modes[] = { @@ -1578,15 +1568,27 @@ static BOOL update_display_cache(void) if (!update_display_cache_from_registry()) { - ERR( "failed to read display config\n" ); - return FALSE; + if (force) + { + ERR( "Failed to read display config.\n" ); + return FALSE; + } + + if (ctx.gpu_count) + { + ERR( "Driver reported devices, but we failed to read them.\n" ); + return FALSE; + } + + return update_display_cache( TRUE ); } + return TRUE; } static BOOL lock_display_devices(void) { - if (!update_display_cache()) return FALSE; + if (!update_display_cache( FALSE )) return FALSE; pthread_mutex_lock( &display_lock ); return TRUE; }
participants (1)
-
Alexandre Julliard