Commit Graph

405 Commits

Author SHA1 Message Date
cjp
e7a19a5546 Timer optimizations.
Made the list of pendinig timers ordered.
Added a free list of used timer structures.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@372 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-28 19:19:59 +00:00
cjp
e6de6c2e6f Timer optimizations.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@371 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-28 19:08:25 +00:00
cjp
5b391a7097 Fixed windows compilation problem with last update.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@370 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-28 12:04:24 +00:00
cjp
b309d468c4 Window close fix.
The default behaiour should now be the same as with glut.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@369 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-27 19:49:53 +00:00
rkrolib
9b36eb081b Added change from Nigel to have resize events cause redraw events in WIN32.
Also slightly reshuffled comments to deal with line-wrap issues.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@368 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-26 01:21:29 +00:00
rkrolib
0dd93cb5e1 John reported, and fixed, a problem that recent changes caused for
the Lorenz demo (seems to be WIN32 specific).


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@367 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-25 17:25:43 +00:00
rkrolib
1e09843db1 Update from John: Removed the freeglut hack of decrementing the
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
2003-11-25 14:17:05 +00:00
rkrolib
efb92f27a8 Added a new demo (from Nigel) showing some of the basic GLUT geometry
shapes.  "shapes" is the name of the demo.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@365 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-25 14:10:35 +00:00
rkrolib
e1416ae642 Commit of work from Nigel:
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
2003-11-25 13:53:19 +00:00
rkrolib
96ee3c4798 More work from John (sorry for procrastinating):
* 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
2003-11-25 04:57:10 +00:00
rkrolib
db9108dfeb Change from John (I removed a couple of spaces from a couple of lines in
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
2003-11-25 04:21:48 +00:00
rkrolib
354569a7c4 Numerous style normalizations from John:
* Convert "return( value );" to "return value;"
 * Normalize spacing around semicolons.
 * Remove extraneous parens.
 * Split multi-statement lines into multiple lines.  (Mostly things
   of the form: "if( condition ) return;".)


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@361 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-21 21:15:58 +00:00
rkrolib
7e7ff3191d All changes are from John, except for:
(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
2003-11-21 00:49:51 +00:00
cjp
1c7454b49d Lots of stuff that John F. Fay pointed out.
Plus some changes to remove gcc warnings.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@359 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-18 22:09:15 +00:00
cjp
6d21d76b1a Fix spelling mistake in a variable name.
Added a comment for John Fay.
Added the copyright notice for XParseGeometry source.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@358 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-17 21:11:33 +00:00
cjp
a437c328e9 Made Modifers variable global as per glut classic.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@357 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-16 14:10:35 +00:00
cjp
b47a8b1fcc Removed old unused glutInitDisplayString code.
Reformated new glutInitDisplayString and XParseGeometry code.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@356 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-16 13:49:49 +00:00
cjp
d906368add Use XParseGeometry for better geometry parsing.
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
2003-11-16 01:41:18 +00:00
cjp
d161195cb4 Removed the state variable BuildingAMenu.
Instead pass a new parameter isMenu to fgCreateWindow().
Elsewhere use window->IsMenu.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@354 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-15 19:25:22 +00:00
cjp
22b6c59f34 freeglut_assert_ready is going to have to go at some point.
But for now I've moved setting fgState.Initalized to GL_FALSE.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@353 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-15 19:11:09 +00:00
cjp
3f70f7bdf2 Replace TRUE with GL_TRUE and FALSE with GL_FALSE where the type is
GLboolean.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@352 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-15 19:06:28 +00:00
rkrolib
06174f9086 Normalized the spacing around symbols, for the most part. Ho-hum.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@351 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-15 17:48:43 +00:00
cjp
e8cfcd2247 Added a call to fgDeinitialize() before the call to exit() in fgError().
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@350 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-15 16:52:46 +00:00
rkrolib
1fe1473fbb Style normalizations to the joystick code.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@349 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-15 16:39:46 +00:00
cjp
2b78c976ea Added a new state variable "Initalized".
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
2003-11-15 16:24:33 +00:00
rkrolib
6895440554 Normalized the internal header's style a bit.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@347 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-14 17:46:01 +00:00
rkrolib
26b98ad308 Plowed one more file this morning. Still just trivial formatting issues.
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
2003-11-14 15:10:50 +00:00
rkrolib
d83464df48 Yet more trivial style normalizations.
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
2003-11-14 14:59:49 +00:00
rkrolib
53dfc57542 Minor style corrections.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@344 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-14 14:52:15 +00:00
rkrolib
2b9010b0b1 Minor spacing quibble.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@343 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-14 14:39:20 +00:00
rkrolib
74e6d246ca Added a brief explanatory note to the X code for GLUT_CURSOR_NONE.
Corrected the indentation of a block of code.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@342 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-14 14:36:27 +00:00
rkrolib
1d2ade2f1c Noted one of a few cases where we do something immediately that could more
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
2003-11-14 11:04:11 +00:00
rkrolib
4c4112fe92 Updated ChangeLog for the day.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@340 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-11 11:55:19 +00:00
rkrolib
b92f1915fe Removal of all remaining TABs in the freeglut *.[ch] files. (I missed a
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
2003-11-11 11:52:14 +00:00
rkrolib
4ccdcf6f4e Moved glutInit*() functions ahead of glutInit(). (This is proper use of
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
2003-11-11 11:20:01 +00:00
rkrolib
48f65ac54d Style normalizations: Removed CRs and hard TABs mostly.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@337 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-11 11:18:16 +00:00
rkrolib
864ea93df3 Corrected the numbering of the ChangeLog (there were two (110)s).
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
2003-11-11 09:05:14 +00:00
rkrolib
7621f53262 John's fix for the minimize/close/maximize controls no longer working.
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
2003-11-10 18:19:53 +00:00
rkrolib
b1c4e6beb8 A *.dsp file for CallbackMaker in the demos.
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
2003-11-10 17:04:05 +00:00
rkrolib
6829d65fb3 New demo from John: CallbackMaker.
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
2003-11-10 16:01:05 +00:00
rkrolib
9623350767 Hm. I thought that I already hit this file for style normalization.
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
2003-11-10 10:00:21 +00:00
rkrolib
1023b7eb84 Ooops. Forgot that we already had a call to fgClearCallBacks() in the
code and added a second one.  I just deleted the new one.  Sorry.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@330 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-10 09:45:47 +00:00
rkrolib
f02f918842 Added Nigel's suggested code to clear all but the destroy callback early
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
2003-11-10 09:42:14 +00:00
rkrolib
6230b2de2a Modified the menus to refer to {border} rather than {FREEGLUT_MENU_BORDER},
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
2003-11-10 01:21:06 +00:00
rkrolib
fb26d91989 Well, a couple of days have gone by, so I assume that items (a) and (b)
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
2003-11-10 00:32:15 +00:00
cjp
85e34f0062 Applied Braden McDaniel's non-srcdir build patch.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@326 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-08 17:40:42 +00:00
rkrolib
6bf9d27035 A first pass over freeglut_menu.c to bring it in line with the rest of
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
2003-11-08 11:28:34 +00:00
rkrolib
9c070e4f9b Altered the way that the {random} value (from 0..3) is chosen.
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
2003-11-08 01:56:45 +00:00
rkrolib
acd65a4212 From John:
[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
2003-11-07 17:30:32 +00:00
rkrolib
d7896b09ab Stripped out the now truly extraneous {braces} in such forms as:
if( ... )
{
    INVOKE_WCB( ... );
}

Check for compiling on WIN32.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@322 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 15:50:56 +00:00
rkrolib
9108ab693f Adopted Eero Pajarre's suggestion of using a do { ... } while
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
2003-11-07 15:30:59 +00:00
rkrolib
711ab5fdac Pure code janitoring: Shuffled the order of some of the case statements
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
2003-11-07 10:32:38 +00:00
rkrolib
6f0ae8796a Combined EnterNotify and LeaveNotify event processing in the UNIX_X11
event loop.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@319 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 10:26:37 +00:00
rkrolib
91a94e44bc Added ReparentNotify case to UNIX_X11 event loop, to catch the extraneous
ReparentNotify event types (type 21).


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@318 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 10:22:31 +00:00
rkrolib
2ddf15c536 Oh well, I might as well add the call to clear callbacks on window
destruction.  Also renamed the function to do this: fgClearCallBacks().
Ho-hum.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@317 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 10:18:10 +00:00
rkrolib
89cbd97e02 Added fgInitCallBacks() to freeglut_structure.c. (The function takes
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
2003-11-07 09:55:43 +00:00
rkrolib
ca361547ec Style normalization; removal of say-nothing-useful comments.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@315 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 08:46:53 +00:00
rkrolib
5621aa7fcb Normalized the style of freeglut_font.c No substantial alterations.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@314 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 08:25:30 +00:00
rkrolib
85b7b49ead Somewhat normalized the style of this file.
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
2003-11-07 08:06:10 +00:00
rkrolib
d8b2c1d571 Further normalization of the code's style. No substantial changes.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@312 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 07:57:03 +00:00
rkrolib
e6b59a4b45 Split one last overlong line in freeglut_cursor.c.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@311 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 07:48:13 +00:00
rkrolib
658305f2c9 Added GLUT_CURSOR_NONE support in UNIX_X11 (well, NetBSD; you lot need
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
2003-11-07 07:46:08 +00:00
rkrolib
d8f572533b Further normalized the style of the cursor code.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@309 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 06:25:20 +00:00
rkrolib
aeeabeff93 Slight style improvements. Two rules of thumb that are almost always
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
2003-11-07 06:12:58 +00:00
rkrolib
974e38bfbd Grr. Forgot to enable the "freeglut" C programming mode in EMACS, and
had a few TABs in the last commit.  This fixes that.  Sorry.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@307 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-07 05:46:33 +00:00
rkrolib
869780207d Minor corrections to the UNIX_X11 mouse-wheel support. In part this
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
2003-11-07 05:43:34 +00:00
rkrolib
2ff70b671c Ooops. I screwed up on part of John's fixes. Sorry.
I think that I have his fix properly committed now.  Mea culpa.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@305 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-06 23:40:21 +00:00
rkrolib
65dde7f632 Cleanup pass after committing callback conversion (from structure to
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
2003-11-06 23:29:55 +00:00
rkrolib
80a523394c Converted the "Callbacks" structure (with named members holding individual
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
2003-11-06 22:09:35 +00:00
rkrolib
b7dd45a935 From John, a couple of lines needed to be changed to fix the mouse wheel
support on WIN32.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@302 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-06 21:41:17 +00:00
rkrolib
406636047f Update from John: Includes mouse button, mouse motion, and mouse wheel
support.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@301 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-06 21:38:21 +00:00
rkrolib
0b588cdcb7 Multiple changes from John. Style issues, plus a bug-fix to check
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
2003-11-04 18:47:26 +00:00
rkrolib
585433d174 Some changes, mostly from John. Mostly style changes.
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
2003-11-04 18:16:52 +00:00
rkrolib
3a18a26d74 Update from John:
I [John] added a feature to check for memory leaks under Windows.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@297 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-04 15:53:49 +00:00
rkrolib
8df7ae3c29 Update from John:
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
2003-11-04 15:32:57 +00:00
rkrolib
cc38ef07e9 Got rid of the G_LOG_DOMAIN junk, per discussion on the mailing list.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@295 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-04 01:30:32 +00:00
rkrolib
30a7dfb0c4 Minor formatting quibbles. (The brain isn't up to anything more serious
at the moment.)


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@294 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-04 01:17:18 +00:00
rkrolib
2c356e1221 Missed a block where one level was 2-space indented.
Nit-picked a few other lines for consistancy.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@293 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-04 01:10:13 +00:00
rkrolib
9b257588e0 Fixed a memory leak (thanks for the correction, John!).
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
2003-11-03 21:41:07 +00:00
rkrolib
7c699fab2f Deleted 3 files (again?) from CVS, on John's request. Old/obsolete
MSVC++ project files.
(freeglut13.dsp, freeglutdll.dsp, freeglutstatic.dsw)


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@291 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-03 21:28:54 +00:00
rkrolib
5342fe966f * Indentation issues.
* Pulled some common code into a nicely packaged function.
 * Found some pointer/int issues.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@290 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-03 21:25:11 +00:00
rkrolib
fa26d7b700 Heh.
Forgot to wrap the fgGetXModifiers() in a #if.  Fixed.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@289 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-03 10:56:48 +00:00
rkrolib
cced36cf2b Extracted some common code to a subroutine, in glutMainLoopEvent().
(The common code was a snippet to compute X keyboard modifiers as a
bit-mask of GLUT symbols.)


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@288 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-03 10:51:26 +00:00
rkrolib
9b944ec457 Caught a few more little style issues.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@287 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-03 10:31:41 +00:00
rkrolib
2ab6b22f80 Added a "case" for an X event that we turn on but do not use.
({MapNotify}).  We already caught {MappingNotify} and {UnmapNotify}.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@286 7f0cb862-5218-0410-a997-914c9d46530a
2003-11-03 10:29:30 +00:00
rkrolib
31c0809e28 * Fixed a bug in the X11 handling of scrollwheel/mouse. The old code,
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
2003-11-03 10:05:07 +00:00
rkrolib
01dc2daa05 Cleaned up one macro definition.
Picked up an over-long line that I missed before.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@284 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 20:51:56 +00:00
rkrolib
d519c9292d Fit some long lines to 80 columns.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@283 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 20:49:07 +00:00
rkrolib
02e53500a7 Last of the hard TABs in the src/*.c files.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@282 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 13:40:08 +00:00
rkrolib
c89d0c24d9 En masse removal of most (I think) of the remaining hard TABs in files.
There are still a couple of files that need to be hit.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@281 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 11:33:12 +00:00
rkrolib
5a1317c0f4 Picked up some stray TABs scattered in this file.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@280 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 11:28:14 +00:00
rkrolib
d1bfaa5c4b Noted by XXX comments that the XFlush() calls probably shouldn't be there.
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
2003-10-31 11:25:23 +00:00
rkrolib
a92096db1a Polished off the say-nothing-new comments and lines-over-80-columns in
freeglut_window.c

There should be no functional changes.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@278 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 11:11:48 +00:00
rkrolib
350de30921 Missed a few say-nothing-new comments in fgOpenWindow().
Eeep.  Should be better now.  (^&


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@277 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 06:25:34 +00:00
rkrolib
a1c14f4cf5 Cleansed fgCloseWindow():
* say-nothing-new comments axed.
 * de-TABbed.
 * Made the white-space to be consistant.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@276 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 06:20:07 +00:00
rkrolib
6674df547f Cleaned up fgOpenWindow():
* 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
2003-10-31 06:11:25 +00:00
rkrolib
ba6ee1d34a Cleanup to fgSetWindow(). The usual suspects:
* Removed tabs.
 * Made indentation consistant.
 * Killed off say-nothing-new comments.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@274 7f0cb862-5218-0410-a997-914c9d46530a
2003-10-31 05:34:19 +00:00
rkrolib
570e2aa0b6 Cleanup to fgSetupixelFormat(). Should be no functional changes.
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
2003-10-31 04:25:34 +00:00
rkrolib
807042d126 There should be no changes to code functionality, though a fair bit of
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
2003-10-31 03:37:27 +00:00
rkrolib
92b5fb9d59 Finished off most of the issues with freeglut_structure.c, from a stylistic
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
2003-10-30 04:43:08 +00:00