[PATCH 7/7] winex11.drv: Handle display device changes.

Zhiyi Zhang zzhang at codeweavers.com
Wed Mar 20 03:10:34 CDT 2019


Signed-off-by: Zhiyi Zhang <zzhang at 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..3cb1ca0f06 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_DisplayDevice_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_DisplayDevice_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 e5639f1c97..29cadb173e 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -372,7 +372,7 @@ static void cleanup_devices(void)
     SetupDiDestroyDeviceInfoList(devinfo);
 }
 
-BOOL X11DRV_DisplayDevice_Init(void)
+BOOL X11DRV_DisplayDevice_Init(const char *name, BOOL force)
 {
     struct x11drv_gpu *gpus = NULL;
     struct x11drv_adapter *adapters = NULL;
@@ -389,12 +389,18 @@ BOOL X11DRV_DisplayDevice_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 68de720408..cf21d60504 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_DisplayDevice_SetHandler(const struct x11drv_display_device_handler *handler) DECLSPEC_HIDDEN;
-extern BOOL X11DRV_DisplayDevice_Init(void) DECLSPEC_HIDDEN;
+extern BOOL X11DRV_DisplayDevice_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 178f9c1b4e..e0209fd5f5 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_DisplayDevice_Init();
+    X11DRV_DisplayDevice_Init(NULL, FALSE);
     return TRUE;
 }
 
-- 
2.19.2




More information about the wine-devel mailing list