Archived

This topic is now archived and is closed to further replies.

Persistant problem with fullscreen windows

This topic is 5221 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

When opening a full-screen window with the win32 API (not using directX) i keep having a subtle, very annoying problem. This is only tested on Windows 98, and would seem to be a problem with windows itself so it might work fine on other versions. It is not particular to my code, since the NeHe stuff and pretty much any other open-source opengl demo's have the same problem (note that this problem is not opengl related, but the only time i go fullscreen is when i want to draw with opengl). Anyway, when the app is started it does not properly gain mouse focus, the pointer remains visible even when the window hides it, and a click of the mouse switches focus to the applications behind my window. This however, only occurs when the application is started *by clicking on it with the mouse*, when it is started with the keyboard it works fine (no cursor, mouse input properly goes to the fullscreen window). Also, opening a dialog (like in NeHe's code- 'do you want to use fullscreen mode' for example) before going fullscreen fixes the problem too. What do i want from people reading this? Firstly a reassurance that i am not insane. You can get a stripped down (but compiling) source-code and executable demonstrating the problem from these links: code executable I'd really like to know whether this happens on other windows versions, if there is a proper solution for it, and if not, if there is an ugly hack to prevent it from occuring. Thanks, Marijn edit: screwy links, fixed sentence [edited by - marijnh on August 13, 2003 3:46:54 AM]

Share this post


Link to post
Share on other sites
Thanks!
By the way, the executable fires up opengl and draws a spinning triangle, but that is not the relevant part. Testing would go something like this:
Double-click on the executable. Does it go full-screen? If yes, do you still see your mouse? If not, it works on your computer (esc to quit), if yes, click on it, did the program lose keyboard focus (try esc)? If yes, it really does not work, alt-tab back to the fullscreen window and quit with esc.

Marijn

Share this post


Link to post
Share on other sites
quote:
Original post by marijnh
Thanks!
By the way, the executable fires up opengl and draws a spinning triangle, but that is not the relevant part. Testing would go something like this:
Double-click on the executable. Does it go full-screen? If yes, do you still see your mouse? If not, it works on your computer (esc to quit), if yes, click on it, did the program lose keyboard focus (try esc)? If yes, it really does not work, alt-tab back to the fullscreen window and quit with esc.

Marijn


Just tested it on my home machine--Win98, with an nVidia GeForce2. Doubleclicking opens the app up full screen, though nothing got rendered (?!). Didn''t see the mouse. Pressing escape quit out. Re-opened app by double-clicking, and saw the mouse. At this point, it behaved exactly as you said (clicking caused it to lose focus, etc.), and continues to exhibit this behavior.

Log file:
Init.
Got window.
Exit.

Do you do anything special the first time the app is run on a machine, like tweak the registry? I''m just trying to figure why it would''ve worked the first time, but not since...

-Odd the Hermit

Share this post


Link to post
Share on other sites
Nope, nothing different between the first and other runs. I have had it work properly now and then on my machine too. Strange that it does not render anything, but the drawing code is just a placeholder and relies mostly on the default settings of opengl (doesnt set projection matrix or anything) so i guess subtle differences in opengl implementation might screw that up.
... oh the mysteries of the windows API.

Marijn

Share this post


Link to post
Share on other sites
Well i found the solution. This thread did not unleash much enthousiasm but if anyone is interested here it is:

I (and NeHe too) set the resolution using a DEVMODE structure that we fill in ourselves. These are pretty big structs and i have no idea what half the fields mean. If you let windows fill them in for you using the EnumDisplaySettings function, and pick one that fits your need, the mouse-problem i described does not occur.
What does the DEVMODE for the screen have to do with the mouse? I dont know. I have no idea why this works but it works. Us mere mortals will never understand the mysterious ways of the windows API. Anyway, one less annoying bug in my program!

Marijn

Share this post


Link to post
Share on other sites