Its been quite a while since I posted the patches before. However, I
would like to bring them to your attention again as I have gotten
little feedback. Eero and I have been using versions of FreeGLUT that
include these patches daily for almost half a year now, and found no
problems with them. I hope they can be considered for inclusion, let
me know if there is any thing I can do to help or otherwise make your
life as maintainer easier.
Once this is put into svn I'll update the docs a bit where needed.
A description of the patches follows below.
Attached is a patch that fixes a few typos in the One and subwin demos
and adds a new demo "Resizer". I used this demo to test the
fullscreen/window decorations patch. I basically shows a window and
lets you toggle it between fullscreen or not, two positions on the
screen and two sizes, while continously writing output to the console
about the window's position and size (so one can see if they are
I have enclosed some of the files directly in the zip as the diff
didn't look right again (VS2010 files don't diff well apparently).
Both files are to go into VisualStudio/2010/Resizer/ (which needs to
be created first).
The patch is now ready. But first let me thank Eero for his great help
in testing and pointing out problems (and solutions!) to a bunch of
issues. The patch is rather large as it affects quite a bunch of
functions. Splitting it up is not possible however as all the code is
The attached patch does the following:
- I've had some trouble in the past with fullscreen windows not
covering the taskbar, fixed by setting window style to WS_POPUP when
going into fullscreen
- Fullscreen windows now have no decorations and thus do not "leak"
into other displays on multidisplay setups
- when going into fullscreen, the decorations and position/size of the
window is saved in the window's state field first, so it can be
restored later when leaving fullscreen.
- glutFullScreenToggle now works and a new function
glutLeaveFullScreen now exists, it restores the window back to its
position/size and decorations before it went fullscreen
- this glutLeaveFullScreen function is added to the freeGLUT
extentions header (though I'm not stuck on this and would be fine as
well of course if it would remain an internal function (with a
different name in that case)).
- glutGet(GLUT_FULL_SCREEN) now works (always returned 0 on windows
before, or FreeGLUT would have gotten stuck in infinite loops)
- when entering fullscreen, the window will now be resized and
repositioned to fully cover the monitor which it covers the most, per
patch of Jason Wilkins sent to the list earlier.
- glutFullScreen() now does nothing when invoked on a child window, an
fgWarning is outputted. I have also made it return immediately if it
is invoked on a gamemode window as those are always fullscreen anyway.
- I have added a few functions that return the window rect or the
client area rect based on the actual window style of the current
window. The window is queried for the presence of caption and borders
so we no longer operate on assumptions and ifs
- child windows are now positioned correctly (as requested) regardless
of the parent's decorations
- cleaned up window creation and window reshaping using the new functions
- restructured the window creation code so it is easier to follow.
- windows can now be resized and repositioned exactly as you
requested, regardless of the window decorations
- the glutGet's (glutGet(GLUT_WINDOW_X), glutGet(GLUT_WINDOW_Y),
should now return correct values based on the style of the current
window. The default width and height of a default window are returned
if invoked without an existing window, which is also consistent with
previous FreeGLUT behavior.
Lastly, Eero and I have decided to revert some of the recent changes
regarding the processing of the -display command line parameter that
he sent to the list earlier. It now solely sets on which display the
screen will open when using glutEnterGameMode and is otherwise
ignored. For any other kind of window creation, we think it is best if
we do not make all coordinates relative to the origin of the screen
specified with the -display parameter to avoid unexpected behavior.
Programmers working with multiple screens can easily query Windows
directly outside of freeglut for the number of screens present and
their origins and use that information to set window positions as
wanted using the various functions FreeGLUT has for it. Note that this
does not affect Linux handling of the -display parameter.
All changes have been tested on Windows XP and Windows 7 (and on
windows XP with binaries compiled on Windows 7).
The changes do not affect the Linux code except for the addition of
glutLeaveFullScreen. I have not been able to test whether it works
correctly on Linux, but as it is only a few lines that build on the
already working glutFullScreenToggle, I expect no problems. But would
be great if someone could test it!