Closed requested to merge whot/xserver:wip/keycode-leak into master
Where we're running with systemd-logind integration we have to assume that logind may change the KDSKBMODE while we're VT-switched away. If that happens and we return, our keyboard input may leak to the console.
Fix this by always calling K_OFF/K_RAW on VT switch back. We don't update the current settings though, so on shutdown we will restore to settings we had on init. Given the assumption is that if something messes with our vt, it will mess again anyway, it's not worth the bother.
Warning: I couldn't reproduce the original issue, so I'm not sure whether this works. I'll need someone who was affected by this issue to actually test this and report back.
cc @ajax because he knows this code, or at least knew it many moons ago