From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/win32u/driver.c | 9 ++++----- dlls/win32u/sysparams.c | 38 ++++++++++++++++++------------------- dlls/wineandroid.drv/init.c | 12 ++++++++++-- dlls/winemac.drv/display.c | 8 ++++---- dlls/winemac.drv/macdrv.h | 2 +- dlls/winex11.drv/display.c | 9 ++++----- dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 4 ++-- 8 files changed, 45 insertions(+), 39 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index af6d0d610fe..baa0143be61 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -764,9 +764,9 @@ static BOOL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW m return FALSE; }
-static void nulldrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, - BOOL force, void *param ) +static BOOL nulldrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, BOOL force, void *param ) { + return FALSE; }
static BOOL nulldrv_CreateDesktopWindow( HWND hwnd ) @@ -1111,10 +1111,9 @@ static void loaderdrv_UpdateClipboard(void) load_driver()->pUpdateClipboard(); }
-static void loaderdrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, - BOOL force, void *param ) +static BOOL loaderdrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, BOOL force, void *param ) { - load_driver()->pUpdateDisplayDevices( manager, force, param ); + return load_driver()->pUpdateDisplayDevices( manager, force, param ); }
static BOOL loaderdrv_CreateDesktopWindow( HWND hwnd ) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index b63df3e3aab..2ca54714d88 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1007,13 +1007,6 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param )
TRACE( "\n" );
- if (!ctx->gpu_count) - { - static const struct gdi_gpu default_gpu; - TRACE( "adding default fake GPU\n" ); - add_gpu( &default_gpu, ctx ); - } - if (ctx->adapter_key) { NtClose( ctx->adapter_key ); @@ -1079,17 +1072,6 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) TRACE( "%s %s %s\n", debugstr_w(monitor->name), wine_dbgstr_rect(&monitor->rc_monitor), wine_dbgstr_rect(&monitor->rc_work) );
- if (!ctx->adapter_count) - { - static const struct gdi_adapter default_adapter = - { - .state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | - DISPLAY_DEVICE_VGA_COMPATIBLE, - }; - TRACE( "adding default fake adapter\n" ); - add_adapter( &default_adapter, ctx ); - } - monitor_index = ctx->monitor_count++; output_index = ctx->output_count++;
@@ -1330,7 +1312,25 @@ static BOOL update_display_cache(void) return FALSE; }
- user_driver->pUpdateDisplayDevices( &device_manager, TRUE, &ctx ); + if (!user_driver->pUpdateDisplayDevices( &device_manager, TRUE, &ctx )) + { + static const struct gdi_gpu gpu; + static const struct gdi_adapter adapter = + { + .state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE, + }; + DEVMODEW mode = {.dmPelsWidth = 1024, .dmPelsHeight = 768}; + struct gdi_monitor monitor = + { + .state_flags = DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED, + .rc_monitor = {.right = mode.dmPelsWidth, .bottom = mode.dmPelsHeight}, + .rc_work = {.right = mode.dmPelsWidth, .bottom = mode.dmPelsHeight}, + }; + + add_gpu( &gpu, &ctx ); + add_adapter( &adapter, &ctx ); + add_monitor( &monitor, &ctx ); + } release_display_manager_ctx( &ctx );
if (!update_display_cache_from_registry()) diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 170ccb064a7..5d1c81a77bf 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -273,20 +273,28 @@ LONG ANDROID_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, /*********************************************************************** * ANDROID_UpdateDisplayDevices */ -void ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, - BOOL force, void *param ) +BOOL ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) { if (force || force_display_devices_refresh) { + static const struct gdi_gpu gpu; + static const struct gdi_adapter adapter = + { + .state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE, + }; struct gdi_monitor gdi_monitor = { .rc_monitor = virtual_screen_rect, .rc_work = monitor_rc_work, .state_flags = DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED, }; + device_manager->add_gpu( &gpu, param ); + device_manager->add_adapter( &adapter, param ); device_manager->add_monitor( &gdi_monitor, param ); force_display_devices_refresh = FALSE; } + + return TRUE; }
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 19b9a9cdd9d..0507acae1a9 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -1457,8 +1457,7 @@ void macdrv_displays_changed(const macdrv_event *event)
static BOOL force_display_devices_refresh;
-void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, - BOOL force, void *param ) +BOOL macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) { struct macdrv_adapter *adapters, *adapter; struct macdrv_monitor *monitors, *monitor; @@ -1466,14 +1465,14 @@ void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manage INT gpu_count, adapter_count, monitor_count; DWORD len;
- if (!force && !force_display_devices_refresh) return; + if (!force && !force_display_devices_refresh) return TRUE; force_display_devices_refresh = FALSE;
/* Initialize GPUs */ if (macdrv_get_gpus(&gpus, &gpu_count)) { ERR("could not get GPUs\n"); - return; + return FALSE; } TRACE("GPU count: %d\n", gpu_count);
@@ -1528,6 +1527,7 @@ void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manage }
macdrv_free_gpus(gpus); + return TRUE; }
/*********************************************************************** diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 7c0f7127883..72bd1cefaeb 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -131,7 +131,7 @@ extern LONG macdrv_ChangeDisplaySettingsEx(LPCWSTR devname, LPDEVMODEW devmode, extern BOOL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, LPDEVMODEW devmode, DWORD flags) DECLSPEC_HIDDEN; extern LRESULT macdrv_ClipboardWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) DECLSPEC_HIDDEN; -extern void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, +extern BOOL macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) DECLSPEC_HIDDEN; extern BOOL macdrv_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) DECLSPEC_HIDDEN; extern BOOL macdrv_SetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index dec9d0afba8..31f73898897 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -1198,8 +1198,7 @@ void X11DRV_DisplayDevices_Update(BOOL send_display_change)
static BOOL force_display_devices_refresh;
-void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, - BOOL force, void *param ) +BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) { struct x11drv_display_device_handler *handler; struct gdi_adapter *adapters; @@ -1208,15 +1207,14 @@ void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage INT gpu_count, adapter_count, monitor_count; INT gpu, adapter, monitor;
- if (!force && !force_display_devices_refresh) return; + if (!force && !force_display_devices_refresh) return TRUE; force_display_devices_refresh = FALSE; handler = is_virtual_desktop() ? &desktop_handler : &host_handler;
TRACE("via %s\n", wine_dbgstr_a(handler->name));
/* Initialize GPUs */ - if (!handler->get_gpus(&gpus, &gpu_count)) - return; + if (!handler->get_gpus( &gpus, &gpu_count )) return FALSE; TRACE("GPU count: %d\n", gpu_count);
for (gpu = 0; gpu < gpu_count; gpu++) @@ -1248,6 +1246,7 @@ void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage }
handler->free_gpus(gpus); + return TRUE; }
void X11DRV_DisplayDevices_Init(BOOL force) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 003604cd97d..cd0d33f59bf 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -217,7 +217,7 @@ extern LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd, DWORD flags, LPVOID lpvoid ) DECLSPEC_HIDDEN; extern BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DWORD flags ) DECLSPEC_HIDDEN; -extern void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, +extern BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) DECLSPEC_HIDDEN; extern BOOL X11DRV_CreateDesktopWindow( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL X11DRV_CreateWindow( HWND hwnd ) DECLSPEC_HIDDEN; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 998aa3ed3e9..77ccc431e51 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -168,7 +168,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 80 +#define WINE_GDI_DRIVER_VERSION 81
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -296,7 +296,7 @@ struct user_driver_funcs /* display modes */ LONG (*pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); BOOL (*pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD); - void (*pUpdateDisplayDevices)(const struct gdi_device_manager *,BOOL,void*); + BOOL (*pUpdateDisplayDevices)(const struct gdi_device_manager *,BOOL,void*); /* windowing functions */ BOOL (*pCreateDesktopWindow)(HWND); BOOL (*pCreateWindow)(HWND);