From 0fe854b7dd2e7fd383190cc07d69add71e4a0935 Mon Sep 17 00:00:00 2001
From: Francois Gouget <fgouget@codeweavers.com>
Date: Mon, 10 Sep 2001 23:05:57 +0000
Subject: [PATCH] Added an option to disable XVidMode support.

---
 dlls/x11drv/x11drv_main.c    |  5 ++++-
 dlls/x11drv/xvidmode.c       | 10 +++++++---
 documentation/samples/config |  2 ++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c
index 2638300460f..e801606fe21 100644
--- a/dlls/x11drv/x11drv_main.c
+++ b/dlls/x11drv/x11drv_main.c
@@ -55,7 +55,7 @@ unsigned int screen_width;
 unsigned int screen_height;
 unsigned int screen_depth;
 Window root_window;
-int dxgrab, usedga;
+int dxgrab, usedga, usexvidmode;
 
 unsigned int X11DRV_server_startticks;
 
@@ -219,6 +219,9 @@ static void setup_options(void)
     if (!get_config_key( hkey, appkey, "UseDGA", buffer, sizeof(buffer) ))
         usedga = IS_OPTION_TRUE( buffer[0] );
 
+    if (!get_config_key( hkey, appkey, "UseXVidMode", buffer, sizeof(buffer) ))
+        usexvidmode = IS_OPTION_TRUE( buffer[0] );
+
     screen_depth = 0;
     if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
         screen_depth = atoi(buffer);
diff --git a/dlls/x11drv/xvidmode.c b/dlls/x11drv/xvidmode.c
index 9ed82aa38ca..c347d049aea 100644
--- a/dlls/x11drv/xvidmode.c
+++ b/dlls/x11drv/xvidmode.c
@@ -24,6 +24,8 @@ DEFAULT_DEBUG_CHANNEL(x11drv);
 
 #ifdef HAVE_LIBXXF86VM
 
+extern int usexvidmode;
+
 static int xf86vm_event, xf86vm_error, xf86vm_major, xf86vm_minor;
 
 LPDDHALMODEINFO xf86vm_modes;
@@ -62,13 +64,15 @@ void X11DRV_XF86VM_Init(void)
 
   if (xf86vm_major) return; /* already initialized? */
 
+  /* if in desktop mode, don't use XVidMode */
+  if (root_window != DefaultRootWindow(gdi_display)) return;
+
+  if (!usexvidmode) return;
+
   /* see if XVidMode is available */
   if (!TSXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error)) return;
   if (!TSXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor)) return;
 
-  /* if in desktop mode, don't use XVidMode */
-  if (root_window != DefaultRootWindow(gdi_display)) return;
-
   /* retrieve modes */
   if (!TSXF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes,
 				    &modes))
diff --git a/documentation/samples/config b/documentation/samples/config
index 73be5265fb1..5fbdcaf510d 100644
--- a/documentation/samples/config
+++ b/documentation/samples/config
@@ -124,6 +124,8 @@ WINE REGISTRY Version 2
 "UseDGA" = "Y"
 ; Use XShm extension if present
 "UseXShm" = "Y"
+; Use XVidMode extension if present
+"UseXVidMode" = "Y"
 ; Enable DirectX mouse grab
 "DXGrab" = "N"
 ; Create the desktop window with a double-buffered visual
-- 
GitLab