Main Menu

The mouse-killing Keyboard Mode persists through losing window focus

Started by Maurog, May 20, 2015, 01:46:42 PM

Previous topic - Next topic

Maurog

Reproduce it by switching to Keyboard Only mode by pressing F2 and then alt-tabbing out of the game.

Your mouse will remain locked even though game window lost focus and you're in the other windows of your operating system.

Expected behavior: Mouse is only locked inside the game, but is unlocked if you switch windows (locked again if you alt-tab back to the game).
Slay the living! Raise the dead! Paint the sky in crimson red!

Kyzrati

What's your OS?

I use keyboard mode all the time and do a lot of alt-tabbing, but I've never had it lock the mouse on me. (I'm on Win7.)

We can resolve this by, as you say, manually making sure the mouse is unlocked on focus switch. Though focus detection in Windows is actually not all that straightforward, so we'll see how well it works... (this is why I didn't implement caps lock detection for text entry, as well--it doesn't play nice with alt-tabbing+SDL, the engine Cogmind runs on).
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

Maurog

This happens in Windows 7, but I forgot an important detail.

You have to be in full screen mode. Alt-tabbing from full screen mode with the mouse locked will not unlock it. It does release the mouse fine in windowed mode.
Slay the living! Raise the dead! Paint the sky in crimson red!

Kyzrati

Ah, no wonder, I almost always use windowed since that's more convenient for alt-tabbing, and takes up less room ;). Yeah, that's an important detail. I'll look into it.
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon