Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/winex11.drv/desktop.c | 2 ++ dlls/winex11.drv/display.c | 10 ++++++++-- dlls/winex11.drv/x11drv.h | 2 +- dlls/winex11.drv/x11drv_main.c | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index d478cbdcb3..c69c2122ab 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -154,6 +154,7 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) max_width = primary_rect.right - primary_rect.left; max_height = primary_rect.bottom - primary_rect.top; xinerama_init( width, height ); + X11DRV_DisplayDevices_Init( "Xinerama", TRUE );
/* initialize the available resolutions */ dd_modes = X11DRV_Settings_SetHandlers("desktop", @@ -303,6 +304,7 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height ) resize_data.old_virtual_rect = get_virtual_screen_rect();
xinerama_init( width, height ); + X11DRV_DisplayDevices_Init( "Xinerama", TRUE ); resize_data.new_virtual_rect = get_virtual_screen_rect();
if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 99124d05cf..6e3cdf9540 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -370,7 +370,7 @@ static void cleanup_devices(void) SetupDiDestroyDeviceInfoList(devinfo); }
-BOOL X11DRV_DisplayDevices_Init(void) +BOOL X11DRV_DisplayDevices_Init(const char *name, BOOL force) { struct x11drv_gpu *gpus = NULL; struct x11drv_adapter *adapters = NULL; @@ -387,12 +387,18 @@ BOOL X11DRV_DisplayDevices_Init(void)
TRACE("via %s\n", wine_dbgstr_a(handler.name));
+ if (name && strcmp(handler.name, name)) + { + TRACE("Wrong handler name %s, ignoring\n", name); + return FALSE; + } + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, video_keyW, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &video_hkey, &disposition)) goto fail;
/* Ensure only one thread is initializing the registry and avoid unnecessary reinit */ - if (disposition != REG_CREATED_NEW_KEY) + if (!force && disposition != REG_CREATED_NEW_KEY) { ret = TRUE; goto fail; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 56fbf3f22d..ca8b1e88ea 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -740,7 +740,7 @@ struct x11drv_display_device_handler };
extern void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler *handler) DECLSPEC_HIDDEN; -extern BOOL X11DRV_DisplayDevices_Init(void) DECLSPEC_HIDDEN; +extern BOOL X11DRV_DisplayDevices_Init(const char *name, BOOL force) DECLSPEC_HIDDEN;
/* XIM support */ extern BOOL X11DRV_InitXIM( const char *input_style ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 69478741f1..b0fa225565 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -597,7 +597,7 @@ static BOOL process_attach(void) X11DRV_InitKeyboard( gdi_display ); if (use_xim) use_xim = X11DRV_InitXIM( input_style );
- X11DRV_DisplayDevices_Init(); + X11DRV_DisplayDevices_Init(NULL, FALSE); return TRUE; }