Index: /trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
===================================================================
--- /trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp	(revision 84155)
+++ /trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp	(revision 84156)
@@ -124,5 +124,4 @@
     XRRScreenResources *pScreenResources;
     int hRandRMajor;
-    int hVMWCtrlMajorOpCode;
     int hRandRMinor;
     int hRandREventBase;
@@ -132,4 +131,6 @@
     int hOutputCount;
     void *pRandLibraryHandle;
+    bool fWmwareCtrlExtention;
+    int hVMWCtrlMajorOpCode;
     /** Function pointers we used if we dlopen libXrandr instead of linking. */
     void (*pXRRSelectInput) (Display *, Window, int);
@@ -426,5 +427,8 @@
 }
 
-
+/** Makes a call to vmwarectrl extension. This updates the
+ * connection information and possible resolutions (modes)
+ * of each monitor on the driver. Also sets the preferred mode
+ * of each output (monitor) to currently selected one. */
 bool VMwareCtrlSetTopology(Display *dpy, int hExtensionMajorOpcode,
                             int screen, xXineramaScreenInfo extents[], int number)
@@ -780,4 +784,5 @@
     x11Context.pXRRGetCrtcInfo = NULL;
     x11Context.pXRRAddOutputMode = NULL;
+    x11Context.fWmwareCtrlExtention = false;
 
     int dummy;
@@ -798,13 +803,15 @@
     }
 #endif
-    if (!XQueryExtension(x11Context.pDisplay, "VMWARE_CTRL",
-                         &x11Context.hVMWCtrlMajorOpCode, &dummy, &dummy))
-    {
-        XCloseDisplay(x11Context.pDisplay);
-        XCloseDisplay(x11Context.pDisplayRandRMonitoring);
-        x11Context.pDisplay = NULL;
-        x11Context.pDisplayRandRMonitoring = NULL;
-        return;
-    }
+
+    x11Context.fWmwareCtrlExtention = XQueryExtension(x11Context.pDisplay, "VMWARE_CTRL",
+                                                      &x11Context.hVMWCtrlMajorOpCode, &dummy, &dummy);
+    if (!x11Context.fWmwareCtrlExtention)
+        VBClLogError("VMWARE's ctrl extension is not available!\n");
+    else
+    {
+        VBClLogInfo("VMWARE's ctrl extension is available. Major Opcode is %d.\n", x11Context.hVMWCtrlMajorOpCode);
+    }
+
+    /* Check Xrandr stuff. */
     bool fSuccess = false;
 #ifdef WITH_DISTRO_XRAND_XINERAMA
@@ -1115,5 +1122,6 @@
 {
     XGrabServer(x11Context.pDisplay);
-    callVMWCTRL(paOutputs);
+    if (x11Context.fWmwareCtrlExtention)
+        callVMWCTRL(paOutputs);
 
 #ifdef WITH_DISTRO_XRAND_XINERAMA
