Implemeted 95% of all Mac OS X support. Makefiles still need modifications.

Almost all test applications run out of the box (->Makefile). See more
information in README.mac .

Changes:
- message handling
- access to opaque port structures
- image, bitmap, pixmap support
- most OpenGL stuff
- window styles


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1812 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher
2001-12-06 00:17:47 +00:00
parent 39109694e1
commit e07200c4e8
16 changed files with 281 additions and 151 deletions
+3
View File
@@ -1,5 +1,8 @@
CHANGES IN FLTK 1.1.0b7 CHANGES IN FLTK 1.1.0b7
- Some Win32 drivers would draw into wrong buffers
after OpenGL mode change
- Mac OS X support works 95%
- More documentation updates... - More documentation updates...
- The file chooser would cause a segfault if you - The file chooser would cause a segfault if you
clicked in an empty area of the file list. clicked in an empty area of the file list.
+8 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: gl.h,v 1.6.2.4 2001/01/22 15:13:38 easysw Exp $" // "$Id: gl.h,v 1.6.2.4.2.1 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// OpenGL header file for the Fast Light Tool Kit (FLTK). // OpenGL header file for the Fast Light Tool Kit (FLTK).
// //
@@ -44,7 +44,12 @@
# define APIENTRY # define APIENTRY
# endif # endif
#endif #endif
#include <GL/gl.h>
#ifdef __APPLE__
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
FL_EXPORT void gl_start(); FL_EXPORT void gl_start();
FL_EXPORT void gl_finish(); FL_EXPORT void gl_finish();
@@ -76,5 +81,5 @@ FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, in
#endif #endif
// //
// End of "$Id: gl.h,v 1.6.2.4 2001/01/22 15:13:38 easysw Exp $". // End of "$Id: gl.h,v 1.6.2.4.2.1 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+3 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: mac.H,v 1.1.2.1 2001/11/27 17:44:06 easysw Exp $" // "$Id: mac.H,v 1.1.2.2 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// Mac header file for the Fast Light Tool Kit (FLTK). // Mac header file for the Fast Light Tool Kit (FLTK).
// //
@@ -108,7 +108,7 @@ extern void fl_delete_offscreen(Fl_Offscreen gWorld);
extern void fl_begin_offscreen(Fl_Offscreen gWorld); extern void fl_begin_offscreen(Fl_Offscreen gWorld);
extern void fl_end_offscreen(); extern void fl_end_offscreen();
typedef GrafPtr Fl_Bitmask; typedef GWorldPtr Fl_Bitmask; // Carbon requires a 1-bit GWorld instead of a BitMap
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data); extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm); extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
@@ -120,6 +120,6 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
#endif // !FL_MAC_H #endif // !FL_MAC_H
// //
// End of "$Id: mac.H,v 1.1.2.1 2001/11/27 17:44:06 easysw Exp $". // End of "$Id: mac.H,v 1.1.2.2 2001/12/06 00:17:47 matthiaswm Exp $".
// //
-13
View File
@@ -8,19 +8,6 @@ data 'MENU' (128, "Apple") {
$"2D00 0000 0000" /* -..... */ $"2D00 0000 0000" /* -..... */
}; };
data 'cfrg' (0) {
$"0000 0000 0000 0000 0000 0001 0000 0000" /* ................ */
$"0000 0000 0000 0000 0000 0000 0000 0001" /* ................ */
$"7077 7063 0000 0000 0000 0000 0000 0000" /* pwpc............ */
$"0001 0000 0000 0101 0000 0000 0000 0000" /* ................ */
$"0000 0000 0000 0000 0034 0662 7574 746F" /* .........4.butto */
$"6E00 0000" /* n... */
};
data 'SIZE' (-1) {
$"58C0 0006 0000 0006 0000" /* XÀ........ */
};
data 'carb' (0) { data 'carb' (0) {
}; };
+53 -5
View File
@@ -1,13 +1,23 @@
README.mac - 12/03/2001 - Building FLTK under MacOS and OS X README.mac - 12/03/2001 - Building FLTK under MacOS and OS X
------------------------------------------------------------ ------------------------------------------------------------
CONTENTS
--------
- Introduction
- gcc (Carbon) - how to build
- scripts
- known MacFLTK bugs
- test suite status
- other stuff
- FLTK 1.0.x for Mac
INTRODUCTION INTRODUCTION
------------ ------------
FLTK for Mac OS X is in pre-beta stage. Expect rapid changes to the FLTK for Mac OS X is in pre-beta stage. Expect rapid changes to the
source code and build environment. Expect many crashes and funny source code and build environment. Expect many crashes and funny
bliking patterns. blinking patterns.
FLTK currently supports the following development environment on the FLTK currently supports the following development environment on the
Mac OS X platform: Mac OS X platform:
@@ -20,11 +30,11 @@ Mac OS X platform:
- (MPW - future releases) - (MPW - future releases)
FLTK for Mac is carbonized, i.e. all applicatiosn should run on Mac FLTK for Mac is carbonized, i.e. all applications should run on Mac
OS 8.1 and higher and OS X without changes. OS 8.1 and higher and OS X without changes.
gcc (Carbon) - how to buid gcc (Carbon) - how to build
-------------------------- --------------------------
Since the Max OS X command line build environment is based on BSD Since the Max OS X command line build environment is based on BSD
@@ -69,16 +79,54 @@ find . -name 'Make*' -exec $SET_MAC_TYPE {} \;
echo "done." echo "done."
known MacFLTK bugs
------------------
- OpenGL window resize
- font support not finished
- line styles missing
- cut, copy, paste
- mousewheel (Carbon Events)
- sub-sub-subwindow
- modal windows are not modal
- makefiles supporting Rez
test suite status
-----------------
OS X:
CubeView(++), adjuster(++), arc(++), ask(++), bitmap(++),
boxtype(++), browser(++), button(++), buttons(++), checkers(++),
clock(++), colbrowser(++), color_chooser(++), cube(++), cursor(+),
curve(++), demo(++), doublebuffer(++), editor(++), fast_slow(++),
file_chooser(++), fonts(++), forms(++), fractals(+), fullscreen(+),
gl_overlay(o), glpuzzle(++), hello(++), help(++), iconize(+), image(+),
inactive(++), input(++), keyboard(+), label(++), line_style(+),
mandelbrot(++), menubar(++), message(++), minimum(++), navigation(++),
output(++), overlay(o), pack(++), pixmap(++), pixmap_browser(++),
radio(++), resizebox(++), scroll(++), shape(+), shiny(--), subwindow(++),
symbols(++), tabs(++), tile(++), tiled_image(++), valuators(++),
fluid(++)
(o)=minor bugs, (+)=usable, (++)=running perfectly, (-)=major
bugs, (--)=crashes
other stuff other stuff
----------- -----------
The following creator ID's 'FLTK', 'Fltk', 'FLID' and 'Flid' are The following creator ID's 'FLTK', 'Fltk', 'FLID' and 'Flid' are
officially registered with Aplle Computers and can be used for officially registered with Apple Computers and can be used for
FLTK applications ('FLTK') and fluid files ('Flid'). FLTK applications ('FLTK') and fluid files ('Flid').
All applications shout be ended with exit(0); or they might All applications should be ended with exit(0); or they might
hang until killed. hang until killed.
Under OS X, all windows are doublebuffered anyway. Using Fl_Window
has the same effect as using Fl_Double_Window on OS X.
FLTK 1.0.x for Mac FLTK 1.0.x for Mac
------------------ ------------------
+10 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl.cxx,v 1.24.2.41.2.10 2001/11/28 20:43:44 easysw Exp $" // "$Id: Fl.cxx,v 1.24.2.41.2.11 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// Main event handling code for the Fast Light Tool Kit (FLTK). // Main event handling code for the Fast Light Tool Kit (FLTK).
// //
@@ -361,7 +361,14 @@ void Fl::flush() {
#ifdef WIN32 #ifdef WIN32
GdiFlush(); GdiFlush();
#elif !defined(__APPLE__) #elif defined (__APPLE__)
GrafPtr port; GetPort( &port );
if ( port )
{
QDFlushPortBuffer( port, 0 );
//printf("DBG: Fl::flush\n");
}
#else
if (fl_display) XFlush(fl_display); if (fl_display) XFlush(fl_display);
#endif #endif
} }
@@ -834,5 +841,5 @@ void Fl_Window::flush() {
} }
// //
// End of "$Id: Fl.cxx,v 1.24.2.41.2.10 2001/11/28 20:43:44 easysw Exp $". // End of "$Id: Fl.cxx,v 1.24.2.41.2.11 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+43 -43
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.7 2001/11/27 17:44:06 easysw Exp $" // "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.8 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// Bitmap drawing routines for the Fast Light Tool Kit (FLTK). // Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
// //
@@ -34,49 +34,48 @@
#ifdef __APPLE__ // MacOS bitmask functions #ifdef __APPLE__ // MacOS bitmask functions
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) { Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
Rect srcRect; Rect srcRect;
RgnHandle r = NewRgn();
srcRect.left = 0; srcRect.right = w; srcRect.left = 0; srcRect.right = w;
srcRect.top = 0; srcRect.bottom = h; srcRect.top = 0; srcRect.bottom = h;
GrafPtr savePort; GrafPtr savePort;
GrafPtr newPort;
GetPort(&savePort); // remember the current port GetPort(&savePort); // remember the current port
newPort = CreateNewPort(); Fl_Bitmask gw;
NewGWorld( &gw, 1, &srcRect, 0L, 0L, 0 );
SetPortBounds(newPort, &srcRect); // make bitmap the size of the bounds that caller supplied PixMapHandle pm = GetGWorldPixMap( gw );
RectRgn( GetPortClipRegion(newPort, r), &srcRect ); if ( pm )
RectRgn( GetPortVisibleRegion(newPort, r), &srcRect ); {
DisposeRgn(r); LockPixels( pm );
if ( *pm )
//++ rowBytes is size of row, it must be rounded up to an even number of bytes {
// int rowBytes = newPort->portBits.rowBytes = (( w + 15 ) >> 4 ) << 1; uchar *base = (uchar*)GetPixBaseAddr( pm );
// int rowBytesSrc = (( w + 7 ) >> 3 ); if ( base )
// newPort->portBits.baseAddr = NewPtr( rowBytes * h ); {
// if ( !newPort->portBits.baseAddr ) PixMapPtr pmp = *pm;
// { // verify the parameters for direct memory write
// SetPort(savePort); if ( pmp->pixelType == 0 || pmp->pixelSize == 1 || pmp->cmpCount == 1 || pmp->cmpSize == 1 )
// ClosePort(newPort); {
// DisposePtr((Ptr)newPort); static uchar reverse[16] = /* Bit reversal lookup table */
// return 0L; { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee, 0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
// } uchar *dst = base;
// const uchar *src = array;
// static uchar reverse[16] = /* Bit reversal lookup table */ int rowBytesSrc = (w+7)>>3 ;
// { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee, int rowPatch = (pmp->rowBytes&0x3fff) - rowBytesSrc;
// 0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff }; for ( int j=0; j<h; j++,dst+=rowPatch )
// uchar *dst = (uchar*)newPort->portBits.baseAddr; for ( int i=0; i<rowBytesSrc; i++,src++ )
// const uchar *src = array; *dst++ = (reverse[*src & 0x0f] & 0xf0) | (reverse[(*src >> 4) & 0x0f] & 0x0f);
// int rowPatch = ( rowBytes!=rowBytesSrc ) ? 1 : 0 ; }
// for ( int j=0; j<h; j++,dst+=rowPatch ) }
// for ( int i=0; i<rowBytesSrc; i++,src++ ) UnlockPixels( pm );
// *dst++ = (reverse[*src & 0x0f] & 0xf0) | (reverse[(*src >> 4) & 0x0f] & 0x0f); }
}
SetPort(savePort); SetPort(savePort);
return newPort; /* tell caller we succeeded! */ return gw; /* tell caller we succeeded! */
} }
void fl_delete_bitmask(Fl_Bitmask id) { void fl_delete_bitmask(Fl_Bitmask id) {
if (id) DisposePort(id); if (id) DisposeGWorld(id);
} }
#elif defined(WIN32) // Windows bitmask functions... #elif defined(WIN32) // Windows bitmask functions...
// 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing... // 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing...
@@ -236,16 +235,17 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (!id) id = fl_create_bitmask(w(), h(), array); if (!id) id = fl_create_bitmask(w(), h(), array);
GrafPtr dstPort; GrafPtr dstPort;
GetPort( &dstPort ); GetPort( &dstPort );
Rect dst; Rect src, dst;
dst.left = X; dst.right = X+W; GetPortBounds( id, &src );
dst.top = Y; dst.bottom = Y+H; SetRect( &src, cx, cy, cx+W, cy+H );
SetRect( &dst, X, Y, X+W, Y+H );
CopyBits( CopyBits(
GetPortBitMapForCopyBits((GrafPtr)id), GetPortBitMapForCopyBits(id), // srcBits
GetPortBitMapForCopyBits(dstPort), GetPortBitMapForCopyBits(dstPort), // dstBits
GetPortBounds((GrafPtr)id, 0), &src, // src bounds
&dst, &dst, // dst bounds
srcOr, srcOr, // mode
0L); 0L); // mask region
#else #else
if (!id) id = fl_create_bitmask(w(), h(), array); if (!id) id = fl_create_bitmask(w(), h(), array);
@@ -340,5 +340,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
// //
// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.7 2001/11/27 17:44:06 easysw Exp $". // End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.8 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+18 -7
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.2 2001/12/04 03:03:17 matthiaswm Exp $" // "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.3 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// Double-buffered window code for the Fast Light Tool Kit (FLTK). // Double-buffered window code for the Fast Light Tool Kit (FLTK).
// //
@@ -103,7 +103,7 @@ GWorldPtr fl_create_offscreen(int w, int h) {
GWorldPtr gw; GWorldPtr gw;
Rect bounds; Rect bounds;
bounds.left=0; bounds.right=w; bounds.top=0; bounds.bottom=h; bounds.left=0; bounds.right=w; bounds.top=0; bounds.bottom=h;
QDErr err = NewGWorld(&gw, 0, &bounds, 0L, 0L, useTempMem); QDErr err = NewGWorld(&gw, 0, &bounds, 0L, 0L, 0); // 'useTempMem' should not be used (says the Carbon port manual)
if ( err == -108 ) if ( err == -108 )
{ } { }
// fl_message( "The application memory is low. Please increase the initial memory assignment.\n" ); // fl_message( "The application memory is low. Please increase the initial memory assignment.\n" );
@@ -116,6 +116,7 @@ GWorldPtr fl_create_offscreen(int w, int h) {
*/ */
void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int srcy) { void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int srcy) {
Rect src; Rect src;
if ( !gWorld ) return;
src.top = srcy; src.left = srcx; src.bottom = srcy+h; src.right = srcx+w; src.top = srcy; src.left = srcx; src.bottom = srcy+h; src.right = srcx+w;
Rect dst; Rect dst;
GrafPtr dstPort; GetPort(&dstPort); GrafPtr dstPort; GetPort(&dstPort);
@@ -145,11 +146,10 @@ void fl_begin_offscreen(GWorldPtr gWorld) {
GetGWorld( &prevPort, &prevGD ); GetGWorld( &prevPort, &prevGD );
if ( gWorld ) if ( gWorld )
{ {
SetGWorld( gWorld, 0L ); SetGWorld( gWorld, 0L ); // sets the correct port
PixMapHandle pm = GetGWorldPixMap(gWorld); PixMapHandle pm = GetGWorldPixMap(gWorld);
LockPixels(pm); LockPixels(pm);
fl_window = (Window)prevPort; fl_window = GetWindowFromPort( gWorld );
SetPort( GetWindowPort(fl_window) );
} }
fl_push_no_clip(); fl_push_no_clip();
} }
@@ -164,8 +164,8 @@ void fl_end_offscreen() {
fl_pop_clip(); fl_pop_clip();
PixMapHandle pm = GetGWorldPixMap(currPort); PixMapHandle pm = GetGWorldPixMap(currPort);
UnlockPixels(pm); UnlockPixels(pm);
fl_window = (Window)prevPort;
SetGWorld( prevPort, prevGD ); SetGWorld( prevPort, prevGD );
fl_window = GetWindowFromPort( prevPort );
} }
extern void fl_restore_clip(); extern void fl_restore_clip();
@@ -187,7 +187,14 @@ void Fl_Double_Window::flush(int eraseoverlay) {
XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeUndefined); XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeUndefined);
else else
#endif #endif
#ifdef __APPLE__
// the Apple OS X window manager double buffers ALL windows anyway, so there is no need to waste memory and time
// BTW: Windows2000 and later also forces doublebuffering if transparent windows are beeing used (alpha channel)
if ( !QDIsPortBuffered( GetWindowPort(myi->xid) ) )
myi->other_xid = fl_create_offscreen(w(), h()); myi->other_xid = fl_create_offscreen(w(), h());
#else
myi->other_xid = fl_create_offscreen(w(), h());
#endif
clear_damage(FL_DAMAGE_ALL); clear_damage(FL_DAMAGE_ALL);
} }
#if USE_XDBE #if USE_XDBE
@@ -242,7 +249,11 @@ void Fl_Double_Window::flush(int eraseoverlay) {
// on Irix (at least) it is faster to reduce the area copied to // on Irix (at least) it is faster to reduce the area copied to
// the current clip region: // the current clip region:
int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H); int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H);
#ifdef __APPLE__
if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
#else
fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y); fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
#endif
} }
void Fl_Double_Window::resize(int X,int Y,int W,int H) { void Fl_Double_Window::resize(int X,int Y,int W,int H) {
@@ -275,5 +286,5 @@ Fl_Double_Window::~Fl_Double_Window() {
} }
// //
// End of "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.2 2001/12/04 03:03:17 matthiaswm Exp $". // End of "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.3 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+6 -5
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.1 2001/11/27 17:44:06 easysw Exp $" // "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.2 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// OpenGL definitions for the Fast Light Tool Kit (FLTK). // OpenGL definitions for the Fast Light Tool Kit (FLTK).
// //
@@ -58,8 +58,9 @@
# include <FL/gl.h> # include <FL/gl.h>
# define GLContext HGLRC # define GLContext HGLRC
#elif defined(__APPLE__) #elif defined(__APPLE__)
# include <OpenGL.h> # include <OpenGL/gl.h>
# define GLContext CGLContextObj # include <AGL/agl.h>
# define GLContext AGLContext
#else #else
# include <GL/glx.h> # include <GL/glx.h>
# define GLContext GLXContext # define GLContext GLXContext
@@ -94,7 +95,7 @@ GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
#elif defined(__APPLE__) #elif defined(__APPLE__)
//++ GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
#else #else
@@ -114,5 +115,5 @@ void fl_delete_gl_context(GLContext);
#endif #endif
// //
// End of "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.1 2001/11/27 17:44:06 easysw Exp $". // End of "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.2 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+24 -20
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.2 2001/11/27 17:44:06 easysw Exp $" // "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.3 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// OpenGL visual selection code for the Fast Light Tool Kit (FLTK). // OpenGL visual selection code for the Fast Light Tool Kit (FLTK).
// //
@@ -31,6 +31,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "Fl_Gl_Choice.H" #include "Fl_Gl_Choice.H"
#ifdef __APPLE__
# include <Fl/Fl_Window.H>
#endif
static Fl_Gl_Choice *first; static Fl_Gl_Choice *first;
// this assummes one of the two arguments is zero: // this assummes one of the two arguments is zero:
@@ -195,16 +199,16 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
AGL_NONE }; AGL_NONE };
AGLPixelFormat fmt; AGLPixelFormat fmt;
fmt = aglChoosePixelFormat(NULL, 0, attrib); fmt = aglChoosePixelFormat(NULL, 0, attrib);
context = aglCreateContext(fmt, fl_first_context); context = aglCreateContext(fmt, first_context);
if ( !fl_first_context ) fl_first_context = (GLXContext)context; if ( !first_context ) first_context = (GLContext)context;
aglDestroyPixelFormat( fmt ); aglDestroyPixelFormat( fmt );
if ( parent() ) { if ( window->parent() ) {
CGrafPort *port = (CGrafPort*)fl_xid(this); Rect wrect; GetWindowPortBounds( fl_xid(window), &wrect );
GLint rect[] = { x(), port->portRect.bottom-h()-y(), w(), h() }; GLint rect[] = { window->x(), wrect.bottom-window->h()-window->y(), window->w(), window->h() };
aglSetInteger( (GLXContext)context, AGL_BUFFER_RECT, rect ); aglSetInteger( (GLContext)context, AGL_BUFFER_RECT, rect );
aglEnable( (GLXContext)context, AGL_BUFFER_RECT ); aglEnable( (GLContext)context, AGL_BUFFER_RECT );
} }
aglSetDrawable((GLXContext)context, (CGrafPort*)fl_xid(window)); aglSetDrawable( context, GetWindowPort( fl_xid(window) ) );
return (context); return (context);
} }
#else #else
@@ -228,13 +232,13 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
wglMakeCurrent(Fl_X::i(w)->private_dc, context); wglMakeCurrent(Fl_X::i(w)->private_dc, context);
#elif defined(__APPLE__) #elif defined(__APPLE__)
if ( w->parent() ) { //: resize our GL buffer rectangle if ( w->parent() ) { //: resize our GL buffer rectangle
CGrafPort *port = (CGrafPort*)fl_xid(w); Rect wrect; GetWindowPortBounds( fl_xid(w), &wrect );
GLint rect[] = { w->x(), port->portRect.bottom-w->h()-w->y(), w->w(), w->h() }; GLint rect[] = { w->x(), wrect.bottom-w->h()-w->y(), w->w(), w->h() };
aglSetInteger( c, AGL_BUFFER_RECT, rect ); aglSetInteger( context, AGL_BUFFER_RECT, rect );
aglEnable( c, AGL_BUFFER_RECT ); aglEnable( context, AGL_BUFFER_RECT );
} }
aglSetDrawable(c, (CGrafPort*)fl_xid(w)); //++ here or in Fl_Gl_Window::make_current creation part? aglSetDrawable(context, GetWindowPort( fl_xid(w) ) ); //++ here or in Fl_Gl_Window::make_current creation part?
aglSetCurrentContext(c); aglSetCurrentContext(context);
#else #else
glXMakeCurrent(fl_display, fl_xid(w), context); glXMakeCurrent(fl_display, fl_xid(w), context);
#endif #endif
@@ -258,10 +262,10 @@ void fl_delete_gl_context(GLContext context) {
if (context != first_context) { if (context != first_context) {
#ifdef WIN32 #ifdef WIN32
wglDeleteContext(context); wglDeleteContext(context);
#elif defined(__APPLE) #elif defined(__APPLE__)
aglSetCurrentContext(NULL); aglSetCurrentContext( NULL );
aglSetDrawable((AGLContext)context, NULL); aglSetDrawable( context, NULL );
aglDestroyContext((AGLContext)context); aglDestroyContext( context );
#else #else
glXDestroyContext(fl_display, context); glXDestroyContext(fl_display, context);
#endif #endif
@@ -271,5 +275,5 @@ void fl_delete_gl_context(GLContext context) {
#endif #endif
// //
// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.2 2001/11/27 17:44:06 easysw Exp $". // End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.3 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+12 -8
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.2 2001/12/04 04:12:58 matthiaswm Exp $" // "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.3 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// OpenGL window code for the Fast Light Tool Kit (FLTK). // OpenGL window code for the Fast Light Tool Kit (FLTK).
// //
@@ -202,8 +202,12 @@ void Fl_Gl_Window::flush() {
#ifdef __APPLE__ #ifdef __APPLE__
//: clear previous clipping in this shared port //: clear previous clipping in this shared port
CGrafPort *port = (CGrafPort*)fl_xid(this); GrafPtr port = GetWindowPort( fl_xid(this) );
SetRectRgn( port->clipRgn, 0, 0, 0x7fff, 0x7fff ); Rect rect; SetRect( &rect, 0, 0, 0x7fff, 0x7fff );
GrafPtr old; GetPort( &old );
SetPort( port );
ClipRect( &rect );
SetPort( old );
#endif #endif
make_current(); make_current();
@@ -296,10 +300,10 @@ void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
valid(0); valid(0);
#ifdef __APPLE__ #ifdef __APPLE__
if ( parent() ) { //: resize our GL buffer rectangle if ( parent() ) { //: resize our GL buffer rectangle
CGrafPort *port = (CGrafPort*)fl_xid(this); Rect wrect; GetWindowPortBounds( fl_xid(this), &wrect );
GLint rect[] = { X, port->portRect.bottom-h()-y(), W, H }; GLint rect[] = { X, wrect.bottom-h()-y(), W, H };
aglSetInteger( (GLXContext)context_, AGL_BUFFER_RECT, rect ); aglSetInteger( context_, AGL_BUFFER_RECT, rect );
aglEnable( (GLXContext)context_, AGL_BUFFER_RECT ); aglEnable( context_, AGL_BUFFER_RECT );
} }
#elif !defined(WIN32) #elif !defined(WIN32)
if (!resizable() && overlay && overlay != this) if (!resizable() && overlay && overlay != this)
@@ -347,5 +351,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif #endif
// //
// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.2 2001/12/04 04:12:58 matthiaswm Exp $". // End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.3 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+4 -4
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Sys_Menu_Bar.cxx,v 1.1.2.1 2001/11/27 17:44:06 easysw Exp $" // "$Id: Fl_Sys_Menu_Bar.cxx,v 1.1.2.2 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// MacOS system menu bar widget for the Fast Light Tool Kit (FLTK). // MacOS system menu bar widget for the Fast Light Tool Kit (FLTK).
// //
@@ -24,7 +24,7 @@
// //
/** /**
* Tis code is a quick hack! It was written as a proove of concept. * This code is a quick hack! It was written as a proof of concept.
* It has been tested on the "menubar" sample program and provides * It has been tested on the "menubar" sample program and provides
* basic functionality. * basic functionality.
* *
@@ -252,7 +252,7 @@ void Fl_Sys_Menu_Bar::menu(const Fl_Menu_Item *m)
} }
InsertMenu( mh, 0 ); InsertMenu( mh, 0 );
if ( mm->flags & FL_MENU_INACTIVE ) DisableItem( mh, 0 ); if ( mm->flags & FL_MENU_INACTIVE ) DisableMenuItem( mh, 0 );
mm++; mm++;
} }
DrawMenuBar(); DrawMenuBar();
@@ -310,5 +310,5 @@ int Fl_Menu_Bar::handle(int event) {
*/ */
// //
// End of "$Id: Fl_Sys_Menu_Bar.cxx,v 1.1.2.1 2001/11/27 17:44:06 easysw Exp $". // End of "$Id: Fl_Sys_Menu_Bar.cxx,v 1.1.2.2 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+64 -19
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_mac.cxx,v 1.1.2.2 2001/12/04 03:03:17 matthiaswm Exp $" // "$Id: Fl_mac.cxx,v 1.1.2.3 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// MacOS specific code for the Fast Light Tool Kit (FLTK). // MacOS specific code for the Fast Light Tool Kit (FLTK).
// //
@@ -28,6 +28,8 @@
// still be useful. // still be useful.
#define CONSOLIDATE_MOTION 0 #define CONSOLIDATE_MOTION 0
// use TARGET_API_MAC_CARBON if needed
#include <config.h> #include <config.h>
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/x.H> #include <FL/x.H>
@@ -163,6 +165,13 @@ int fl_ready()
} }
/**
*/
void printMacEvent( const EventRecord &ev )
{
printf("Event: w:0x%04x m:0x%08x mod:0x%04x flags:%08x x:%d, y:%d\n", ev.what, ev.message, ev.modifiers, 0, ev.where.h, ev.where.v );
}
/** /**
* This function iss the central event handler. * This function iss the central event handler.
* It reads events from the event queue using the given maximum time * It reads events from the event queue using the given maximum time
@@ -206,7 +215,7 @@ static double do_queued_events( double time = 0.0 )
#else #else
EventRecord ev; EventRecord ev;
unsigned long ticks = (int)(time*60.0); unsigned long ticks = (int)(time*60.0);
while ( WaitNextEvent(everyEvent, &ev, ticks, rgn) ) if ( WaitNextEvent(everyEvent, &ev, ticks, rgn) )
{ {
fl_handle(ev); //: handle the nullEvent to get mouse up events fl_handle(ev); //: handle the nullEvent to get mouse up events
SetRectRgn(rgn, ev.where.h, ev.where.v, ev.where.h+1, ev.where.v+1 ); SetRectRgn(rgn, ev.where.h, ev.where.v, ev.where.h+1, ev.where.v+1 );
@@ -448,7 +457,7 @@ static void set_shift_states(const EventRecord &macevent)
{ {
ulong state = Fl::e_state & 0xff000000; ulong state = Fl::e_state & 0xff000000;
if (macevent.modifiers&shiftKey) state |= FL_SHIFT; if (macevent.modifiers&shiftKey) state |= FL_SHIFT;
if ( (macevent.modifiers&controlKey) && (macevent.modifiers&btnState) ) state |= FL_META; // try to fetch the right mouse button if ( (macevent.modifiers&controlKey) && (!Button()) ) state |= FL_META; // try to fetch the right mouse button
if (macevent.modifiers&optionKey) state |= FL_ALT; if (macevent.modifiers&optionKey) state |= FL_ALT;
if (macevent.modifiers&cmdKey) state |= FL_CTRL; if (macevent.modifiers&cmdKey) state |= FL_CTRL;
if (macevent.modifiers&alphaLock) state |= FL_CAPS_LOCK; if (macevent.modifiers&alphaLock) state |= FL_CAPS_LOCK;
@@ -610,6 +619,8 @@ void Fl_X::flush()
{ {
w->flush(); w->flush();
SetOrigin( 0, 0 ); SetOrigin( 0, 0 );
//QDFlushPortBuffer( GetWindowPort(xid), 0 ); // easy way out - remove!
//printf("DBG: Fl_X::flush\n");
} }
@@ -639,8 +650,8 @@ void handleUpdateEvent( WindowPtr xid )
} }
BeginUpdate( xid ); BeginUpdate( xid );
DrawControls(xid); // do we need this? //DrawControls(xid); // do we need this?
DrawGrowIcon(xid); // do we need this? //DrawGrowIcon(xid); // do we need this?
for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext ) for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext )
{ {
cx->w->clear_damage(window->damage()|FL_DAMAGE_EXPOSE); cx->w->clear_damage(window->damage()|FL_DAMAGE_EXPOSE);
@@ -652,6 +663,8 @@ void handleUpdateEvent( WindowPtr xid )
window->clear_damage(); window->clear_damage();
EndUpdate( xid ); EndUpdate( xid );
//QDFlushPortBuffer( GetWindowPort(xid), 0 ); // should not be needed here!
//printf("DBG: handleUpdate::flush\n");
SetPort( oldPort ); SetPort( oldPort );
} }
@@ -685,12 +698,13 @@ int fl_handle(const EventRecord &macevent)
WindowPtr xid; WindowPtr xid;
int event = 0; int event = 0;
Fl_Window *window = 0L; Fl_Window *window = 0L;
//printMacEvent( macevent );
switch (macevent.what) switch (macevent.what)
{ {
case mouseDown: { case mouseDown: {
// handle the differnt mouseDown events in various areas of the screen // handle the differnt mouseDown events in various areas of the screen
int part = FindWindow(macevent.where, &xid); int part = FindWindow(macevent.where, &xid);
printf("mousedown in part %d\n", part ); //printf("mousedown in part %d\n", part );
prevMouseDownXid = xid; prevMouseDownXid = xid;
switch (part) { switch (part) {
case inDesk: break; case inDesk: break;
@@ -701,9 +715,10 @@ int fl_handle(const EventRecord &macevent)
window = fl_find(xid); window = fl_find(xid);
if (!window) break; if (!window) break;
SetPort( GetWindowPort(xid) ); SetOrigin(0, 0); SetPort( GetWindowPort(xid) ); SetOrigin(0, 0);
Fl::e_keysym = FL_Button+((macevent.modifiers&controlKey)?3:1); //++ simulate three button using modifiers //printMacEvent( macevent );
Fl::e_keysym = FL_Button+((macevent.modifiers&0x1000)?3:1); //++ simulate three button using modifiers
set_event_xy(macevent); checkdouble(); set_event_xy(macevent); checkdouble();
Fl::e_state |= ((macevent.modifiers&controlKey)?FL_BUTTON3:FL_BUTTON1); Fl::e_state |= ((macevent.modifiers&0x1000)?FL_BUTTON3:FL_BUTTON1);
return Fl::handle(FL_PUSH, window); } return Fl::handle(FL_PUSH, window); }
case inDrag: Fl_X::MacDragWindow(xid, macevent); break; case inDrag: Fl_X::MacDragWindow(xid, macevent); break;
case inGrow: Fl_X::MacGrowWindow(xid, macevent); break; case inGrow: Fl_X::MacGrowWindow(xid, macevent); break;
@@ -805,7 +820,7 @@ int fl_handle(const EventRecord &macevent)
send_motion = fl_xmousewin = window; send_motion = fl_xmousewin = window;
return 0; return 0;
#else #else
return Fl::handle( (macevent.modifiers & btnState)?FL_MOVE:FL_DRAG, window); return Fl::handle( Button()?FL_DRAG:FL_MOVE, window);
#endif #endif
// if (!Fl::grab()) ReleaseCapture(); // if (!Fl::grab()) ReleaseCapture();
} }
@@ -936,6 +951,7 @@ void Fl_X::make(Fl_Window* w)
int winclass = kDocumentWindowClass; int winclass = kDocumentWindowClass;
int winattr = kWindowCloseBoxAttribute int winattr = kWindowCloseBoxAttribute
| kWindowCollapseBoxAttribute | kWindowCollapseBoxAttribute
//| kWindowLiveResizeAttribute // activate this as soon as we ported to Carbon Events!
//| kWindowStandardHandlerAttribute //| kWindowStandardHandlerAttribute
; ;
// int winattr = kWindowStandardHandlerAttribute; // int winattr = kWindowStandardHandlerAttribute;
@@ -944,7 +960,9 @@ void Fl_X::make(Fl_Window* w)
int yp = w->y(); int yp = w->y();
int wp = w->w(); int wp = w->w();
int hp = w->h(); int hp = w->h();
if (!w->size_range_set) { if (w->size_range_set) {
winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute;
} else {
if (w->resizable()) { if (w->resizable()) {
Fl_Widget *o = w->resizable(); Fl_Widget *o = w->resizable();
int minw = o->w(); if (minw > 100) minw = 100; int minw = o->w(); if (minw > 100) minw = 100;
@@ -957,9 +975,28 @@ void Fl_X::make(Fl_Window* w)
} }
} }
int xwm = xp, ywm = yp, bt, bx, by; int xwm = xp, ywm = yp, bt, bx, by;
if (!fake_X_wm(w, xwm, ywm, bt, bx, by)) winclass = kFloatingWindowClass; // classes:
else if (w->modal()) winclass = kModalWindowClass; // kAlertWindowClass: small up frame - nice
else if (w->non_modal()) winclass = kToolbarWindowClass; // kModalWindowClass: as above
// kFloatingWindowClass: does not deactivate app window, but has small title bar (medium decoration)
// kDocumentWindowClass: transparent huge upper title (large decoration) -- last standard definition
// kUtilityWindowClass: like 'floating (small decoration)
// kHelpWindowClass: perfect: no decoration, keeps master active, stays on top of ALL windows, not modal though
// kSheetWindowClass: no deco, deactivates parent
// kToolbarWindowClass: no deco, passive, under other menues
// kPlainWindowClass: no deco, active, under
// kOverlayWindowClass: invisible!
// kSheetAlertWindowClass: no deco, active, under
// kAltPlainWindowClass: no deco, active, under
// attributes:
// kWindowCloseBoxAttribute, HorizontalZoom, VerticalZoom, FullZoom, CollapsBox, Resizable,
// SideTitlebar(floatin only), NoUpdates, NoActivates, Macros: StandardDocument, StandardFloating
if (!fake_X_wm(w, xwm, ywm, bt, bx, by))
{ winclass = kHelpWindowClass; winattr = 0; }
else if (w->modal())
winclass = kFloatingWindowClass; // basically fine, but not modal! The modal window however does nor show
else if (w->non_modal())
winclass = kFloatingWindowClass; // we need to call 'InitFloatingWindows for OS 8, 9
if (by+bt) { if (by+bt) {
//++ if (!w->non_modal()) style |= WS_SYSMENU | WS_MINIMIZEBOX; //++ if (!w->non_modal()) style |= WS_SYSMENU | WS_MINIMIZEBOX;
wp += 2*bx; wp += 2*bx;
@@ -1003,7 +1040,7 @@ void Fl_X::make(Fl_Window* w)
x->cursor = fl_default_cursor; x->cursor = fl_default_cursor;
x->xidChildren = 0; x->xidChildren = 0;
x->xidNext = 0; x->xidNext = 0;
CreateNewWindow(winclass, winattr, &wRect, &(x->xid)); CreateNewWindow( winclass, winattr, &wRect, &(x->xid) );
SetWTitle(x->xid, pTitle); SetWTitle(x->xid, pTitle);
x->w = w; w->i = x; x->w = w; w->i = x;
x->wait_for_expose = 1; x->wait_for_expose = 1;
@@ -1013,12 +1050,19 @@ void Fl_X::make(Fl_Window* w)
w->set_visible(); w->set_visible();
w->handle(FL_SHOW); w->handle(FL_SHOW);
w->redraw(); // force draw to happen w->redraw(); // force draw to happen
TransitionWindow( x->xid, kWindowZoomTransitionEffect, kWindowShowTransitionAction, 0 ); //TransitionWindow( x->xid, kWindowZoomTransitionEffect, kWindowShowTransitionAction, 0 );
ShowWindow( x->xid ); ShowWindow( x->xid );
fl_show_iconic = 0; fl_show_iconic = 0;
//++ hmmm, this should maybe set by the activate event?! //++ hmmm, this should maybe set by the activate event?!
Fl::handle(FL_FOCUS, w); Fl::handle(FL_FOCUS, w);
//++ if (w->modal()) { Fl::modal_ = w; fl_fix_focus(); } //++ if (w->modal()) { Fl::modal_ = w; fl_fix_focus(); }
if ( ! Fl_X::first->next ) // if this is the first window, we need to bring the application to the front
{
ProcessSerialNumber psn;
OSErr err = GetCurrentProcess( &psn );
if ( err==noErr ) SetFrontProcess( &psn );
// or 'BringToFront'
}
} }
} }
@@ -1102,8 +1146,8 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
MoveWindow(i->xid, X, Y, 0); MoveWindow(i->xid, X, Y, 0);
if (is_a_resize) { if (is_a_resize) {
SizeWindow(i->xid, W>0 ? W : 1, H>0 ? H : 1, 1); SizeWindow(i->xid, W>0 ? W : 1, H>0 ? H : 1, 1);
// Rect all; all.top=-32000; all.bottom=32000; all.left=-32000; all.right=32000; Rect all; all.top=-32000; all.bottom=32000; all.left=-32000; all.right=32000;
// InvalRect(&all); InvalWindowRect( i->xid, &all );
} }
} }
if (is_a_resize) { if (is_a_resize) {
@@ -1158,7 +1202,8 @@ void Fl_Window::make_current()
} }
fl_clip_region( 0 ); fl_clip_region( 0 );
CopyRgn( fl_window_region, GetPortClipRegion( GetWindowPort(i->xid), 0) ); // for Fl_GL_Window SetPortClipRegion( GetWindowPort(i->xid), fl_window_region );
//CopyRgn( fl_window_region, GetPortClipRegion( GetWindowPort(i->xid), 0) ); // for Fl_GL_Window
return; return;
} }
@@ -1223,6 +1268,6 @@ elapsedNanoseconds = AbsoluteToNanoseconds(elapsedTime);
*/ */
// //
// End of "$Id: Fl_mac.cxx,v 1.1.2.2 2001/12/04 03:03:17 matthiaswm Exp $". // End of "$Id: Fl_mac.cxx,v 1.1.2.3 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+13 -9
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_rect.cxx,v 1.10.2.4.2.3 2001/12/04 03:03:17 matthiaswm Exp $" // "$Id: fl_rect.cxx,v 1.10.2.4.2.4 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// Rectangle drawing routines for the Fast Light Tool Kit (FLTK). // Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
// //
@@ -340,9 +340,13 @@ void fl_restore_clip() {
SelectClipRgn(fl_gc, r); //if r is NULL, clip is automatically cleared SelectClipRgn(fl_gc, r); //if r is NULL, clip is automatically cleared
#elif defined(__APPLE__) #elif defined(__APPLE__)
# if 1 # if 1
CopyRgn( fl_window_region, GetPortClipRegion( GetWindowPort(fl_window), 0) ); // changed RgnHandle portClip = NewRgn();
GrafPtr port = GetWindowPort( fl_window );
CopyRgn( fl_window_region, portClip ); // changed
if ( r ) if ( r )
SectRgn( GetPortClipRegion( GetWindowPort(fl_window), 0), r, GetPortClipRegion( GetWindowPort(fl_window), 0) ); SectRgn( portClip, r, portClip );
SetPortClipRegion( port, portClip );
DisposeRgn( portClip );
# else # else
if (r) SetClip(r); if (r) SetClip(r);
else { else {
@@ -462,11 +466,11 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
RgnHandle rr = NewRgn(); RgnHandle rr = NewRgn();
SetRectRgn( rr, x, y, x+w, y+h ); SetRectRgn( rr, x, y, x+w, y+h );
SectRgn( r, rr, rr ); SectRgn( r, rr, rr );
Rect *rp = GetRegionBounds(rr, 0); Rect rp; GetRegionBounds(rr, &rp);
X = rp->left; X = rp.left;
Y = rp->top; Y = rp.top;
W = rp->right - X; W = rp.right - X;
H = rp->bottom - Y; H = rp.bottom - Y;
DisposeRgn( rr ); DisposeRgn( rr );
if ( H==0 ) return 2; if ( H==0 ) return 2;
if ( h==H && w==W ) return 0; if ( h==H && w==W ) return 0;
@@ -494,5 +498,5 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
} }
// //
// End of "$Id: fl_rect.cxx,v 1.10.2.4.2.3 2001/12/04 03:03:17 matthiaswm Exp $". // End of "$Id: fl_rect.cxx,v 1.10.2.4.2.4 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+12 -5
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fractals.cxx,v 1.5.2.6.2.1 2001/11/29 21:24:49 easysw Exp $" // "$Id: fractals.cxx,v 1.5.2.6.2.2 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// Fractal drawing demo for the Fast Light Tool Kit (FLTK). // Fractal drawing demo for the Fast Light Tool Kit (FLTK).
// //
@@ -62,7 +62,11 @@ int main(int, char**) {
*/ */
#include <FL/glut.H> #include <FL/glut.H>
#include <GL/glu.h> // added for fltk #ifdef __APPLE__
# include <OpenGL/glu.h>
#else
# include <GL/glu.h> // added for fltk
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -75,8 +79,11 @@ int main(int, char**) {
#include "fracviewer.c" // changed from .h for fltk #include "fracviewer.c" // changed from .h for fltk
#if defined(WIN32) || defined(__EMX__) #if defined(WIN32) || defined(__EMX__)
#define drand48() (((float) rand())/((float) RAND_MAX)) # define drand48() (((float) rand())/((float) RAND_MAX))
#define srand48(x) (srand((x))) # define srand48(x) (srand((x)))
#elif defined __APPLE__
# define drand48() (((float) rand())/((float) RAND_MAX))
# define srand48(x) (srand((x)))
#endif #endif
typedef enum { NOTALLOWED, MOUNTAIN, TREE, ISLAND, BIGMTN, STEM, LEAF, typedef enum { NOTALLOWED, MOUNTAIN, TREE, ISLAND, BIGMTN, STEM, LEAF,
@@ -806,5 +813,5 @@ int main(int argc, char** argv)
#endif #endif
// //
// End of "$Id: fractals.cxx,v 1.5.2.6.2.1 2001/11/29 21:24:49 easysw Exp $". // End of "$Id: fractals.cxx,v 1.5.2.6.2.2 2001/12/06 00:17:47 matthiaswm Exp $".
// //
+7 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: glpuzzle.cxx,v 1.8.2.5 2001/04/30 17:17:01 easysw Exp $" // "$Id: glpuzzle.cxx,v 1.8.2.5.2.1 2001/12/06 00:17:47 matthiaswm Exp $"
// //
// OpenGL puzzle demo for the Fast Light Tool Kit (FLTK). // OpenGL puzzle demo for the Fast Light Tool Kit (FLTK).
// //
@@ -45,7 +45,11 @@ int main(int, char**) {
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#include <FL/glut.H> // changed for fltk #include <FL/glut.H> // changed for fltk
#include <GL/glu.h> // added for fltk #ifdef __APPLE__
# include <OpenGL/glu.h>
#else
# include <GL/glu.h> // added for fltk
#endif
#include "trackball.c" // changed from trackball.h for fltk #include "trackball.c" // changed from trackball.h for fltk
#define WIDTH 4 #define WIDTH 4
@@ -1480,5 +1484,5 @@ main(int argc, char **argv)
#endif // added for fltk's distribution #endif // added for fltk's distribution
// //
// End of "$Id: glpuzzle.cxx,v 1.8.2.5 2001/04/30 17:17:01 easysw Exp $". // End of "$Id: glpuzzle.cxx,v 1.8.2.5.2.1 2001/12/06 00:17:47 matthiaswm Exp $".
// //