--- xorg-server-1.4.0.90/hw/xfree86/common/xf86Events.c.orig 2008-04-21 19:26:30.000000000 +0000 +++ xorg-server-1.4.0.90/hw/xfree86/common/xf86Events.c 2008-04-21 19:47:54.000000000 +0000 @@ -884,22 +884,26 @@ * 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 */ @@ -929,14 +933,10 @@ 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); @@ -946,6 +946,17 @@ 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(); @@ -996,14 +1007,10 @@ 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)