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
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
point of view (at least, insofar as: The original file's code was INCON-
SISTANT. I did not remove the "!= NULL" stuff, did not address the
shortest-branch-first issue for if-else statements, and left some rather
ugly "if (x) {... return y} /* else do this */ return NULL;" garbage.
This should, I think, be re-written as "if (x) return y; else return NULL;"
or even better, "ret = NULL; if (x) ret = y; return ret;"
In short, the code still has some issues, but I think that it's a bit
better.
(Oh, I also got rid of oustanding TABs.)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@271 7f0cb862-5218-0410-a997-914c9d46530a
Fit most of the code to no more than 80 columns.
Raised some issues about completeness/correctness of trying to
decrement the max-window-ID (apparently in order to partially
recycle some window IDs to slightly slow the rate of growth of
window IDs). (I didn't change what the code does, though.)
The functionality of the code should be unchanged.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@270 7f0cb862-5218-0410-a997-914c9d46530a
WIN32 code. Take abs(direction) as the number of ticks, and count it
down.
<stdlib.h> *should* be included by freeglut_internal.h, I think, so it
should be okay; otherwise add a suitable #include.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@268 7f0cb862-5218-0410-a997-914c9d46530a
Now I've lost track of what I said I'd done. Something like:
* Fixed some issues with multiple wheels.
* Noted in comments some issues about other-than-3-real-buttons.
* Fixed formatting to fit 80 columns.
* Removed some BCPL/C++ style comments (//) that are not legal, and
which, if memory servers, are not even strictly legal when disabled
by preprocessor directives. E.g.,
#if 0
not-syntactically-valid-C
#endif
...is not legal. Though most cpp's will discard the bracketed material
completely before the main C compiler pass has a chance to analyze the
syntax. (MSVC++ and GCC both don't seem to mind the BCPL style comments
in plain C, but let's keep the sources clean, eh?)
* Fixed a problem that would have caused freeglut to report doubled
wheel events under XFree86.
Not tested other than compiling. Personally, I think that the interface
is inherently broken at this point unless you are willing to get user-
configuration. (Which would then solve the complaint that Steve had
about computing the tick-size on behalf of applications.) I.e., there
is NO WAY to know if we have the right buttons to start wheels at, or
if there are any buttons after the first wheel(s), etc. We just have to
guess---and if we are wrong, we can get varying degrees of brokeness.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@267 7f0cb862-5218-0410-a997-914c9d46530a
So I've copied the way the game mode does it. It's not ideal but it works.
The glutGet() for the window border sizes will also have to be fixed at
some point.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@266 7f0cb862-5218-0410-a997-914c9d46530a
It now correctly places the window in X11.
It now uses system dependant code for more efficient use of
windowing system calls.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@265 7f0cb862-5218-0410-a997-914c9d46530a
I missed a few lines that went past 80 columns. (^&
Also made formatting more consistant.
Added a couple of XXX comments re. FreeBSD vs. general BSD #ifdef's.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@264 7f0cb862-5218-0410-a997-914c9d46530a
* Fit lines to 80 columns. (It does get tiresome seeing long lines
forced to break by the right-hand border of windows...(^&)
* Eliminated say-nothing-new comments.
* Made formatting more consistant in spots.
* Eliminated some hard TAB characters.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@263 7f0cb862-5218-0410-a997-914c9d46530a
numbers for OS releases corresponding to system headers.
I modified it to also work with NetBSD; I cannot confirm if it is safe with
any other systems, so it remains protected by a #if.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@262 7f0cb862-5218-0410-a997-914c9d46530a
Added some XXX's where comments seemed to require future attention.
Added some new comments with XXX's where future attention seems profitable.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@261 7f0cb862-5218-0410-a997-914c9d46530a