When starting in fullscreen mode the keyboard state gets stuck

I experiences this issue with my game. So to diagnose the issue I created a new project.

So a clean new Windows Universal Monogame project (monogame version

And in the constructor, I changed to look like this.

        public Game1()
            graphics = new GraphicsDeviceManager(this);

            Content.RootDirectory = "Content";

In the update method, I write this.

    protected override void Update(GameTime gameTime)
        // TODO: Add your update logic here
        // TODO: Add your update logic here
        var keyboardState = Keyboard.GetState();
        var mouseState = Mouse.GetState();

        if (mouseState.LeftButton == ButtonState.Pressed)
        if (mouseState.LeftButton == ButtonState.Released)

        if (keyboardState.IsKeyDown(Keys.Down))
        if (keyboardState.IsKeyUp(Keys.Down))
        if (keyboardState.IsKeyDown(Keys.F) && _previousKeyboardState.IsKeyUp(Keys.F))

        _previousKeyboardState = keyboardState;

The following is what I noticed.

When pressing down for like 4 seconds and then release it, it keeps getting the keyboard state with down button still being pressed. Until I interrupt it with another signal.
If I keep the mouse button pressed for longer than 4 seconds this does not happen.

When I start the game in windowed mode or I toggle it to windowed mode from an initial fullscreen and then go to full screen back again, this case of getting stuck in a state that down is pressed after being pressed for longer than 4 seconds does not occur.

I don’t think I’m doing anything wrong.

Does anyone else have this problem?
Is it me.
If not is this bug known? Couldn’t find anything recent about this on the web.

Isn’t it easier with a KeyDown only if you want to go down while it is pressed and stop as soon as it is released?
If you wanna test when it is down and up, you usually use this to limit the movement at say… 1 case down


Ik don’t think I correctly understand your suggestion.

But the problem is, if you start the program in fullscreen mode. The release of a button is not detected if the key was pressed for longer than 4 seconds. This Does not occur after the screen has been in windowed mode once.

In my sample code you can see that I try to detect when the down key is released

    if (keyboardState.IsKeyUp(Keys.Down))

But in the visual studio debug output It keeps printing “Down-Down”. Until I pres another button of change the screen to windowed mode. In this case with the letter “F”.

I’m having the same issue.

I created a new ‘MonoGame Windows 10 Universal Project’.

If I start the project in full screen mode, the keyboard input initially works fine, but the key presses become delayed over time. After about a minute the keyboard is unresponsive.
Initially, If I hold the Left arrow for a second and then hold Right for a second, the keyboard state will immediately reflect that I’ve released Left and I’m now pressing Right.

After 30 seconds or so, if I hold Left for a second and then hold Right, the keyboard state will continue to show that I’m pressing Left for some time before finally showing that I’m actually pressing Right now. After releasing Right, the keyboard state continues to show that I’m pressing Right for some seconds before reflecting that I’ve actually released it.

After a minute or so, the keyboard state is so delayed it’s essentially hung.
No other aspect of the game is affected by the delay, only the keyboard state.

Starting Not in Fullscreen (ie. running windowed) the keyboard state is not affected and everything works as expected.

1 Like

I have been working on a full screen game. Never ran it in windowed mode until reading this thread.

I could never get the keyboard reads to function.

I worked round it by reading async keyboard input which worked but the the reads were not very smooth.

Changing into windowed mode for the game menu then back to full screen for playing solved the problem.

This is definitely a bug. Thanks for the info.

Is there an issue for this on Monogames github? I didn’t see one but also haven’t gone very far back

Anyone tried with the latest develop build? (3.7.****)

Just tested with and it appears to have been resolved.



Still happening in sadly, tried the version mike mentioned above and it’s still happening with that version as well.

Only happens if you do the following:

this.graphics = new GraphicsDeviceManager(this);

You’re right, it is still happening for me too, just a lot less severe.
It seems to run fine for a few seconds and then stick for a bit (0.5 seconds?) and then ‘catch-up’ and run fine for a bit again before once again sticking. It never completely hangs like it does on the release builds.

Although, more worrying with the new develop builds is the random ‘hang’ on startup :frowning:

Raised an issue on monogame’s github and it looks like if you do:

this.graphics = new GraphicsDeviceManager(this)
IsFullScreen = true

In the Game’s constructor it fixes it, apparently if you do “graphics.ToggleFullScreen();” in Initialize() it messes things up.

1 Like

I take that back, it’s still happening in fullscreen even with the change I listed above :frowning:

This is interesting. I’ve encountered similar keyboard input issues as well. However, gamepad input is also 100% responsive while the keyboard input issues are occurring. I’m not sure that mine are related to the full screen setting, but I will check in a while. I’ve made at least one post here about the issues I’ve encountered, but no one ever responded :frowning:

A little bit of an update on this… so I removed the graphics.IsFullScreen = true setting from my Game1 constructor and I saw a difference… they keyboard input is now more responsive and it takes longer until it starts becoming unresponsive. It also seems to shift between unresponsiveness and being responsive. So… somewhat improved, but still far from ideal. Has anyone else made any progress on this?

This might go all the way down to Windows.UI.Core. I noticed this problem a few months ago in a Win2D project when using CoreWindow functions. Now I just started a MonoGame skeleton project and noticed stuck keys again. A github search shows that MonoGame uses the Windows.UI.Core functions for reading the keyboard.

A possible workaround is to delay full screen until after you call the base class in the first Update():

Set graphics.IsFullScreen = false; in the constructor.
Keep track of the number of update calls or create a bool for this then in Update():.

        if (false == graphics.IsFullScreen && frames == 0) {

Why does this work? I don’t know.