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 have stripped out carriage returns from this file.
This is the *only* change, but every line is touched. If you want to
see the real differences between older and newer versions, you will have
to get local copies of each and first match their EOL convnetions.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@298 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
I believe, checked if *either* a wheel or button callback was set,
and then decided which to use---and unconditionally called it.
I left the "either" check in, but added additional checks before
actually doing the invocation.
* Lots of reformatting. Massive. The usual suspects, though, and fairly
trivial: Re-indenting to standard size, shuffling some spaces to match
the freeglut "standard" of:
if( ... )
...and:
func( ... )
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@285 7f0cb862-5218-0410-a997-914c9d46530a
Flushing the X protocol stack every little bit both adds clutter to the
code and may impede performance.
It seems that we should be able to get rid of these, though
allowing client code to directly call glutMainLoopEvent() does make it
a little more complicated.
Something to ponder.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@279 7f0cb862-5218-0410-a997-914c9d46530a
* Removed TABs.
* Made indentation consistant.
* Deleted say-nothing-new comments.
* Changed an *error*check* from an assert to an if().
(The error-check was on window creation; we don't want to
lose that if the user compiles with asserts deactivated.
Also, assert()s really tell us more about programming errors,
rather than run-time errors, so it is a little misleading to
use assert() for error-checks, even if you can depend upon
assert()s never being compiled away to null statements.)
* Added some XXX comments for things that bear some rumination.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@275 7f0cb862-5218-0410-a997-914c9d46530a
Code facelift included:
* Consistant indentation.
* Removal of all TABs (there were a bunch).
* Fit to 80 columns.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@273 7f0cb862-5218-0410-a997-914c9d46530a
little changes to the code appearance.
* Fit the comments at the start of the file to fit 80 columns.
* Noted an unusual feature of the ATTRIB() macro.
* Added ATTRIB_VAL() macro which is really just two ATTRIB()s.
This lets us put things like {ATTRIB (GLX_RED_SIZE); ATTRIB (1);}
on one statement: {ATTRIB_VAL (GLX_RED_SIZE, 1);}.
I did this to preserve some of the layout of information while also
avoiding the nasty semi-visible ";" in the middle of a line of code.
And by putting the {braces} in the macro definition, I was able to
visually clean code of the form:
if (condition)
{
ATTRIB( X ); ATTRIB( 1 );
}
...rewriting as:
if (condition)
ATTRIB_VAL( X, 1 );
* Eliminated a bunch of say-nothing-new comments in fgChooseVisual().
* Combined some semi-useful comments into a block comment summarizing
a loop.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@272 7f0cb862-5218-0410-a997-914c9d46530a