Index: xorg-server-1.6.3.901/hw/xfree86/common/xf86Events.c =================================================================== --- xorg-server-1.6.3.901.orig/hw/xfree86/common/xf86Events.c +++ xorg-server-1.6.3.901/hw/xfree86/common/xf86Events.c @@ -518,22 +518,26 @@ xf86VTSwitch() * Keep the order: Disable Device > LeaveVT * EnterVT > EnableDevice */ + + for (i = 0; i < xf86NumScreens; i++) + xf86Screens[i]->LeaveVT(i, 0); + + for (ih = InputHandlers; ih; ih = ih->next) { + if (ih->is_input) + xf86DisableInputHandler(ih); + else + xf86DisableGeneralHandler(ih); + } + pInfo = xf86InputDevs; while (pInfo) { if (pInfo->dev) DisableDevice(pInfo->dev); pInfo = pInfo->next; } + /* XXX HACK */ xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) - xf86Screens[i]->LeaveVT(i, 0); - for (ih = InputHandlers; ih; ih = ih->next) { - if (ih->is_input) - xf86DisableInputHandler(ih); - else - xf86DisableGeneralHandler(ih); - } xf86AccessLeave(); /* We need this here, otherwise */ xf86AccessLeaveState(); /* console won't be restored */ @@ -563,14 +567,10 @@ xf86VTSwitch() pInfo = xf86InputDevs; while (pInfo) { - if (pInfo->dev) { - xf86ReleaseKeys(pInfo->dev); + if (pInfo->dev) EnableDevice(pInfo->dev); - } pInfo = pInfo->next; } - /* XXX HACK */ - xf86ReleaseKeys(inputInfo.keyboard); for (ih = InputHandlers; ih; ih = ih->next) { if (ih->is_input) xf86EnableInputHandler(ih); @@ -580,6 +580,17 @@ xf86VTSwitch() xf86UnblockSIGIO(prevSIGIO); } else { + + pInfo = xf86InputDevs; + while (pInfo) { + if (pInfo->dev) { + xf86ReleaseKeys(pInfo->dev); + } + pInfo = pInfo->next; + } + /* XXX HACK */ + xf86ReleaseKeys(inputInfo.keyboard); + #ifdef XF86PM if (xf86OSPMClose) xf86OSPMClose(); @@ -630,14 +641,10 @@ xf86VTSwitch() pInfo = xf86InputDevs; while (pInfo) { - if (pInfo->dev) { - xf86ReleaseKeys(pInfo->dev); + if (pInfo->dev) EnableDevice(pInfo->dev); - } pInfo = pInfo->next; } - /* XXX HACK */ - xf86ReleaseKeys(inputInfo.keyboard); for (ih = InputHandlers; ih; ih = ih->next) { if (ih->is_input)