Game's Foreground focus in FullScreen mode

Started by
4 comments, last by mooni 8 years, 7 months ago

Does anyone know what actual PC games do to hold on to their Foreground window focus without losing their focus easily for instance to an application popping up.

Advertisement
They don't. They just use the standard DirectX settings for a full screen exclusive application.

It's up to other programs on the user's computer to not shove popups in the user's face - or to suppress them when a fullscreen exclusive app is running.

What games usually do is automatically pause when you accidentally select a different program or click a dialog box.

My CVMy money management app: ELFSHMy game about shooting triangles: Lazer of Death

Does anyone know what actual PC games do to hold on to their Foreground window focus without losing their focus easily for instance to an application popping up.

This really depends. Generally, you want to _lock_ (sometimes called _capture_) the keyboard focus as well as the mouse.

This will not stop the application from having focus violently stolen from it, however, so be ready to monitor the ACTIVE state and pause when the app becomes inactive.

Also be very sure to release things like the keyboard and mouse when this happens.

They don't. They just use the standard DirectX settings for a full screen exclusive application.

It's up to other programs on the user's computer to not shove popups in the user's face - or to suppress them when a fullscreen exclusive app is running.

Many games these days use far more capable patterns than this. Modern OSes are not Windows XP.

For instance, many games support non-exclusive fullscreen access, either some of the time or all of the time. These modes allow the OS and other apps to display overlays (e.g. volume controls and the like) and more importantly allow the user to move their mouse off the window (if the mouse isn't locked) to other screens.

This is essential to my semi-casual gaming these days, for instance, because I'll often have the game up on one monitor and Netflix up on the other. It's REALLY handy to be able to hit Escape, go to a menu with an unlocked mouse, move over to Netflix, hit that obnoxious "Yes I'm still watching" button, click back in the game, and unpause.

Other users might have music players, "cheat" guides or tutorials, or so on up in similar fashions.

Games with exclusive fullscreen often require a lot of alt-tabbing and resolution switches and a general long, slow, and painful process just to let the user move their mouse over to another screen/app.

A lot of bigger games will give the user the option of Windows, Exclusive Fullscreen, and "Borderless Fullscreen" (sometimes called "Windowed Fullscreen"). This is because the exclusive mode theoretically gives you better performance as your game isn't passing through the window compositor (though the compositor is pretty smart and good at its job). Smaller indie/hobby games should just always stick to non-exclusive mode if you don't want to bother with an option; they don't even come close to needing the full performance of exclusive mode, and should opt for user-friendliness over speed they don't need.

If you're using SDL, btw, you can easily achieve this behavior using SDL_WINDOW_FULLSCREEN_DESKTOP instead of SDL_WINDOW_FULLSCREEN. https://wiki.libsdl.org/SDL_SetWindowFullscreen

Sean Middleditch – Game Systems Engineer – Join my team!

They don't. They just use the standard DirectX settings for a full screen exclusive application.

It's up to other programs on the user's computer to not shove popups in the user's face - or to suppress them when a fullscreen exclusive app is running.


Many games these days use far more capable patterns than this. Modern OSes are not Windows XP.

For instance, many games support non-exclusive fullscreen access, either some of the time or all of the time. These modes allow the OS and other apps to display overlays (e.g. volume controls and the like) and more importantly allow the user to move their mouse off the window (if the mouse isn't locked) to other screens.

This is essential to my semi-casual gaming these days, for instance, because I'll often have the game up on one monitor and Netflix up on the other. It's REALLY handy to be able to hit Escape, go to a menu with an unlocked mouse, move over to Netflix, hit that obnoxious "Yes I'm still watching" button, click back in the game, and unpause.

Other users might have music players, "cheat" guides or tutorials, or so on up in similar fashions.

Games with exclusive fullscreen often require a lot of alt-tabbing and resolution switches and a general long, slow, and painful process just to let the user move their mouse over to another screen/app.

A lot of bigger games will give the user the option of Windows, Exclusive Fullscreen, and "Borderless Fullscreen" (sometimes called "Windowed Fullscreen"). This is because the exclusive mode theoretically gives you better performance as your game isn't passing through the window compositor (though the compositor is pretty smart and good at its job). Smaller indie/hobby games should just always stick to non-exclusive mode if you don't want to bother with an option; they don't even come close to needing the full performance of exclusive mode, and should opt for user-friendliness over speed they don't need.

If you're using SDL, btw, you can easily achieve this behavior using SDL_WINDOW_FULLSCREEN_DESKTOP instead of SDL_WINDOW_FULLSCREEN. https://wiki.libsdl.org/SDL_SetWindowFullscreen


Yes, I'm fully aware of "windowed fullscreen". I generally avoid using it because I have a SLI rig, and SLI does not work in windowed mode.

That being said, yes, you should always give the user a choice between windowed, fullscreen windowed, and fullscreen because it's basically free to implement on the part of the developer and makes the user experience better.

Thanks all for the replies.

As of now, I am planning to minimize and release keyboard and mouse on losing focus. I am planning to take a look at SDL https://wiki.libsdl.org/SDL_SetWindowFullscreen in future.

This topic is closed to new replies.

Advertisement