{OldWidth} in the window structure should be done for both windows
and sub-windows, and the easiest way to do this is in the
freeglut_structure.c:fgCreateWindow() code. So, transplant one line.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@383 7f0cb862-5218-0410-a997-914c9d46530a
only windows left are freeglut menu windows, and correctly calls exit()
if we drop out of the main loop without having requested any freeglut
extensions to glutMainLoop() handling.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@382 7f0cb862-5218-0410-a997-914c9d46530a
* Updated shapes.c. I think that it's just reformatting and the addition
of some comments.
* Added shapes.dsp, a Microsoft Visual C++ Developer Studio Project file
for building shapes on WIN32 with MSVC++.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@381 7f0cb862-5218-0410-a997-914c9d46530a
{...Height}. Those are *not* records of the old values, but rather
of the *desired* *new* values, hence it was inappropriate to use them
in ConfigureNotify X11 event handling. Doing so introduced some new
problems.
So, I created OldHeight and OldWidth in the window State structure,
and *those* do what I require.
I also stripped out the obsolete comment about getting extra/bogus
reshape events. (Though I maintain that an application should be
robust against them, freeglut should no longer generate them if the
window has not changed size since last reported.)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@378 7f0cb862-5218-0410-a997-914c9d46530a
* Just need to call GETWINDOW() once. Ooops. Heh.
* Update {window->State} with the new size of the window.
* If the window-size has NOT changed, then do NOT call the Reshape event.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@377 7f0cb862-5218-0410-a997-914c9d46530a
definitely in need of consideration, I believe, but is not immediately
a major bug, so I'd rather not mess with it at the risk of postponing
a release "soon".)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@376 7f0cb862-5218-0410-a997-914c9d46530a
to mark the window as *needing* a reshape (which during general display
callback handling would result in effectively a glutReshapeWindow()).
The code is now system-dependant. It should be abstracted to a function,
but is presently copied in two places. Sorry.
Also, inverted the order of the associated if()/else check (in both
WIN32 and UNIX_X11 branches) since the former "else" part was a one-line
callback invocation.
This fixes two seemingly unrelated bugs that I was seeing in UNIX_X11.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@374 7f0cb862-5218-0410-a997-914c9d46530a
highst-window-ID marker when the highest window is deleted. (This
was a half-way measure for an idea that was decided to be dubious
in the first place.)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@366 7f0cb862-5218-0410-a997-914c9d46530a
Massive rework of the geometric primitive code. Includes a new
primitive (cylinder; solid and wireframe) and corresponding update
to freeglut_ext.h for the prototype.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@364 7f0cb862-5218-0410-a997-914c9d46530a
* We forgot to bump our version number in freeglut_internal.h
It is now at 2.0.2 (actually, I think that 2.1.0 might be
a better choice), which is presumably going to be our next
formal release. 2.0.1 is incorrectly identified as 2.0.0 in
the header.
* A typo in a comment has been corrected ("than"/"that").
* Numerous "manual" checks for callbacks are omitted now, since
INVOKE_WCB() does this for us. These were holdovers from the
pre-INVOKE_WCB() days. There may be some very subtle changes
in freeglut behavior, since freeglut used to test the callbacks
a little earlier in some cases and may have skipped some minor
things (like changes to the current window) in some special cases,
otherwise. It is not believed that any documented behavior is
broken, and it is unlikely---not to say impossible---that any
extant applications will detect the change. It is even possible
that there is no external behavioral change in freeglut.
This also significantly simplifies some sections of code that used
to have conditional execution. "Unconditional code is simpler code"
as one of the comments used to say.
* Lots of XXX commentary is now removed. Some of it was obsoleted
by other changes, some by changes from John.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@363 7f0cb862-5218-0410-a997-914c9d46530a
his freeglut_internal.h file where they were wrapping in EMACS; otherwise,
the files are exactly as he sent them to me).
The change unifies the WIN32 and UNIX_X11 code by defining our own
window-handle-type in freeglut_internal.h. This let John rip out some
#if garbage in several places. The result is clearer code.
Thanks, John!
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@362 7f0cb862-5218-0410-a997-914c9d46530a
(a) I re-inserted the meat of a comment that I still feel is relavent.
(b) I fixed a compile-time error in the UNIX_X11 code where a variable
is declared after executable code in a block without creating
a new sub-block for the declaration.
Changes from John include:
(a) Style revision.
(b) Changes to postpone the handling of window resizes.
Lots of lines were changed, but I think that thos two cover the ground that
he hit. See the diffs for details.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@360 7f0cb862-5218-0410-a997-914c9d46530a
Moved geometry parsing to after fgInitialize() so we can use the screen size
to correctly calculate negative positions in the geometry string.
Copied the code for XParseGeometry from the X11 sources for use in the
Win32 version.
freeglut now passes test1 of the glut test suite.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@355 7f0cb862-5218-0410-a997-914c9d46530a
Replaced referenced to Time.Set with this new variable where appropriate.
fgElapsedTime() now set the start time if Time.Set is false.
Moved glutGet(GLUT_ELAPSED_TIME) handling to before the assert.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@348 7f0cb862-5218-0410-a997-914c9d46530a
And I left alone the "INIT DISPLAY STRING PARSING" section, since
it still appears to be in flux.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@346 7f0cb862-5218-0410-a997-914c9d46530a
Sorry, but that's all that I'm up to at the moment. On the plus,
excepting the font_data file (which I've been skipping), up through
this file, I think that the code style is pretty close to uniform.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@345 7f0cb862-5218-0410-a997-914c9d46530a
efficiently be postponed, quite easily---and which GLUT promises *is* to
be postponed. (It is unlikely that the difference will break any apps, but
postponing should be easy...)
No real change, just a comment in the code.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@341 7f0cb862-5218-0410-a997-914c9d46530a
few in the "one" demo, it seems, and some more crept back into
freeglut_(ext|font).c, presumably due to my own edits when I forgot to
use the "freeglut-c-mode" in EMACS.)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@339 7f0cb862-5218-0410-a997-914c9d46530a
glutInit() in general, since it allows the user to override settings via
{argc, argv} command-line params.)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@338 7f0cb862-5218-0410-a997-914c9d46530a
Added entries summarizing my commits since September or late August, for
the benefit of those lacking both CVS and web access.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@336 7f0cb862-5218-0410-a997-914c9d46530a
WIN32 expected us to pass the message on up the chain (or do something
else with it), rather than just throwing away the event, for a certain
class of events. (See the diffs for more details.)
The code is also slightly reformatted from what was previously in the
repository.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@334 7f0cb862-5218-0410-a997-914c9d46530a
Plus updated *.dsp and *.dsw files to reflect the new freeglut header
file.
NOTE: The prior version of the *.dsw file does not in fact have CRs. I
thought that it did. For consistancy, I am not putting them in in this
version, either. (At least one person said that his MSVC++ system is
happy with the current files. If there are problems, we can easily add
the CRs, but that should be a separate commit...)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@333 7f0cb862-5218-0410-a997-914c9d46530a
This demo shows the use of every callback that you can register with
freeglut, and also generates event reports so that you can see what is
happening to the program as it runs.
Not much to look at, but both utilitarian and a practical example.
Please double-check that I updated everything that needs to be updated.
I reran autogen.sh and ./configure, and it built okay for me. (^&
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@332 7f0cb862-5218-0410-a997-914c9d46530a
Oh well... Should be no functional changes. Should be pretty
close to in-line with the style of changes that I've been making else-
where.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@331 7f0cb862-5218-0410-a997-914c9d46530a
on, leaving Destroy to be cleared later after the last possible point
where it should be invoked.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@329 7f0cb862-5218-0410-a997-914c9d46530a
in fghDisplayMenuBox(). The local variable was already defined and used
for some purposes, so we might as well use it throughout. It does serve
to shorten and clarify the code a bit---though I have mixed feelings about
creating aliases that way.
Still, the variable already existed and was already used in places. (We
could even move it into the freeglut state, or make it a {const static}
value...)
Oh well. Stuff to ponder.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@328 7f0cb862-5218-0410-a997-914c9d46530a
in the freeglut_cursor.c file's "Open issues" comment are now satisfactor-
ily closed.
I also partially implemented some error-checking, using my limited
understanding of how Xlib users are supposed to do this. (No one commented
about the lack of error-checking, pro or con. Perhaps someone will care to
comment now?)
At present, it just will print out a warning, via fgWarning(). In part
because I'm not sure what is best to do, and in part because failure to
set the cursor type is probably not a fatal problem.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@327 7f0cb862-5218-0410-a997-914c9d46530a
freeglut's style. Mostly re-indenting and splitting long lines.
For those that may be concerned: No, I didn't do any more arrangments
of the form (CONST == a) rather than (a == CONST). (^&
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@325 7f0cb862-5218-0410-a997-914c9d46530a
Previously, it picked out two adjacent bits in the result of rand().
Unfortunately, these adjacent bits (at least on NetBSD) have a certain
amount of dependance. After a period (perhaps a thousand or so?), it
starts to repeat the pattern of those two bits. (I think; I haven't
actually tested that directly.) This presumably is locking it into a
an an N-way attractor on the "snowflake", such that if you zoom in a
ways, you will start to see some spots *quickly* are colored, and
others are *never* colored.
What I've done now is to pick up two widely-spaced bits in a single
rand() call. (Perhaps we would do as well to pick up something like
bit #16 from two consecutive rand() calls?) These widely-spaced bits
have a lower statistical dependance on one another (if I can get away
with using that term for an arithmetic operation; though since stats
has more to do with sampling and less to do with true randomness, I
may be safe).
The net effect, at leats on NetBSD, is far better snowflake if you zoom
in on it.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@324 7f0cb862-5218-0410-a997-914c9d46530a
[This] implements the visible/invisible for Windows. It does
NOT call the visibility callback, though.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@323 7f0cb862-5218-0410-a997-914c9d46530a
rather than { ... } for the INVOKE_WCB() macro. This lets it
be used "more like a function", in that:
if( ... )
INVOKE_WCB( ... );
else
...
...is now legal.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@321 7f0cb862-5218-0410-a997-914c9d46530a
in the UNIX_X11 X event processing loop. (In general, it's nice to have
case statements sorted, especially when you have a *huge* switch statement
like this. That makes it easier to find the one that you're looking for,
and to see if a certain case is defined...)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@320 7f0cb862-5218-0410-a997-914c9d46530a
an {SFG_Window *}.) Added prototype to freeglut_internal.h. Added use
of the function to the window initialization. (Don't count on calloc(),
which sets all bits to 0.)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@316 7f0cb862-5218-0410-a997-914c9d46530a
Also moved the "glutMouseWheelFunc" extension down into the "extensions"
part of the table. (Purely internal organization. It will still be
found.)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@313 7f0cb862-5218-0410-a997-914c9d46530a
to try it on others; (^&).
Deallocated some resources that we are creating. VERY slight memory leak,
but plugged now.
These two complete the first two "Open issues" ( (a) and (b) ). The first
one also completes X support for glutSetCursor(). If others can verify,
we can fully demote the outstanding bug over this to WIN32-specific.
I'll delete the dead Open issues and re-letter the others if someone will
cross-check me. Or if no one says anything in a day or two. (^&
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@310 7f0cb862-5218-0410-a997-914c9d46530a
good to apply:
* Don't write a == CONST. Instead, write CONST == a. Or, more generally
(in C like languages): Avoid putting an lvalue on the left-hand side of
an == comparison. (For consistancy, I try to avoid lvalues on the left-
hand side of any comparison---but == is the most notorious.)
(An "lvalue" is a value that can safely go on the left side of an
"=" assignment, of course. (^&)
* Do not write
if( !condition )
return;
other_thing;
return;
(See page 18 of K&P's _The Elements of Programming Style_.)
Instead, it is better to just write:
if( condition )
other_thing;
return;
There are times when sacrificing structured programming (e.g., via
multiple return statements) is okay. But, here, there is no apparent
gain---indeed, there seems only loss---in the non-structured code.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@308 7f0cb862-5218-0410-a997-914c9d46530a
reflects that {button} is already shifted to the GLUT numbering, and
hence should be counted as 3&4, 5&6, etc.
The other change was simply to clarify the computation of {direction}.
The original code did some clever arithmetic. The new code is more
straightforward, even if it requires more lines to express.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@306 7f0cb862-5218-0410-a997-914c9d46530a
array-of-pointers). Mostly deleted commented-out struct-based code.
Also added some XXX comments that I though should be pondered. (My
own pair of eyes, and one brain cell, were not sufficient at this time
to decide what to do for those ponderables. (^&)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@304 7f0cb862-5218-0410-a997-914c9d46530a
callback pointers) to a "CallBacks" array in fgState. (This is to allow
us to write a loop to clear all callbacks from windows when the window is
dead/dying. Using this, we can safely assign NULL to each in a loop.)
Support includes two new macros, FETCH_WCB() and INVOKE_WCB(). See
freeglut_internal.h for more details there.
Some typedefs of function pointer types were altered to make them more
uniform (necessary for the macros).
All references to window-based callbacks in freeglut are updated to
use the new macros.
Old usages will cause compile-time errors.
As a side bonus, the new invocation macro sets the current window and
checks pointers so that these common steps can be uniformly done on
every window-based callback. This makes it easier to do things right.
At the same time, the array notation (and now required associated casts)
make it harder to bypass the macros and abuse the function pointers,
in general.
After this commit, I will go through the code and clean up dangling issues
about formatting. This commit is just a "it now works, let's checkpoint it"
type of affair.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@303 7f0cb862-5218-0410-a997-914c9d46530a
a pointer before deallocating some memory.
He also removed one obsolete comment, and added some more comments.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@300 7f0cb862-5218-0410-a997-914c9d46530a
One bug fix from John: Execution state bug-fix in glutMainLoop(), per his
post yesterday.
One fix from me: Changed "if( ButtonPress )" to "if( pressed )".
{ButtonPress} is a constant.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@299 7f0cb862-5218-0410-a997-914c9d46530a
I [John] converted everything to double precision to avoid compiler
warnings. I also added a feature to check for memory leaks under
Windows and removed a memory leak (surprise!).
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@296 7f0cb862-5218-0410-a997-914c9d46530a
Smoothed over some code style issues while I was here, but left the
init-string parsing alone for now.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@292 7f0cb862-5218-0410-a997-914c9d46530a