[PATCH] xfree86: after VT switching back, only enable previously enabled devices

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 11 23:08:15 PDT 2012


If a device was enabled before the VT switch, re-enabled it. Otherwise leave
it as is, there was probably a reason why it was disabled.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
bit of a hack, we could store this in the device struct but this approach is
sufficient.

Note that this only affects xfree86 devices, virtual devices (master
devices) are enabled anyway.

 hw/xfree86/common/xf86Events.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 058057e..c56243e 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -415,6 +415,7 @@ xf86VTSwitch(void)
     static int prevSIGIO;
     InputInfoPtr pInfo;
     IHPtr ih;
+    static char device_was_enabled[MAXDEVICES];
 
     DebugF("xf86VTSwitch()\n");
 
@@ -449,6 +450,7 @@ xf86VTSwitch(void)
             xf86DisableInputHandler(ih);
         for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
             if (pInfo->dev) {
+                device_was_enabled[pInfo->dev->id] = pInfo->dev->enabled;
                 xf86ReleaseKeys(pInfo->dev);
                 ProcessInputEvents();
                 DisableDevice(pInfo->dev, TRUE);
@@ -482,7 +484,7 @@ xf86VTSwitch(void)
 
             pInfo = xf86InputDevs;
             while (pInfo) {
-                if (pInfo->dev)
+                if (pInfo->dev && device_was_enabled[pInfo->dev->id])
                     EnableDevice(pInfo->dev, TRUE);
                 pInfo = pInfo->next;
             }
@@ -537,7 +539,7 @@ xf86VTSwitch(void)
 
         pInfo = xf86InputDevs;
         while (pInfo) {
-            if (pInfo->dev)
+            if (pInfo->dev && device_was_enabled[pInfo->dev->id])
                 EnableDevice(pInfo->dev, TRUE);
             pInfo = pInfo->next;
         }
-- 
1.7.10


More information about the xorg-devel mailing list