Jump to content
  • Advertisement
Sign in to follow this  
Kest

Full screen failure

This topic is 3623 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In some situations, while using the hardware mouse cursor, without exclusive input, it becomes possible to interact with window borders and background applications while running a DirectX application in full screen mode. Apparently, the mouse capturing area of a window doesn't fill the entire screen while running in full screen. It's not that difficult to get this to happen in cases where it can. Start your application with a bordered resizable window, switch to full screen, then put the cursor up into the top right corner of the screen and click down or drag. Either your application will unfocus, or you'll see painting glitches where the window border is trying to draw itself over your display. I've observed this several times in the past, with several games, on a few different PCs, through several versions of DirectX. Does anyone know how to fix this issue without resorting to exclusive mouse input? Is it necessary to generate a new borderless window and have it cover the whole screen in the background? And what if you're switching to a higher-res full screen display from a lower-res desktop display? Thanks for any information.

Share this post


Link to post
Share on other sites
Advertisement
The common way is to modify the windows' styles to make it caption- and borderless.

You don't have to destroy and recreate the HWND, use SetWindowLong with GWL_style (and their -ex counterparts) followed by SetWindowPos with SWP_FRAMECHANGED.

Share this post


Link to post
Share on other sites
Your use of the phrase "exclusive mouse input" makes me think that you're using DirectInput - which is an extremely bad idea.

As for the actual question, Endurion has it. You need to change window style when Reset()ing the device to go fullscreen / windowed. E.g, from my upcoming tutorial #2:


// Change window style to remove border in fullscreen mode
DWORD dwStyle;
if(m_thePresentParams.Windowed)
dwStyle = (WS_OVERLAPPEDWINDOW | WS_VISIBLE) & ~WS_THICKFRAME;
else
dwStyle = WS_POPUP;
SetWindowLongPtr(m_hWnd, GWL_STYLE, dwStyle);

// Make sure the changes are flushed
SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);


Share this post


Link to post
Share on other sites
Thanks for your help. I'll definitely try that out and report the results.

Quote:
Original post by Evil Steve
Your use of the phrase "exclusive mouse input" makes me think that you're using DirectInput - which is an extremely bad idea.

I appreciate the warning, but I've taken care of most of the problems you mentioned there. My gameplay controls allow generic mapping to any input device, and doesn't specifically acknowledge the keyboard or mouse. There's very little of any other input.

With Vista and its future API's waiting in front of me (I'm using XP 32-bit), I already feel like I'm going to have to make huge API changes in the future, so there's little reason to swap around things now. My game engine is probably 97% game, and 3% api related code, but that 3% looks huge right now. I wish technology would wait the hell up for me.

Share this post


Link to post
Share on other sites
Do you recommend doing this before or after initializing a full screen resolution? And what if the screen size shrinks or grows? Should we also resize the window? If so, then we want to do this after changing the resolution, right?

EDIT: Or does Windows/DirectX automatically size the window to the screen resolution? If so, it might be better to remove the borders before messing with the device..?

Share this post


Link to post
Share on other sites
After playing around with this, I'm noticing some very strange behavior.

When I switch to something like 800x600 from my 1024x768 desktop resolution, and I set the window size to match the new resolution, the actual window area only fills the section of the screen it would have filled if my screen was still 1024x768. So even though my resolution and window are both supposed to be 800x600, there seems to be a [1024x768 - 800x600] ratio of uncaptured mouse area on the bottom and right.

So apparently, my window size is relative to my desktop resolution, even when my screen resolution changes. Is that right?

Share this post


Link to post
Share on other sites
Quote:
Original post by Kest
Do you recommend doing this before or after initializing a full screen resolution? And what if the screen size shrinks or grows? Should we also resize the window? If so, then we want to do this after changing the resolution, right?

