[PATCH] Set a flag property on the root window when the server VT is not active as some clients need to know this.

Michael Thayer michael.thayer at oracle.com
Mon Mar 17 04:49:09 PDT 2014


Signed-off-by: Michael Thayer <michael.thayer at oracle.com>
---
 hw/xfree86/common/xf86Events.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 06af739..a1b43bb 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -56,6 +56,7 @@
 #include <X11/X.h>
 #include <X11/Xpoll.h>
 #include <X11/Xproto.h>
+#include <X11/Xatom.h>
 #include "misc.h"
 #include "compiler.h"
 #include "xf86.h"
@@ -103,6 +104,9 @@ Bool VTSwitchEnabled = TRUE;    /* Allows run-time disabling for
 
 extern fd_set EnabledDevices;
 
+/* Name chosen to match the "XFree86_VT" atom. */
+#define NO_VT_ATOM_NAME "XFree86_NO_VT"
+
 #ifdef XF86PM
 extern void (*xf86OSPMClose) (void);
 #endif
@@ -431,6 +435,34 @@ xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo)
     pInfo->flags &= ~XI86_DEVICE_DISABLED;
 }
 
+/*
+ * xf86CreateRemoveNoVTProperty --
+ *    Set a flag property on the root window when the server VT is not active
+ *    as some clients need to know this.
+ */
+static void
+xf86CreateRemoveNoVTProperty(Bool create)
+{
+    Atom property_name;
+    int32_t value = 1;
+    int i;
+
+    property_name = MakeAtom(NO_VT_ATOM_NAME, sizeof(NO_VT_ATOM_NAME) - 1,
+                             TRUE);
+    if (property_name == BAD_RESOURCE)
+        FatalError("Failed to create or retrieve \"NO_VT\" atom\n");
+    for (i = 0; i < xf86NumScreens; i++) {
+        if (create)
+            ChangeWindowProperty(xf86ScrnToScreen(xf86Screens[i])->root,
+                                 property_name, XA_INTEGER, 32,
+                                 PropModeReplace, 1, &value, TRUE);
+        else
+            DeleteProperty(serverClient,
+                           xf86ScrnToScreen(xf86Screens[i])->root,
+                           property_name);
+    }
+}
+
 void
 xf86VTLeave(void)
 {
@@ -490,6 +522,8 @@ xf86VTLeave(void)
     if (xorgHWAccess)
         xf86DisableIO();
 
+    xf86CreateRemoveNoVTProperty(TRUE);
+
     return;
 
 switch_failed:
@@ -574,6 +608,8 @@ xf86VTEnter(void)
     xf86platformVTProbe();
 #endif
 
+    xf86CreateRemoveNoVTProperty(FALSE);
+
     OsReleaseSIGIO();
 }
 
-- 
ORACLE Deutschland B.V. & Co. KG   Michael Thayer
Werkstrasse 24                     VirtualBox engineering
71384 Weinstadt, Germany           mailto:michael.thayer at oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Geschäftsführer: Jürgen Kunz

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher


More information about the xorg-devel mailing list