diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2002-01-03 08:08:21 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2002-01-03 08:08:21 +0000 |
| commit | 1775984dbea2b186a9cd7b5a8b697558028e7da9 (patch) | |
| tree | 432a4522d897897bceff31921e71060ae94fbf6f | |
| parent | 2283309d0349118ffbd8313dd4a898eeeda2df04 (diff) | |
cleaned up src/Fl_mac.cxx, fixed Fl::wait(0.0), fixed Cmd-Q handling
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1905 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | FL/mac.H | 20 | ||||
| -rw-r--r-- | README.mac | 5 | ||||
| -rw-r--r-- | src/Fl_Gl_Choice.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_Gl_Window.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_Image.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_Window_fullscreen.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_get_key_mac.cxx | 7 | ||||
| -rw-r--r-- | src/Fl_grab.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_mac.cxx | 875 | ||||
| -rw-r--r-- | src/Fl_visual.cxx | 6 | ||||
| -rw-r--r-- | src/fl_draw_image_mac.cxx | 94 | ||||
| -rw-r--r-- | src/fl_shortcut.cxx | 6 | ||||
| -rw-r--r-- | src/gl_draw.cxx | 7 | ||||
| -rw-r--r-- | src/gl_start.cxx | 6 |
15 files changed, 174 insertions, 888 deletions
@@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.0b9 + - MacOS: cleaned up src/Fl_mac.cxx + - MacOS: fixed Fl::wait(0.0), fixed Cmd-Q handling - Update CygWin support for Fl::add_fd(). - Update the plastic scheme to not override the default colors - move the color code to the MacOS-specific @@ -1,5 +1,5 @@ // -// "$Id: mac.H,v 1.1.2.4 2002/01/01 15:11:28 easysw Exp $" +// "$Id: mac.H,v 1.1.2.5 2002/01/03 08:08:21 matthiaswm Exp $" // // Mac header file for the Fast Light Tool Kit (FLTK). // @@ -63,23 +63,19 @@ inline void XDestroyRegion(Fl_Region r) { class Fl_X { public: - Window xid; // Mac WindowPtr - GWorldPtr other_xid; // pointer for offscreen bitmaps (doublebuffer) - Fl_Window *w; // FLTK window for + Window xid; // Mac WindowPtr + GWorldPtr other_xid; // pointer for offscreen bitmaps (doublebuffer) + Fl_Window *w; // FLTK window for Fl_Region region; - Fl_Region subRegion; // region for this specific subwindow - Fl_X *next; - Fl_X *xidChildren, *xidNext; + Fl_Region subRegion; // region for this specific subwindow + Fl_X *next; // linked tree to support subwindows + Fl_X *xidChildren, *xidNext; // more subwindow tree int wait_for_expose; - //+ int backbuffer_bad; CursHandle cursor; static Fl_X* first; static Fl_X* i(const Fl_Window* w) {return w->i;} static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&); static void make(Fl_Window*); - static void MacGrowWindow(WindowPtr xid, const EventRecord &macevent); - static void MacDragWindow(WindowPtr xid, const EventRecord &macevent); - static int MacModifiers(const EventRecord &macevent, unsigned short prev); void flush(); }; @@ -120,6 +116,6 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) #endif // !FL_MAC_H // -// End of "$Id: mac.H,v 1.1.2.4 2002/01/01 15:11:28 easysw Exp $". +// End of "$Id: mac.H,v 1.1.2.5 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/README.mac b/README.mac index 60c32ee8b..bad08882e 100644 --- a/README.mac +++ b/README.mac @@ -93,6 +93,7 @@ KNOWN MacFLTK BUGS - Image transparency is not implemented. - The 'shiny' demo needs work (flush/aglFlush). - Threads are not implemented. + - OpenGL subwindow during window resize changes position TEST SUITE STATUS @@ -127,14 +128,14 @@ OTHER STUFF Under MacOS X, all windows are double-buffered. Using Fl_Window has the same effect as using Fl_Double_Window on - other operating systems. However Fl_Overlay_Window uses one + other operating systems. Fl_Overlay_Window however uses one additional buffer for the overlay plane. FLTK 1.0.X FOR MAC FLTK 1.0.6 for MacOS 8.x and OS 9.x is in beta stage and can - be downloaded from http://www.matthiasm.com/fltk/mac.shtml. + be downloaded from http://www.matthiasm.com/flMac.html . The archive contains build files for Metrowerks CodeWarrior 5 and 6. diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx index fd5082f01..1e0728e66 100644 --- a/src/Fl_Gl_Choice.cxx +++ b/src/Fl_Gl_Choice.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.7 2002/01/01 15:11:30 easysw Exp $" +// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.8 2002/01/03 08:08:21 matthiaswm Exp $" // // OpenGL visual selection code for the Fast Light Tool Kit (FLTK). // @@ -271,7 +271,7 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) { aglSetInteger( context, AGL_BUFFER_RECT, rect ); aglEnable( context, AGL_BUFFER_RECT ); } - aglSetDrawable(context, GetWindowPort( fl_xid(w) ) ); //++ Matt: this probably belongs only in create_gl_context + aglSetDrawable(context, GetWindowPort( fl_xid(w) ) ); aglSetCurrentContext(context); #else glXMakeCurrent(fl_display, fl_xid(w), context); @@ -309,5 +309,5 @@ void fl_delete_gl_context(GLContext context) { #endif // -// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.7 2002/01/01 15:11:30 easysw Exp $". +// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.8 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index 2df7c5639..69cca3aff 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.8 2002/01/01 15:11:30 easysw Exp $" +// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.9 2002/01/03 08:08:21 matthiaswm Exp $" // // OpenGL window code for the Fast Light Tool Kit (FLTK). // @@ -172,8 +172,8 @@ void Fl_Gl_Window::flush() { uchar save_valid = valid_; #ifdef __APPLE__ - // matt: I have no idea hw expensive the following code is, but we need to reset the buffer rect after - // every window-reconfiguration, especially after window resizes. + // \todo Mac : matt: I have no idea how expensive the following code is, but we need to reset the buffer rect after + // every window-reconfiguration, especially after window resizes. aglUpdateContext(ctxt) may help here! if ( parent() ) { //: resize our GL buffer rectangle Rect wrect; GetWindowPortBounds( fl_xid(this), &wrect ); GLint rect[] = { x(), wrect.bottom-h()-y(), w(), h() }; @@ -313,7 +313,7 @@ void Fl_Gl_Window::resize(int X,int Y,int W,int H) { if (W != w() || H != h()) { valid(0); #ifdef __APPLE__ - if ( parent() ) { //: resize our GL buffer rectangle + if ( parent() ) { //: resize our GL buffer rectangle (see aglUpdateContext() Rect wrect; GetWindowPortBounds( fl_xid(this), &wrect ); GLint rect[] = { X, wrect.bottom-h()-y(), W, H }; aglSetInteger( context_, AGL_BUFFER_RECT, rect ); @@ -368,5 +368,5 @@ void Fl_Gl_Window::draw_overlay() {} #endif // -// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.8 2002/01/01 15:11:30 easysw Exp $". +// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.9 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index 584cb8428..785b5d86d 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Image.cxx,v 1.5.2.3.2.13 2002/01/01 15:11:30 easysw Exp $" +// "$Id: Fl_Image.cxx,v 1.5.2.3.2.14 2002/01/03 08:08:21 matthiaswm Exp $" // // Image drawing code for the Fast Light Tool Kit (FLTK). // @@ -345,7 +345,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) { fl_copy_offscreen(X, Y, W, H, id, cx, cy); } #elif defined(__APPLE__) - //+ Need to implement masking/alpha blend!!! + // \todo Mac : alpha blending not yet implemented fl_copy_offscreen(X, Y, W, H, id, cx, cy); #else if (mask) { @@ -378,5 +378,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) { // -// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.13 2002/01/01 15:11:30 easysw Exp $". +// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.14 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/Fl_Window_fullscreen.cxx b/src/Fl_Window_fullscreen.cxx index 2c5531a1d..380c73ee7 100644 --- a/src/Fl_Window_fullscreen.cxx +++ b/src/Fl_Window_fullscreen.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.3 2002/01/01 15:11:31 easysw Exp $" +// "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.4 2002/01/03 08:08:21 matthiaswm Exp $" // // Fullscreen window support for the Fast Light Tool Kit (FLTK). // @@ -48,7 +48,7 @@ void Fl_Window::border(int b) { // not yet implemented, but it's possible // for full fullscreen we have to make the window topmost as well #elif defined(__APPLE__) - //++ Matt: I have not looked into this yet + // \todo Mac : not yet implemeted #else if (shown()) Fl_X::i(this)->sendxjunk(); #endif @@ -73,5 +73,5 @@ void Fl_Window::fullscreen_off(int X,int Y,int W,int H) { } // -// End of "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.3 2002/01/01 15:11:31 easysw Exp $". +// End of "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.4 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/Fl_get_key_mac.cxx b/src/Fl_get_key_mac.cxx index 2abdc1f2e..3c59816cb 100644 --- a/src/Fl_get_key_mac.cxx +++ b/src/Fl_get_key_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_get_key_mac.cxx,v 1.1.2.3 2002/01/01 15:11:31 easysw Exp $" +// "$Id: Fl_get_key_mac.cxx,v 1.1.2.4 2002/01/03 08:08:21 matthiaswm Exp $" // // MacOS keyboard state routines for the Fast Light Tool Kit (FLTK). // @@ -77,8 +77,7 @@ static int fltk2mac(int fltk) { //: returns true, if that key was pressed during the last event int Fl::event_key(int k) { -//++ return GetKeyState(fltk2mac(k))&~1; - return get_key(k); //++ find a faster way?! + return get_key(k); } #include <stdio.h> @@ -100,5 +99,5 @@ int Fl::get_key(int k) { } // -// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.3 2002/01/01 15:11:31 easysw Exp $". +// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.4 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/Fl_grab.cxx b/src/Fl_grab.cxx index 470f63314..3c4ef60ef 100644 --- a/src/Fl_grab.cxx +++ b/src/Fl_grab.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_grab.cxx,v 1.1.2.4.2.5 2002/01/01 15:11:31 easysw Exp $" +// "$Id: Fl_grab.cxx,v 1.1.2.4.2.6 2002/01/03 08:08:21 matthiaswm Exp $" // // Grab/release code for the Fast Light Tool Kit (FLTK). // @@ -56,7 +56,6 @@ void Fl::grab(Fl_Window* w) { SetActiveWindow(fl_capture = fl_xid(first_window())); SetCapture(fl_capture); #elif defined(__APPLE__) -// BeginAppModalStateForWindow( fl_xid(first_window()) ); //+ please check if we need this (sample app?) fl_capture = fl_xid( first_window() ); SetUserFocusWindow( fl_capture ); #else @@ -85,7 +84,6 @@ void Fl::grab(Fl_Window* w) { fl_capture = 0; ReleaseCapture(); #elif defined(__APPLE__) -// EndAppModalStateForWindow( fl_xid(first_window()) ); //+ Please check if we need this fl_capture = 0; SetUserFocusWindow( (WindowRef)kUserFocusAuto ); #else @@ -102,5 +100,5 @@ void Fl::grab(Fl_Window* w) { } // -// End of "$Id: Fl_grab.cxx,v 1.1.2.4.2.5 2002/01/01 15:11:31 easysw Exp $". +// End of "$Id: Fl_grab.cxx,v 1.1.2.4.2.6 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index bbf19317c..ad96c7f4c 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_mac.cxx,v 1.1.2.11 2002/01/01 15:11:31 easysw Exp $" +// "$Id: Fl_mac.cxx,v 1.1.2.12 2002/01/03 08:08:21 matthiaswm Exp $" // // MacOS specific code for the Fast Light Tool Kit (FLTK). // @@ -23,20 +23,18 @@ // Please report all bugs and problems to "fltk-bugs@fltk.org". // -/** - * From the inner edge of a MetroWerks CodeWarrior CD: - * (without permission) - * - * Three Compiles for 68Ks under the sky, - * Seven Compiles for PPCs in their fragments of code, - * Nine Compiles for Mortal Carbon doomed to die, - * One Compile for Mach-O Cocoa on its Mach-O throne, - * in the Land of MacOS X where the Drop-Shadows lie. - * - * One Compile to link them all, One Compile to merge them, - * One Compile to copy them all and in the bundle bind them, - * in the Land of MacOS X where the Drop-Shadows lie. - */ +//// From the inner edge of a MetroWerks CodeWarrior CD: +// (without permission) +// +// Three Compiles for 68Ks under the sky, +// Seven Compiles for PPCs in their fragments of code, +// Nine Compiles for Mortal Carbon doomed to die, +// One Compile for Mach-O Cocoa on its Mach-O throne, +// in the Land of MacOS X where the Drop-Shadows lie. +// +// One Compile to link them all, One Compile to merge them, +// One Compile to copy them all and in the bundle bind them, +// in the Land of MacOS X where the Drop-Shadows lie. // we don't need the following definition because we deliver only @@ -55,87 +53,44 @@ #include <string.h> #include <unistd.h> -#ifdef TARGET_API_MAC_CARBON -// use the above define if you want to use full Carbon API -// - this will change event handling to Carbon Events -#endif +// external functions +extern Fl_Window* fl_find(Window); +extern void fl_fix_focus(); -static unsigned short macKeyLookUp[]; -static Fl_Window* resize_from_system; -Fl_Window* fl_find(Window); +// forward definition of functions in this file +static void handleUpdateEvent( WindowPtr xid ); int fl_handle(const EventRecord &event); -void handleUpdateEvent( WindowPtr xid ); -extern void fl_fix_focus(); +// public variables int fl_screen; Handle fl_system_menu; Fl_Sys_Menu_Bar *fl_sys_menu_bar = 0; CursHandle fl_default_cursor; +WindowRef fl_capture = 0; // we need this to compensate for a missing(?) mouse capture +ulong fl_event_time; // the last timestamp from an x event +char fl_key_vector[32]; // used by Fl::get_key() +bool fl_show_iconic; // true if called from iconize() - shows the next created window in collapsed state +int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR +const Fl_Window* fl_modal_for; // parent of modal() window +Fl_Region fl_window_region = 0; +Window fl_window; +Fl_Window *Fl_Window::current_; + +// forward declarations of variables in this file +static unsigned short macKeyLookUp[]; +static Fl_Window* resize_from_system; static CursPtr default_cursor_ptr; static Cursor default_cursor; +static WindowRef fl_os_capture = 0; // the dispatch handler will redirect mose move and drag events to these windows #if CONSOLIDATE_MOTION static Fl_Window* send_motion; extern Fl_Window* fl_xmousewin; #endif -/** - * we need these as temporary regions for correct subwindow clipping - */ -static RgnHandle flmFullRgn = 0L, flmSubRgn = 0L; -static Window flmFullXid = 0; -static SysEnvRec MacWorld; - - -/** - * Performance timer start - * - not finished, don't use - */ -static UnsignedWide _perfStart; -static void _startPerf() -{ - Microseconds( &_perfStart ); -} +enum { kEventClassFLTK = 'fltk' }; +enum { kEventFLTKBreakLoop = 1 }; -/** - * Performance timer end - * - not finished, don't use - */ -static unsigned int _endPerf() -{ - UnsignedWide _perfEnd; - Microseconds( &_perfEnd ); - // display the difference somehow - probably averaged - // if (msStart.hi==msEnd.hi) - // s1->value( (msEnd.lo-msStart.lo)/100.0 ); - - // get delta: - if ( _perfEnd.lo >= _perfStart.lo ) - _perfEnd.hi = _perfEnd.hi - _perfStart.hi; - else - _perfEnd.hi = (_perfEnd.hi - 1) - _perfStart.hi; - _perfEnd.lo = _perfEnd.lo - _perfStart.lo; - - // convert to double in micro seconds - -// static double kTwoPower32 = 4294967296.0; -// double t = (((double) _perfEnd.hi) * kTwoPower32) + _perfEnd.lo; -// UpTime(); -/* -AbsoluteTime startTime; -AbsoluteTime endTime; -AbsoluteTime elapsedTime; -Nanoseconds elapsedNanoseconds; // This is an UnsignedWide integer - -startTime = UpTime(); -DoMyOperation(); -endTime = UpTime(); -elapsedTime = SubAbsoluteFromAbsolute(endTime, startTime); -elapsedNanoseconds = AbsoluteToNanoseconds(elapsedTime); -*/ - return 0; -} - /** * \todo This funtion is not yet implemented! @@ -189,24 +144,12 @@ 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 ); -} - - - -WindowRef fl_capture = 0; // we need this to compensate for a missing(?) mouse capture -WindowRef fl_os_capture = 0; // the dispatch handler will redirect mose move and drag events to these windows - -/** * We can make every event pass through this function * - mouse events need to be manipulated to use a mouse focus window * - keyboard, mouse and some window events need to quit the Apple Event Loop * so FLTK can continue its own management */ -pascal OSStatus carbonDispatchHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) +static pascal OSStatus carbonDispatchHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) { OSStatus ret = eventNotHandledErr; switch ( GetEventClass( event ) ) @@ -224,6 +167,13 @@ pascal OSStatus carbonDispatchHandler( EventHandlerCallRef nextHandler, EventRef break; } break; + case kEventClassFLTK: + switch ( GetEventKind( event ) ) + { + case kEventFLTKBreakLoop: + ret = noErr; + break; + } } if ( ret == eventNotHandledErr ) ret = CallNextEventHandler( nextHandler, event ); // let the OS handle the activation, but continue to get a click-through effect @@ -231,6 +181,7 @@ pascal OSStatus carbonDispatchHandler( EventHandlerCallRef nextHandler, EventRef return ret; } + /** * this callback simply quits the main event loop handler, so FLTK can do its magic */ @@ -239,6 +190,7 @@ static void timerProcCB( EventLoopTimerRef, void* ) QuitApplicationEventLoop(); } + /** * This function iss the central event handler. * It reads events from the event queue using the given maximum time @@ -249,39 +201,16 @@ static double do_queued_events( double time = 0.0 ) static bool been_here = 0; static RgnHandle rgn; - // initialize events and a region that enables mouse move events + // initialize events and a region that enables mouse move events if (!been_here) { rgn = NewRgn(); Point mp; GetMouse(&mp); SetRectRgn(rgn, mp.h, mp.v, mp.h, mp.v); SetEventMask(everyEvent); - //++ SystemEventMask ( MouseUp ) been_here = 1; } -#ifdef STRICTLY_CARBON - EventRef ev; - //static int evn = 0, evnn = 0; - //printf( "do events %d %g\n", evn++, time ); - //if (time>0.1) time=0.1; - time = 0.1; // TODO: cheat - for (;;) - { - OSStatus status = ReceiveNextEvent(0, NULL, time, true, &ev); - if ( status==eventLoopTimedOutErr ) - break; - // TODO: status is 'eventLoopTimedOutErr' if we didn't receive an event in time - // It is (against previous documentation) 0 whenever we receive an event - //printf( " status 0x%08x\n", status ); - //printf( " events %d\n", evnn++ ); - //if ( status!=0 ) break; - fl_handle(ev); //: handle the nullEvent to get mouse up events - break; // TODO: cheat -// SetRectRgn(rgn, ev.where.h, ev.where.v, ev.where.h+1, ev.where.v+1 ); - } -#elif defined(TARGET_API_MAC_CARBON) OSStatus ret; - EventRef ev; static EventTargetRef target = 0; static EventLoopTimerRef timer = 0; if ( !target ) @@ -303,40 +232,24 @@ static double do_queued_events( double time = 0.0 ) { kEventClassMouse, kEventMouseUp }, { kEventClassMouse, kEventMouseMoved }, { kEventClassMouse, kEventMouseWheelMoved }, - { kEventClassMouse, kEventMouseDragged } }; - ret = InstallEventHandler( target, dispatchHandler, 14, dispatchEvents, 0, 0L ); + { kEventClassMouse, kEventMouseDragged }, + { kEventClassFLTK, kEventFLTKBreakLoop } }; + ret = InstallEventHandler( target, dispatchHandler, 15, dispatchEvents, 0, 0L ); ret = InstallEventLoopTimer( GetMainEventLoop(), 0, 0, NewEventLoopTimerUPP( timerProcCB ), 0, &timer ); } - - // InstallEventLoopTimer(); SetEventLoopNextFireTime(); if ( time > 0.0 ) - SetEventLoopTimerNextFireTime( timer, time ); - RunApplicationEventLoop(); - // ;;;; printf("Left Event Loop!\n"); - //RunCurrentEventLoop(0.1); - /* - ret = ReceiveNextEvent( 0, NULL, time, true, &ev ); - if ( ret == noErr ) { - ret = SendEventToEventTarget( ev, target ); - if ( ret == eventNotHandledErr ) - { - EventRecord er; - if ( ConvertEventRefToEventRecord( ev, &er ) ) - fl_handle( er ); - } - ReleaseEvent( ev ); + SetEventLoopTimerNextFireTime( timer, time ); + RunApplicationEventLoop(); // wil return after the previously set time } - */ -#else - EventRecord ev; - unsigned long ticks = (int)(time*60.0); // setting ticks to 7fffffff will wait forever - if ( WaitNextEvent(everyEvent, &ev, ticks, rgn) ) + else { - 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 ); + EventRef breakEvent; + CreateEvent( 0, kEventClassFLTK, kEventFLTKBreakLoop, 0, kEventAttributeUserEvent, &breakEvent ); + PostEventToQueue( GetCurrentEventQueue(), breakEvent, kEventPriorityStandard ); + RunApplicationEventLoop(); + ReleaseEvent( breakEvent ); } -#endif #if CONSOLIDATE_MOTION if (send_motion && send_motion == fl_xmousewin) { @@ -353,7 +266,7 @@ static double do_queued_events( double time = 0.0 ) * 'time' secods for an event. It returns the same time that was given * in the argument! * - * \TODO: there is no socket handling in this code whatsoever + * \todo there is no socket handling in this code whatsoever */ double fl_wait( double time ) { @@ -362,82 +275,27 @@ double fl_wait( double time ) /** - * \todo not yet implemented! - */ -static void fd_callback(int,void *) -{ - do_queued_events(); -} - - -/** - * Handle the mac typical topline menubar + * event handler for Apple-Q key combination + * this is also called from the Carbon Window handler after all windows were closed */ -static void HandleMenu( long mResult ) -{ - short item, menu ; - MenuHandle mHandle ; -// Str255 itemName; - UInt32 ref; - - item = LoWord( mResult ) ; - menu = HiWord( mResult ) ; - mHandle = GetMenuHandle( menu ) ; - - switch (menu) - { - case 0: - break; - case 1: // Apple (this menu should be defined in the resource of your application) -// GetMenuItemText( GetMenuHandle( 1 ), item, itemName ); -// OpenDeskAcc( itemName ); - break; - default: - if ( !item ) break; - GetMenuItemRefCon( mHandle, item, &ref ); - if ( ref && fl_sys_menu_bar ) - { - Fl_Menu_Item *m = (Fl_Menu_Item*)ref; - fl_sys_menu_bar->picked( m ); - if ( m->flags & FL_MENU_TOGGLE ) - SetItemMark( mHandle, item, ( m->flags & FL_MENU_VALUE ) ? 0x12 : 0 ); - if ( m->flags & FL_MENU_RADIO ) - { - Fl_Menu_Item* j = m; - int i = item; - for (;;) { - if (j->flags & FL_MENU_DIVIDER) break; // stop on divider lines - j++; i++; - if (!j->text || !j->radio()) break; // stop after group - SetItemMark( mHandle, i, ( j->flags & FL_MENU_VALUE ) ? 0x13 : 0 ); - } - j = m-1; i = item-1; - for (;i>0;j--,i--) { - if (!j->text || (j->flags&FL_MENU_DIVIDER) || !j->radio()) break; - SetItemMark( mHandle, i, ( j->flags & FL_MENU_VALUE ) ? 0x13 : 0 ); - } - SetItemMark( mHandle, item, ( m->flags & FL_MENU_VALUE ) ? 0x13 : 0 ); - } - } - } - HiliteMenu( 0 ); -} - static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon ) { - // call 'close' for every window. If any window returns unclosed, don't exit to the shell! - // Fl::handle(FL_CLOSE, fl_find(xid)); - ExitToShell(); - return noErr; + while ( Fl_X::first ) { + Fl_X *x = Fl_X::first; + Fl::handle( FL_CLOSE, x->w ); + if ( Fl_X::first == x ) + return noErr; // FLTK has not close all windows, so we return to the main program now + } + ExitToShell(); + return noErr; } -// { kEventClassWindow, kEventWindowDrawContent } }; /** * Carbon Window handler * This needs to be linked into all new window event handlers */ -pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) +static pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) { UInt32 kind = GetEventKind( event ); OSStatus ret = eventNotHandledErr; @@ -468,11 +326,9 @@ pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, EventRef e } break; } case kEventWindowShown: - // ;;;; printf("Show %s\n", window->label()); if ( !window->parent() ) Fl::handle( FL_SHOW, window); break; case kEventWindowHidden: - // ;;;; printf("Hide %s\n", window->label()); if ( !window->parent() ) Fl::handle( FL_HIDE, window); break; case kEventWindowActivated: @@ -482,7 +338,6 @@ pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, EventRef e if ( winClass != kHelpWindowClass ) { // help windows can't get the focus! Fl::handle( FL_FOCUS, window); activeWindow = window; - // ;;;; printf("Activate %s\n", window->label()); } } break; @@ -491,12 +346,11 @@ pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, EventRef e { Fl::handle( FL_UNFOCUS, window); activeWindow = 0; - // ;;;; printf("Deactivate %s\n", window->label()); } break; case kEventWindowClose: Fl::handle( FL_CLOSE, window ); // this might or might not close the window - // if there are no more windows, send a high-level quit event + // if there are no more windows, send a high-level quit event if (!Fl_X::first) QuitAppleEventHandler( 0, 0, 0 ); ret = noErr; // returning noErr tells Carbon to stop following up on this event break; @@ -510,7 +364,7 @@ pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, EventRef e * Carbon Mousewheel handler * This needs to be linked into all new window event handlers */ -pascal OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) +static pascal OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) { Fl_Window *window = (Fl_Window*)userData; EventMouseWheelAxis axis; @@ -531,6 +385,7 @@ pascal OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, EventR return noErr; } + /** * convert the current mouse chord into the FLTK modifier state */ @@ -544,10 +399,11 @@ static void chord_to_e_state( UInt32 chord ) Fl::e_state = ( Fl::e_state & 0xff0000 ) | state[ chord & 0x07 ]; } + /** * Carbon Mouse Button Handler */ -pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) +static pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData ) { static int keysym[] = { 0, FL_Button+1, FL_Button+3, FL_Button+2 }; static int px, py; @@ -565,7 +421,6 @@ pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, EventRef ev switch ( GetEventKind( event ) ) { case kEventMouseDown: - // ;;;; printf("Carb-win-hdlr: mouse down (x:%d, y:d)\n", pos.h, pos.v ); part = FindWindow( pos, &tempXid ); if ( part != inContent ) return CallNextEventHandler( nextHandler, event ); // let the OS handle this for us @@ -578,7 +433,6 @@ pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, EventRef ev Fl::e_clicks = clickCount-1; // fall through case kEventMouseUp: - // ;;;; if ( !sendEvent ) printf("Carb-win-hdlr: mouse up (x:%d, y:d)\n", pos.h, pos.v ); if ( !window ) break; if ( !sendEvent ) { sendEvent = FL_RELEASE; @@ -586,32 +440,34 @@ pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, EventRef ev Fl::e_keysym = keysym[ btn ]; // fall through case kEventMouseMoved: - // ;;;; if ( !sendEvent ) printf("Carb-win-hdlr: mouse moved (x:%d, y:d)\n", pos.h, pos.v ); if ( !sendEvent ) { sendEvent = FL_MOVE; chord = 0; } // fall through case kEventMouseDragged: - // ;;;; if ( !sendEvent ) printf("Carb-win-hdlr: mouse dragged (x:%d, y:d)\n", pos.h, pos.v ); if ( !sendEvent ) { sendEvent = FL_DRAG; if (abs(pos.h-px)>5 || abs(pos.v-py)>5) Fl::e_is_click = 0; } chord_to_e_state( chord ); - SetPort( GetWindowPort(xid) ); //++ remove this! There must be some GlobalToLocal call that has a port as an argument + GrafPtr oldPort; + GetPort( &oldPort ); + SetPort( GetWindowPort(xid) ); // \todo replace this! There must be some GlobalToLocal call that has a port as an argument SetOrigin(0, 0); Fl::e_x_root = pos.h; Fl::e_y_root = pos.v; GlobalToLocal( &pos ); Fl::e_x = pos.h; Fl::e_y = pos.v; + SetPort( oldPort ); Fl::handle( sendEvent, window ); break; } return noErr; } + /** * convert the current mouse chord into the FLTK modifier state */ @@ -628,6 +484,7 @@ static void mods_to_e_state( UInt32 mods ) //printf( "State 0x%08x (%04x)\n", Fl::e_state, mods ); } + /** * convert the current mouse chord into the FLTK keysym */ @@ -645,6 +502,7 @@ static void mods_to_e_keysym( UInt32 mods ) else Fl::e_keysym = 0; } + /** * handle carbon keyboard events */ @@ -662,7 +520,7 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef unsigned char key; GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key ); unsigned short sym; - // ;;;; printf( "kb: %08x %08x %02x %04x %04x\n", mods, keyCode, key, GetEventKind( event ), macKeyLookUp[ keyCode & 0x7f ] ); + switch ( GetEventKind( event ) ) { case kEventRawKeyDown: @@ -682,7 +540,7 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef Fl::e_length = 0; } Fl::e_text = buffer; - // insert UnicodeHandling right here! + // insert UnicodeHandling here! break; case kEventRawKeyModifiersChanged: { UInt32 tMods = prevMods ^ mods; @@ -700,10 +558,10 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef } while (window->parent()) window = window->window(); if (sendEvent && Fl::handle(sendEvent,window)) return noErr; // return noErr if FLTK handled the event - //return noErr; // for testing return CallNextEventHandler( nextHandler, event );; } + /** * initialize the Mac toolboxes and set the default menubar */ @@ -711,57 +569,19 @@ void fl_open_display() { static char beenHereDoneThat = 0; if ( !beenHereDoneThat ) { beenHereDoneThat = 1; - - //++ open all macintosh services -// InitGraf(&qd.thePort); /* init Quickdraw and global variables */ -// InitFonts(); -// InitWindows(); -// InitMenus(); -// InitCursor(); -// TEInit(); - FlushEvents(everyEvent, 0); -// InitDialogs( nil ); - - MoreMasters(); -// MaxApplZone(); -// SysEnvirons( 1, &MacWorld ); - // this thing call the quit-app function which in turn either quits our app or calls 'close' on all windows?! - // (don't know which one would be better) + FlushEvents(everyEvent,0); + + MoreMasters(); // \todo Carbon suggests MoreMasterPointers() AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false ); - // OK, this is just ridiculous... + // create the Mac Handle for the default cursor (a pointer to a pointer) GetQDGlobalsArrow(&default_cursor); default_cursor_ptr = &default_cursor; fl_default_cursor = &default_cursor_ptr; - - FlushEvents(everyEvent,0); - - flmFullRgn = NewRgn(); // here we remember our overall damage - flmSubRgn = NewRgn(); // used to clip subwindows out of the parent windows redraw - // create a minimal menu bar (\todo "about app", "FLTK settings") - // Any FLTK application may replace this menu later with its own bar. -#if 0 - fl_system_menu = GetNewMBar( 128 ); - if ( fl_system_menu ) { - SetMenuBar( fl_system_menu ); - /* This is used to remove the Quit menu item from the File Drop Down in 'normal' Mac Apps - err = Gestalt(gestaltMenuMgrAttr, &response); - if ((err == noErr) && (response & gestaltMenuMgrAquaLayoutMask)) - { - menu = GetMenuHandle( mFile ); - DeleteMenuItem( menu, iQuit ); - DeleteMenuItem( menu, iQuitSeparator ); - } - */ - AppendResMenu( GetMenuHandle( 1 ), 'DRVR' ); - } -#else ClearMenuBar(); AppendResMenu( GetMenuHandle( 1 ), 'DRVR' ); -#endif // 0 - DrawMenuBar(); } } @@ -771,9 +591,6 @@ void fl_open_display() { * get rid of allocated resources */ void fl_close_display() { - DisposeRgn( flmFullRgn ); - DisposeRgn( flmSubRgn ); - //++ close all mac services } @@ -793,7 +610,7 @@ int Fl::x() { int Fl::y() { BitMap r; GetQDGlobalsScreenBits(&r); - return r.bounds.top + 20; // 20 pixel menu bar? + return r.bounds.top + 20; // \todo 20 pixel menu bar? } @@ -831,53 +648,6 @@ void Fl::get_mouse(int &x, int &y) } -/************************** event conversion stuff ***********************/ - -const EventRecord* fl_macevent; // the current mac event -ulong fl_event_time; // the last timestamp from an x event -char fl_key_vector[32]; // used by Fl::get_key() - -// Record event mouse position and state from an XEvent: - -static int px, py; -static ulong ptime; - -/** - * convert Mac modifiers to FLTK - */ -static void set_shift_states(const EventRecord &macevent) -{ - ulong state = Fl::e_state & 0xff000000; - if (macevent.modifiers&shiftKey) state |= FL_SHIFT; - 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&cmdKey) state |= FL_CTRL; - if (macevent.modifiers&alphaLock) state |= FL_CAPS_LOCK; - state |= FL_NUM_LOCK; //++ always num keypad on Mac? - No, use Fn-F5 on iBooks and NumLock on regular keyboards - Fl::e_state = state; -} - -/** - * set the FLTK mouse status variables - */ -static void set_event_xy(const EventRecord &macevent) -{ -#if CONSOLIDATE_MOTION - send_motion = 0; -#endif - Fl::e_x_root = macevent.where.h; - Fl::e_y_root = macevent.where.v; - Point g = macevent.where; - GlobalToLocal(&g); - Fl::e_x = g.h; - Fl::e_y = g.v; - if (macevent.what!=osEvt) set_shift_states(macevent); - fl_event_time = macevent.when; - if (abs(Fl::e_x_root-px)+abs(Fl::e_y_root-py) > 3 - || fl_event_time >= ptime+GetDblTime()) - Fl::e_is_click = 0; -} - /** * Mac keyboard lookup table */ @@ -921,94 +691,13 @@ unsigned short mac2fltk(ulong macKey) /** - * handle double and triple clicks - */ -static inline void checkdouble() -{ - if (Fl::e_is_click == Fl::e_keysym) - Fl::e_clicks++; - else { - Fl::e_clicks = 0; - Fl::e_is_click = Fl::e_keysym; - } - px = Fl::e_x_root; - py = Fl::e_y_root; - ptime = fl_event_time; -} - - - -/** - * user is in the process of resizing the window - */ -void Fl_X::MacGrowWindow(WindowPtr xid, const EventRecord &macevent) -{ - Fl_Window *win = fl_find(xid); - if (!win) return; - while ( win->window() ) win = (Fl_Window*)win->window(); - Rect limit; - limit.top = win->minh; limit.left = win->minw; - limit.bottom = win->maxh?win->maxh:Fl::h(); limit.right = win->maxw?win->maxw:Fl::w(); - unsigned int grow = GrowWindow(xid, macevent.where, &limit); - if (grow==0) return; - win->resize(win->x(), win->y(), grow&0xffff, grow>>16); -} - - -/** - * user is in the process of resizing the window - */ -void Fl_X::MacDragWindow(WindowPtr xid, const EventRecord &macevent) -{ - // copied from a Carbon sample file - Rect tempRect; - GetRegionBounds(GetGrayRgn(), &tempRect); - DragWindow(xid, macevent.where, &tempRect); - /* - BitMap bm; - GetQDGlobalsScreenBits(&bm); - DragWindow(xid, macevent.where, &(bm.bounds)); - */ - Fl_Window *win = fl_find(xid); - if (!win) return; - Point pt; pt.h = 0; pt.v = 0; - SetPort( GetWindowPort(xid) ); SetOrigin(0, 0); LocalToGlobal(&pt); - win->resize( pt.h, pt.v, win->w(), win->h() ); - //++ win->x(pt.h); win->y(pt.v); -} - - -//++ actually this function should be part of 'set_shift_states' -//++ because pressing down SHIFT, then another key while the event queue is full -//++ while actually generate the SHIFT event AFTER the key event! -//++ (at least no events are lost in the process) -int Fl_X::MacModifiers(const EventRecord &macevent, unsigned short prev) -{ - Fl_Window *window = fl_find(FrontWindow()); - if (!window) return 0; - Fl::e_length = 0; - unsigned short now = macevent.modifiers; - set_shift_states(macevent); //++ will 'break' if multiple keys are released between 0 events - unsigned short m = now^prev; - if (m&cmdKey && now&cmdKey) { Fl::e_keysym = FL_Control_L; Fl::handle(FL_KEYBOARD, window); } - if (m&shiftKey && now&shiftKey) { Fl::e_keysym = FL_Shift_L; Fl::handle(FL_KEYBOARD, window); } - if (m&optionKey && now&optionKey) { Fl::e_keysym = FL_Alt_L; Fl::handle(FL_KEYBOARD, window); } - if ( ((m&controlKey)&&(m&btnState)) && ((now&controlKey)&&(now&btnState)) ) { Fl::e_keysym = FL_Meta_L; Fl::handle(FL_KEYBOARD, window); } - //: caps lock generates keyboard event only on key-down - if (m&alphaLock) { Fl::e_keysym = FL_Caps_Lock; Fl::handle(FL_KEYBOARD, window); } - return 1; -} - - -/** * Initialize the given port for redraw and call the windw's flush() to actually draw the content */ void Fl_X::flush() { w->flush(); SetOrigin( 0, 0 ); - //QDFlushPortBuffer( GetWindowPort(xid), 0 ); // easy way out - remove! - //printf("DBG: Fl_X::flush\n"); + //QDFlushPortBuffer( GetWindowPort(xid), 0 ); // \todo do we need this? } @@ -1026,7 +715,7 @@ void handleUpdateEvent( WindowPtr xid ) GetPort( &oldPort ); SetPort( GetWindowPort(xid) ); Fl_X *i = Fl_X::i( window ); - i->wait_for_expose = 0; //++ what about this flag?! + i->wait_for_expose = 0; if ( window->damage() ) { if ( i->region ) { InvalWindowRgn( xid, i->region ); @@ -1036,10 +725,6 @@ void handleUpdateEvent( WindowPtr xid ) DisposeRgn( i->region ); i->region = 0; } -// BeginUpdate( xid ); - - //DrawControls(xid); // do we need this? - //DrawGrowIcon(xid); // do we need this? for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext ) { cx->w->clear_damage(window->damage()|FL_DAMAGE_EXPOSE); @@ -1049,213 +734,27 @@ void handleUpdateEvent( WindowPtr xid ) window->clear_damage(window->damage()|FL_DAMAGE_EXPOSE); i->flush(); window->clear_damage(); - -// EndUpdate( xid ); - //QDFlushPortBuffer( GetWindowPort(xid), 0 ); // should not be needed here! - //printf("DBG: handleUpdate::flush\n"); SetPort( oldPort ); } /** - * dispatch all mac events + * \todo this is a leftover from OS9 times. Please check how much applies to Carbon! */ -#ifdef STRICTLY_CARBON -int fl_handle(const EventRef event) -{ - EventRecord &macevent = *event; - UInt32 eventclass, eventkind; - static char buffer[5]; - static unsigned short prevMod = 0; - static WindowPtr prevMouseDownXid; - WindowPtr xid; -// int event = 0; - Fl_Window *window = 0L; - eventclass = GetEventClass(event); - eventkind = GetEventKind(event); - memcpy(buffer, &eventclass, 4); - buffer[4] = '\0'; - //printf("fl_event(): class = %s, kind = %ld\n", buffer, eventkind); -} -#else -int fl_handle(const EventRecord &macevent) -{ - static char buffer[2]; - static unsigned short prevMod = 0; - static WindowPtr prevMouseDownXid; - WindowPtr xid; - int event = 0; - Fl_Window *window = 0L; - //printMacEvent( macevent ); - switch (macevent.what) - { - - case mouseDown: { - // handle the different mouseDown events in various areas of the screen - int part = FindWindow(macevent.where, &xid); - //printf("mousedown in part %d\n", part ); -// prevMouseDownXid = xid; - switch (part) { -// case inDesk: break; - case inMenuBar: HandleMenu(MenuSelect(macevent.where)); break; //++ I just can't get Carbon to handle my menu events :-( -// case inSysWindow: SystemClick(&macevent, xid); break; -/* case inContent: { - if (xid!=FrontWindow()) SelectWindow( xid ); //{ SelectWindow(xid); return 1; } - window = fl_find(xid); - if (!window) break; - SetPort( GetWindowPort(xid) ); SetOrigin(0, 0); - //printMacEvent( macevent ); - Fl::e_keysym = FL_Button+((macevent.modifiers&0x1000)?3:1); //++ simulate three button using modifiers - set_event_xy(macevent); checkdouble(); - Fl::e_state |= ((macevent.modifiers&0x1000)?FL_BUTTON3:FL_BUTTON1); - return Fl::handle(FL_PUSH, window); } - case inDrag: Fl_X::MacDragWindow(xid, macevent); break; - case inGrow: Fl_X::MacGrowWindow(xid, macevent); break; - case inGoAway: - if (TrackGoAway(xid, macevent.where)) Fl::handle(FL_CLOSE, fl_find(xid)); - // if there are no more windows, send a high-level quit event - if (!Fl_X::first) QuitAppleEventHandler( 0, 0, 0 ); - break; - case inZoomIn: case inZoomOut: -// if (TrackBox(xid, event.where, part)) DoZoomWindow(xid, part); - break; -*/ - } // switch part - break; } // mouseDown -/* - case mouseUp: { - xid = FrontWindow(); - window = fl_find( xid ); - if (!window) break; - SetPort( GetWindowPort(xid) ); - SetOrigin(0, 0); - Fl::e_keysym = FL_Button+((Fl::e_state&FL_BUTTON1)?1:3); // macevent.modifiers ... - set_event_xy(macevent); - Fl::e_state &= ~(FL_BUTTON1|FL_BUTTON3); -// if (!Fl::grab()) ReleaseCapture(); - return Fl::handle(FL_RELEASE, window); } - */ - /* - case nullEvent: { //: idle events - who came up with that idea? - if (macevent.modifiers&0xff00 == prevMod) break; - int ret = Fl_X::MacModifiers(macevent, prevMod); - prevMod = macevent.modifiers&0xff00; - return ret; } - */ - /* - case keyUp: - //: bit0..7 message = keycode, 8..15 virtual, 16..23 ADB - //:: keyup does NOT GET CALLED in CW debug mode!! - case keyDown: - case autoKey: { - window = fl_find(FrontWindow()); - if (!window) break; - unsigned short cc = mac2fltk(macevent.message); - unsigned char cm = macevent.message; - Fl::e_keysym = cc; - set_shift_states(macevent); - if (macevent.what==keyUp) { - Fl::e_length = 0; buffer[0] = 0; - } else { - Fl::e_text = buffer; - if (cc<0x100) { - //++ please check the Mac specific 'option+key' special characters - //++ handle the control key to generate control characters - //if (Fl::e_state&FL_CTRL && cm>=32 && cm<64) buffer[0] = cm-32; else - buffer[0] = cm; - } else if (cc>=FL_KP && cc<=FL_KP_Last) { - buffer[0] = cc-FL_KP; //++ remapped num keys: macevent.message; - } else { - buffer[0] = 0; - } - if (cc==FL_Escape) buffer[0]=27; - else if (cc==FL_BackSpace) buffer[0]=0x08; - else if (cc==FL_Tab) buffer[0]=0x09; - Fl::e_length = (buffer[0]?1:0); - return Fl::handle(FL_KEYBOARD, window); - } - break; - } - */ /* - case activateEvt: - window = fl_find((WindowPtr)(macevent.message)); - if (!window) break; - if (macevent.modifiers & activeFlag) { - return Fl::handle(FL_FOCUS, window); - } else { - return Fl::handle(FL_UNFOCUS, window); - } - break; */ -/* case updateEvt: // done in Carbon - xid = (WindowPtr)macevent.message; - if (xid) handleUpdateEvent( xid ); - break; */ -/* case diskEvt: - break; */ -/* case osEvt: //: contains mouse move events - switch ( (macevent.message>>24)&0xff ) { - case suspendResumeMessage: - window = fl_find(FrontWindow()); - if (!window) break; - SetEventMask(everyEvent); //++ currentMask | keyUpEvent - //++ mac users will expect that all windows switch to inactive - if (macevent.message & resumeFlag) { - return Fl::handle(FL_FOCUS, window); - } else { - return Fl::handle(FL_UNFOCUS, window); - } - break; - case mouseMovedMessage: - if (Fl::e_x_root==macevent.where.h && Fl::e_y_root==macevent.where.v) break; - xid = FrontWindow(); - window = fl_find( xid ); - if (!window) break; - SetPort( GetWindowPort(xid) ); SetOrigin(0, 0); - set_event_xy(macevent); - #if CONSOLIDATE_MOTION - send_motion = fl_xmousewin = window; - return 0; - #else - return Fl::handle( Button()?FL_DRAG:FL_MOVE, window); - #endif -// if (!Fl::grab()) ReleaseCapture(); - } - break; */ - //++ get null events to grab changes in the modifier keys (shift down, etc.) - case kHighLevelEvent: - //AEProcessAppleEvent(&macevent); - break; - } -#endif // 0 - return 1; -} - -//////////////////////////////////////////////////////////////// -// This function gets the dimensions of the top/left borders and -// the title bar, if there is one, based on the FL_BORDER, FL_MODAL -// and FL_NONMODAL flags, and on the window's size range. -// It returns the following values: -// -// value | border | title bar -// 0 | none | no -// 1 | fix | yes -// 2 | size | yes -// 3 | dialog | dialog (currently not used) - int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by) { int W, H, xoff, yoff, dx, dy; int ret = bx = by = bt = 0; if (w->border() && !w->parent()) { if (w->maxw != w->minw || w->maxh != w->minh) { ret = 2; - bx = 6; //++ GetSystemMetrics(SM_CXSIZEFRAME); - by = 6; //++ get Mac window frame size GetSystemMetrics(SM_CYSIZEFRAME); + bx = 6; // \todo Mac : GetSystemMetrics(SM_CXSIZEFRAME); + by = 6; // \todo Mac : get Mac window frame size GetSystemMetrics(SM_CYSIZEFRAME); } else { ret = 1; - bx = 6; //++ GetSystemMetrics(SM_CXFIXEDFRAME); - by = 6; //++ GetSystemMetrics(SM_CYFIXEDFRAME); + bx = 6; // \todo Mac : GetSystemMetrics(SM_CXFIXEDFRAME); + by = 6; // \todo Mac : GetSystemMetrics(SM_CYFIXEDFRAME); } - bt = 22; //++ GetSystemMetrics(SM_CYCAPTION); + bt = 22; // \todo Mac : GetSystemMetrics(SM_CYCAPTION); } //The coordinates of the whole window, including non-client area xoff = bx; @@ -1288,15 +787,9 @@ int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by) } -//////////////////////////////////////////////////////////////// -// Innards of Fl_Window::create() - -bool fl_show_iconic; //++ Implement: true if called from iconize() -int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR -const Fl_Window* fl_modal_for; // parent of modal() window - /** * go ahead, create that (sub)window + * \todo we should make menu windows slightly transparent for the new Mac look */ void Fl_X::make(Fl_Window* w) { @@ -1304,13 +797,6 @@ void Fl_X::make(Fl_Window* w) if ( w->parent() ) // create a subwindow { Fl_Group::current(0); -// int xp = w->x(); -// int yp = w->y(); -// int wp = w->w(); -// int hp = w->h(); - //++ now we have to do completely different stuff here! - //++ mac has no concept of a window in a window! - Rect wRect; wRect.top = w->y(); wRect.left = w->x(); @@ -1336,8 +822,6 @@ void Fl_X::make(Fl_Window* w) w->handle(FL_SHOW); w->redraw(); // force draw to happen fl_show_iconic = 0; - //++ if (w->modal()) { Fl::modal_ = w; fl_fix_focus(); } - // ;;;; printf("Created subwindow %08x (%08x)\n", w, x->xid ); } else // create a desktop window { @@ -1346,12 +830,9 @@ void Fl_X::make(Fl_Window* w) int winclass = kDocumentWindowClass; int winattr = kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute - | kWindowLiveResizeAttribute // activate this as soon as we ported to Carbon Events! + | kWindowLiveResizeAttribute | kWindowStandardHandlerAttribute - //| kWindowInWindowMenuAttribute ; -// int winattr = kWindowStandardHandlerAttribute; -// int winattr = 0; int xp = w->x(); int yp = w->y(); int wp = w->w(); @@ -1365,7 +846,6 @@ void Fl_X::make(Fl_Window* w) int minh = o->h(); if (minh > 100) minh = 100; w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0); winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute; - //winattr |= kWindowFullZoomAttribute; } else { w->size_range(w->w(), w->h(), w->w(), w->h()); } @@ -1378,12 +858,11 @@ void Fl_X::make(Fl_Window* w) else if (w->non_modal()) winclass = kFloatingWindowClass; // we need to call 'InitFloatingWindows for OS 8, 9 if (by+bt) { - //++ if (!w->non_modal()) style |= WS_SYSMENU | WS_MINIMIZEBOX; wp += 2*bx; hp += 2*by+bt; } if (!(w->flags() & Fl_Window::FL_FORCE_POSITION)) { - w->x(xyPos+Fl::x()); w->y(xyPos+Fl::y()); //+ there is a Carbon function for default window positioning + w->x(xyPos+Fl::x()); w->y(xyPos+Fl::y()); // \todo use the Carbon function for default window positioning xyPos += 24; if (xyPos>200) xyPos = 24; } else { @@ -1399,7 +878,6 @@ void Fl_X::make(Fl_Window* w) // find some other window to be "transient for": Fl_Window* w = Fl_X::first->w; while (w->parent()) w = w->window(); - //++parent = fl_xid(w); } Rect wRect; @@ -1414,7 +892,7 @@ void Fl_X::make(Fl_Window* w) else pTitle[0]=0; Fl_X* x = new Fl_X; - x->other_xid = 0; // room for doublebuffering image map //++ OS X: the OS always doublebuffers! + x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows x->region = 0; x->subRegion = 0; x->cursor = fl_default_cursor; @@ -1428,8 +906,6 @@ void Fl_X::make(Fl_Window* w) Fl_X::first = x; if (w->resizable()) DrawGrowIcon(x->xid); w->set_visible(); - // add event handlers - #ifdef TARGET_API_MAC_CARBON { // Install Carbon Event handlers OSStatus ret; EventHandlerUPP mousewheelHandler = NewEventHandlerUPP( carbonMousewheelHandler ); // will not be disposed by Carbon... @@ -1461,37 +937,40 @@ void Fl_X::make(Fl_Window* w) { kEventClassWindow, kEventWindowBoundsChanged } }; ret = InstallWindowEventHandler( x->xid, windowHandler, 7, windowEvents, w, 0L ); } - #endif - if ( ! Fl_X::first->next ) // if this is the first window, we need to bring the application to the front //++ this fails if the first window is a child window... + 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' } - //TransitionWindow( x->xid, kWindowZoomTransitionEffect, kWindowShowTransitionAction, 0 ); + if ( fl_show_iconic ) { + fl_show_iconic = 0; + CollapseWindow( x->xid, true ); // \todo Mac ; untested + } ShowWindow( x->xid ); w->handle(FL_SHOW); w->redraw(); // force draw to happen - fl_show_iconic = 0; w->set_visible(); if (w->modal()) { Fl::modal_ = w; fl_fix_focus(); } - //;;;; printf("Created top level window %08x (%08x)\n", w, x->xid ); } } + +/** + * this is a leftover from X Windows + */ void Fl_Window::size_range_() { size_range_set = 1; } -//////////////////////////////////////////////////////////////// -//++ make this run with Unix filenames -// returns pointer to the filename, or null if name ends with ':' +/** + * returns pointer to the filename, or null if name ends with ':' + */ const char *filename_name( const char *name ) { const char *p, *q; @@ -1509,6 +988,7 @@ const char *filename_name( const char *name ) return q; } + /** * set the window title bar * \todo make the titlebar icon work! @@ -1523,28 +1003,10 @@ void Fl_Window::label(const char *name,const char */*iname*/) { if (shown() || i) SetWTitle(fl_xid(this), pTitle); } -//////////////////////////////////////////////////////////////// -// Implement the virtual functions for the base Fl_Window class: - -// Display can *look* faster (it isn't really faster) if X's background -// color is used to erase the window. In fltk 2.0 the only way to -// prevent this is to set the box to FL_NO_BOX. -// -// Drawing should really be faster if FL_FRAME_ONLY is passed to the -// box drawing function, since X has already erased the interior. But -// on XFree86 (and prehaps all X's) this has a problem if the window -// is resized while a save-behind window is atop it. The previous -// contents are restored to the area, but this assummes the area is -// cleared to background color. So I had to give up on this... -/* -void Fl_Window::create() { - Fl_X::create(this); -} -*/ -Window fl_window; -Fl_Window *Fl_Window::current_; - +/** + * make a window visible + */ void Fl_Window::show() { if (!shown() || !i) { Fl_X::make(this); @@ -1552,19 +1014,20 @@ void Fl_Window::show() { if ( !parent() ) { if ( IsWindowCollapsed( i->xid ) ) CollapseWindow( i->xid, false ); - //++ do we need to do grab and icon handling here? - if (!fl_capture) //++ Do we need this? It should keep the mouse modal window in front + if (!fl_capture) BringToFront(i->xid); } } } +/** + * resize a window + */ void Fl_Window::resize(int X,int Y,int W,int H) { int is_a_resize = (W != w() || H != h()); if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION); else if (!is_a_resize) return; - // change the viewport first, so children (namely OpenGL) can resize correctly if ( (resize_from_system!=this) && (!parent()) && shown()) { MoveWindow(i->xid, X, Y, 0); if (is_a_resize) { @@ -1582,7 +1045,6 @@ void Fl_Window::resize(int X,int Y,int W,int H) { } } -Fl_Region fl_window_region = 0; /** * make all drawing go into this window (called by subclass flush() impl.) @@ -1594,7 +1056,7 @@ void Fl_Window::make_current() fl_window = i->xid; current_ = this; - SetPort( GetWindowPort(i->xid) ); //++ this does not handle double buffered windows! + SetPort( GetWindowPort(i->xid) ); // \todo check for the handling of doublebuffered winows int xp = 0, yp = 0; Fl_Window *win = this; @@ -1606,14 +1068,11 @@ void Fl_Window::make_current() yp += win->y(); win = (Fl_Window*)win->window(); } - SetOrigin( -xp, -yp ); //++ how do we handle doublebuffering here? + SetOrigin( -xp, -yp ); - //+++ here we should set the clip to all except the subwindows - //++ first of all, there seems to be some leftovers from an old operation SetRectRgn( fl_window_region, 0, 0, w(), h() ); - // remove all subwindows from the clip - //+++ for performance reasons: we don't have to create this unless the child windows moved + // \todo for performance reasons: we don't have to create this unless the child windows moved for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext ) { Fl_Region r = NewRgn(); @@ -1626,94 +1085,10 @@ void Fl_Window::make_current() fl_clip_region( 0 ); SetPortClipRegion( GetWindowPort(i->xid), fl_window_region ); - //CopyRgn( fl_window_region, GetPortClipRegion( GetWindowPort(i->xid), 0) ); // for Fl_GL_Window return; } - -/** - * This block contains a collection of ideas to improve and carbonize the Mac port - * - * I found a note stating that in order to receive the - * MouseUp event I need to set some SystemEvent Mask. - * Although I do receive them, it might still be smart to look into this! - * - * I have to solve the subwindow linking problem (links - * get corrupted when widows get reparented or closed) - * - * The current subwindow inking allows only one level of - * subwindowing (which was correct for the first layout). - * I have to change it for arbitrary depths. - * - * There is supposedly a nice library out for Berkeley sockets. - * Check out www.iis.ee.ethz.ch/~neeri/macintosh/gusi-qa.html - * (Those Swiss people in Zuerich have the longest links :-) - * - * Alternative timers: - * - GetTicks(): TickCount(): simple, unreliable, 60th of a second - * - Microseconds(): about 1ms - * - UpTime(): nano second resultion, only PCI machines (ah well) - */ - -/* ---- sample hires timer (up to 20 microseconds!) -double MicrosecondToDouble(register const UnsignedWide *epochPtr) -{ - register double result; - - result = (((double) epochPtr->hi) * kTwoPower32) + epochPtr->lo; - return (result); -} - -void MicrosecondDelta(register const UnsignedWide *startPtr, - register const UnsignedWide *endPtr, - register SignedWide *resultPtr) -{ - if (endPtr->lo >= startPtr->lo) - resultPtr->hi = endPtr->hi - startPtr->hi; - else - resultPtr->hi = (endPtr->hi - 1) - startPtr->hi; - - resultPtr->lo = endPtr->lo - startPtr->lo; -} -*/ - -/* ---- sample UpTime() timer -AbsoluteTime startTime; -AbsoluteTime endTime; -AbsoluteTime elapsedTime; -Nanoseconds elapsedNanoseconds; - -startTime = UpTime(); -DoMyOperation(); -endTime = UpTime(); -elapsedTime = SubAbsoluteFromAbsolute(endTime, startTime); -elapsedNanoseconds = AbsoluteToNanoseconds(elapsedTime); - ------- window classes: - // classes: - // kAlertWindowClass: small up frame - nice - // 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 - - -*/ - -//++ when using OpenGL in a Mach-O executable and include<aglMacro.h> -//++ we MUST call aglConfigure(AGL_TARGET_OS_MAC_OSX, GL_TRUE); - // -// End of "$Id: Fl_mac.cxx,v 1.1.2.11 2002/01/01 15:11:31 easysw Exp $". +// End of "$Id: Fl_mac.cxx,v 1.1.2.12 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/Fl_visual.cxx b/src/Fl_visual.cxx index 50db157e7..98570424f 100644 --- a/src/Fl_visual.cxx +++ b/src/Fl_visual.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_visual.cxx,v 1.7.2.4.2.3 2002/01/01 15:11:31 easysw Exp $" +// "$Id: Fl_visual.cxx,v 1.7.2.4.2.4 2002/01/03 08:08:21 matthiaswm Exp $" // // Visual support for the Fast Light Tool Kit (FLTK). // @@ -40,7 +40,7 @@ int Fl::visual(int flags) { } #elif defined(__APPLE__) -//++ Matt: add support for visual flags +// \todo Mac : need to implement Visual flags int Fl::visual(int flags) { (void)flags; return 1; @@ -115,5 +115,5 @@ int Fl::visual(int flags) { #endif // -// End of "$Id: Fl_visual.cxx,v 1.7.2.4.2.3 2002/01/01 15:11:31 easysw Exp $". +// End of "$Id: Fl_visual.cxx,v 1.7.2.4.2.4 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx index da132dd03..eaaf9bd74 100644 --- a/src/fl_draw_image_mac.cxx +++ b/src/fl_draw_image_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_draw_image_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $" +// "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $" // // MacOS image drawing code for the Fast Light Tool Kit (FLTK). // @@ -163,9 +163,9 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, } } -#ifdef __APPLE__ -//++ the above function does not support subregions yet +// \todo Mac : the above function does not support subregions yet #ifdef later_we_do_this +// \todo Mac : the following code is taken from fl_draw_image_win32 and needs to be modified for Mac Carbon // if (!linedelta) linedelta = W*delta; int x, y, w, h; @@ -251,92 +251,6 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, // ); } #endif -#else - if (!linedelta) linedelta = W*delta; - - int x, y, w, h; - fl_clip_box(X,Y,W,H,x,y,w,h); - if (w<=0 || h<=0) return; - if (buf) buf += (x-X)*delta + (y-Y)*linedelta; - - static U32 bmibuffer[256+12]; - BITMAPINFO &bmi = *((BITMAPINFO*)bmibuffer); - if (!bmi.bmiHeader.biSize) { - bmi.bmiHeader.biSize = sizeof(bmi)-4; // does it use this to determine type? - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biCompression = BI_RGB; - bmi.bmiHeader.biXPelsPerMeter = 0; - bmi.bmiHeader.biYPelsPerMeter = 0; - bmi.bmiHeader.biClrUsed = 0; - bmi.bmiHeader.biClrImportant = 0; - } - if (mono) { - for (int i=0; i<256; i++) { - bmi.bmiColors[i].rgbBlue = i; - bmi.bmiColors[i].rgbGreen = i; - bmi.bmiColors[i].rgbRed = i; - bmi.bmiColors[i].rgbReserved = i; - } - } - bmi.bmiHeader.biWidth = w; - bmi.bmiHeader.biBitCount = mono ? 8 : 24; - int pixelsize = mono ? 1 : 3; - int linesize = (pixelsize*w+3)&~3; - - static U32* buffer; - int blocking = h; - {int size = linesize*h; - if (size > MAXBUFFER) { - size = MAXBUFFER; - blocking = MAXBUFFER/linesize; - } - static long buffer_size; - if (size > buffer_size) { - delete[] buffer; - buffer_size = size; - buffer = new U32[(size+3)/4]; - }} - bmi.bmiHeader.biHeight = blocking; - static U32* line_buffer; - if (!buf) { - int size = W*delta; - static int line_buf_size; - if (size > line_buf_size) { - delete[] line_buffer; - line_buf_size = size; - line_buffer = new U32[(size+3)/4]; - } - } - for (int j=0; j<h; ) { - int k; - for (k = 0; j<h && k<blocking; k++, j++) { - const uchar* from; - if (!buf) { // run the converter: - cb(userdata, x-X, y-Y+j, w, (uchar*)line_buffer); - from = (uchar*)line_buffer; - } else { - from = buf; - buf += linedelta; - } - uchar *to = (uchar*)buffer+(blocking-k-1)*linesize; - if (mono) { - for (int i=w; i--; from += delta) *to++ = *from; - } else { - for (int i=w; i--; from += delta, to += 3) { - uchar r = from[0]; - to[0] = from[2]; - to[1] = from[1]; - to[2] = r; - } - } - } - SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k, - (LPSTR)((uchar*)buffer+(blocking-k)*linesize), - &bmi, - DIB_RGB_COLORS - ); - } -#endif } void fl_draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){ @@ -360,5 +274,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { } // -// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/fl_shortcut.cxx b/src/fl_shortcut.cxx index 7e9755b51..e547eccc8 100644 --- a/src/fl_shortcut.cxx +++ b/src/fl_shortcut.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_shortcut.cxx,v 1.4.2.9.2.3 2002/01/01 15:11:32 easysw Exp $" +// "$Id: fl_shortcut.cxx,v 1.4.2.9.2.4 2002/01/03 08:08:21 matthiaswm Exp $" // // Shortcut support routines for the Fast Light Tool Kit (FLTK). // @@ -116,7 +116,7 @@ const char * fl_shortcut_label(int shortcut) { char *p = buf; if (!shortcut) {*p = 0; return buf;} #ifdef __APPLE__ - //++ we might want to change the symbols for mAc users + // \todo Mac : we might want to change the symbols for Mac users if (shortcut & FL_SHIFT) {strcpy(p,"shift+"); p += 6;} //: Mac hollow up arrow if (shortcut & FL_META) {strcpy(p,"ctrl+"); p += 5;} //: Mac 'cotrol' if (shortcut & FL_ALT) {strcpy(p,"option+"); p += 7;} //: Mac 'Option' or fancy switch symbol @@ -200,5 +200,5 @@ int Fl_Widget::test_shortcut() { } // -// End of "$Id: fl_shortcut.cxx,v 1.4.2.9.2.3 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: fl_shortcut.cxx,v 1.4.2.9.2.4 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index e1575bc20..27b756ac3 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -1,5 +1,5 @@ // -// "$Id: gl_draw.cxx,v 1.7.2.5.2.4 2002/01/01 15:11:32 easysw Exp $" +// "$Id: gl_draw.cxx,v 1.7.2.5.2.5 2002/01/03 08:08:21 matthiaswm Exp $" // // OpenGL drawing support routines for the Fast Light Tool Kit (FLTK). // @@ -54,7 +54,8 @@ void gl_font(int fontid, int size) { wglUseFontBitmaps(fl_gc, base, size, fl_fontsize->listbase+base); SelectObject(fl_gc, oldFid); #elif defined(__APPLE__) - //++ Matt: Insert MacOS/AGL font handling here + // \todo Mac : Insert MacOS/AGL font handling here (aglUseFont) + // aglUseFont( context, fontID/GetFNum(), Style[norma, bold, italic], size, first, count, base ); #else int base = fl_xfont->min_char_or_byte2; int size = fl_xfont->max_char_or_byte2-base+1; @@ -157,5 +158,5 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) { #endif // -// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.4 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.5 2002/01/03 08:08:21 matthiaswm Exp $". // diff --git a/src/gl_start.cxx b/src/gl_start.cxx index fb5db36dd..fe8bb840a 100644 --- a/src/gl_start.cxx +++ b/src/gl_start.cxx @@ -1,5 +1,5 @@ // -// "$Id: gl_start.cxx,v 1.6.2.5.2.6 2002/01/01 15:11:32 easysw Exp $" +// "$Id: gl_start.cxx,v 1.6.2.5.2.7 2002/01/03 08:08:21 matthiaswm Exp $" // // OpenGL context routines for the Fast Light Tool Kit (FLTK). // @@ -66,7 +66,7 @@ void gl_start() { if (!gl_choice) Fl::gl_visual(0); context = fl_create_gl_context(Fl_Window::current(), gl_choice); #elif defined(__APPLE__) - //++ Matt: We need to check the code and verify it with Apple Sample code. 'shiny' give some output... + // \todo Mac : We need to check the code and verify it with Apple Sample code. The 'shiny'-test should at least work with the software OpenGL emulator context = fl_create_gl_context(Fl_Window::current(), gl_choice); #else context = fl_create_gl_context(fl_visual); @@ -122,5 +122,5 @@ int Fl::gl_visual(int mode, int *alist) { #endif // -// End of "$Id: gl_start.cxx,v 1.6.2.5.2.6 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: gl_start.cxx,v 1.6.2.5.2.7 2002/01/03 08:08:21 matthiaswm Exp $". // |