EDIT: Or does Windows/DirectX automatically size the window to the screen resolution? If so, it might be better to remove the borders before messing with the device..?
I believe (I haven't tested this) that when you go to fullscreen mode, D3D will resize the window for you, but not when you return to windowed mode.

I always resize the window before calling Reset(), I don't think it should matter when you resize.


Quote:
Original post by Kest
After playing around with this, I'm noticing some very strange behavior.

When I switch to something like 800x600 from my 1024x768 desktop resolution, and I set the window size to match the new resolution, the actual window area only fills the section of the screen it would have filled if my screen was still 1024x768. So even though my resolution and window are both supposed to be 800x600, there seems to be a [1024x768 - 800x600] ratio of uncaptured mouse area on the bottom and right.

So apparently, my window size is relative to my desktop resolution, even when my screen resolution changes. Is that right?
What OS are you using? And what's in the area of screen that's not in your window? Is it the desktop, gibberish, or something else?

It sounds to me like Reset() is failing, is there any output from the Debug Runtimes?

Share this post


Link to post
Share on other sites
First, I forgot to mention that I'm using the windows mouse. I'm using Direct Input to poll the buttons, the wheel, and even the axes for game data, but I'm using GetCursorPos() to locate the cursor for pointing.

Quote:
Original post by Evil Steve
Quote:
Original post by Kest
After playing around with this, I'm noticing some very strange behavior.

When I switch to something like 800x600 from my 1024x768 desktop resolution, and I set the window size to match the new resolution, the actual window area only fills the section of the screen it would have filled if my screen was still 1024x768. So even though my resolution and window are both supposed to be 800x600, there seems to be a [1024x768 - 800x600] ratio of uncaptured mouse area on the bottom and right.

So apparently, my window size is relative to my desktop resolution, even when my screen resolution changes. Is that right?
What OS are you using? And what's in the area of screen that's not in your window? Is it the desktop, gibberish, or something else?

It sounds to me like Reset() is failing, is there any output from the Debug Runtimes?

Windows XP. I explained it poorly, and I'm not sure I can do better - it's a strange problem. The display is working fine. There's nothing visibly wrong.

I'm in an 800x600 full screen mode that looks correct. However, I can hover my cursor around to see what the mouse is pointing at, and it's pointing at things other than my game window on the bottom and right, even though I can't see what it's pointing at, because my display fills the screen perfectly. However, if I click there, it will unfocus me.

Even though I'm in 800x600, and the display looks exactly right for 800x600, everything the cursor is doing seems to indicate that the screen area is still 1024x768, and that my window is 800x600 inside of it, and not filling it up.

What is visibly on the screen and what the cursor is showing as being hovered doesn't match. In other words, I have to size my window to 1024x768 to fill up the entire mouse-clicking area of my 800x600 full screen application.

I'm guessing this is because my game's resolution change doesn't change the desktop size, and window's mouse hovering is relative to the desktop. None of this really concerns me, as long as it's supposed to happen that way. In fact, it would be easier to not have to worry about the window size when the full screen resolution changes.

I appreciate the time you're spending on my insane problems.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kest
I'm guessing this is because my game's resolution change doesn't change the desktop size, and window's mouse hovering is relative to the desktop. None of this really concerns me, as long as it's supposed to happen that way. In fact, it would be easier to not have to worry about the window size when the full screen resolution changes.
What is the size of the backbuffer in your present params when you call Reset()? Is it actually 800x600? When you call Reset() with Windowed=false, D3D changes the current display mode - which means the desktop and everything else should change, just as if you'd changed resolution from the display settings control panel.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by Kest
I'm guessing this is because my game's resolution change doesn't change the desktop size, and window's mouse hovering is relative to the desktop. None of this really concerns me, as long as it's supposed to happen that way. In fact, it would be easier to not have to worry about the window size when the full screen resolution changes.
What is the size of the backbuffer in your present params when you call Reset()? Is it actually 800x600? When you call Reset() with Windowed=false, D3D changes the current display mode - which means the desktop and everything else should change, just as if you'd changed resolution from the display settings control panel.

Yes, it does change to 800x600. And if I alt+tab, the screen resolution needs to switch back to 1024x768. I can hear my monitor click when the resolution changes, both times. However, the "mouse hovering" still behaves the way I described. My 800x600 mouse-capturing window does not fill the 800x600 game display area. I have to size the window to 1024x768 (the size of my desktop) to capture the whole screen, regardless of the game's display.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!