Author: manolo
Date: 2010-12-18 14:31:01 -0800 (Sat, 18 Dec 2010)
New Revision: 8055
Log:
Mac OS: replaced several global functions by new member functions of Mac 
OS-specific Fl_X class.

Modified:
   branches/branch-1.3/FL/mac.H
   branches/branch-1.3/src/Fl.cxx
   branches/branch-1.3/src/Fl_Gl_Choice.cxx
   branches/branch-1.3/src/Fl_Gl_Window.cxx
   branches/branch-1.3/src/Fl_Window_iconize.cxx
   branches/branch-1.3/src/Fl_cocoa.mm
   branches/branch-1.3/src/Fl_grab.cxx
   branches/branch-1.3/src/fl_cursor.cxx
   branches/branch-1.3/src/fl_dnd.cxx
   branches/branch-1.3/src/fl_dnd_mac.cxx
   branches/branch-1.3/src/fl_read_image_mac.cxx
   branches/branch-1.3/src/fl_rect.cxx
   branches/branch-1.3/src/fl_scroll_area.cxx
   branches/branch-1.3/src/screen_xywh.cxx

Modified: branches/branch-1.3/FL/mac.H
===================================================================
--- branches/branch-1.3/FL/mac.H        2010-12-18 15:57:35 UTC (rev 8054)
+++ branches/branch-1.3/FL/mac.H        2010-12-18 22:31:01 UTC (rev 8055)
@@ -103,7 +103,7 @@
 class Fl_X 
 {
 public:
-  Window xid;              // Cocoa: FLWindow* ; Carbon: WindowRef
+  Window xid;              // pointer to the Cocoa window object (FLWindow*)
   Fl_Offscreen other_xid;  // pointer for offscreen bitmaps (doublebuffer)
   Fl_Window *w;            // FLTK window for 
   Fl_Region region;
@@ -111,7 +111,7 @@
   Fl_X *next;              // linked tree to support subwindows
   Fl_X *xidChildren, *xidNext; // more subwindow tree
   int wait_for_expose;
-  void *cursor;                          // is really NSCursor*
+  void *cursor;                   // is really NSCursor*
   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&);
@@ -124,17 +124,29 @@
   static void q_release_context(Fl_X *x=0); // free all resources associated 
with fl_gc
   static void q_begin_image(CGRect&, int x, int y, int w, int h);
   static void q_end_image();
+  // Cocoa additions
+  void destroy(void);
+  void map(void);
+  void unmap(void);
+  int unlink(Fl_X* start = NULL);
+  void collapse(void);
+  WindowRef window_ref(void);
+  void contains_GL_subwindow(void);
+  void set_key_window(void);
+  void set_cursor(Fl_Cursor);
+  static int screen_init(XRectangle screens[]);
+  static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int 
w, int h);
+  static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, 
int w, int h, int *bytesPerPixel);
+  static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int 
y,int w, int h);
+  static CGContextRef watch_cursor_image(void);
+  static CGContextRef help_cursor_image(void);
+  static CGContextRef nesw_cursor_image(void);
+  static CGContextRef nwse_cursor_image(void);
+  static CGContextRef none_cursor_image(void);
+private:
+  static void relink(Fl_Window*, Fl_Window*);
 };
 
-extern void MacDestroyWindow(Fl_Window*,void *);
-extern void MacMapWindow(Fl_Window*,void *);
-extern void MacUnmapWindow(Fl_Window*,void *);
-extern WindowRef MACwindowRef(Fl_Window *w);
-extern Fl_Region MacRectRegionIntersect(Fl_Region current, int x,int y,int w, 
int h);
-extern void MacCollapseWindow(Window w);
-
-extern int MacUnlinkWindow(Fl_X*,Fl_X*start=0L);
-
 inline Window fl_xid(const Fl_Window*w) 
 {
   return Fl_X::i(w)->xid;

Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx      2010-12-18 15:57:35 UTC (rev 8054)
+++ branches/branch-1.3/src/Fl.cxx      2010-12-18 22:31:01 UTC (rev 8055)
@@ -60,7 +60,7 @@
 void fl_release_dc(HWND,HDC);
 void fl_cleanup_dc_list(void);
 #elif defined(__APPLE__)
-extern double fl_MAC_flush_and_wait(double time_to_wait, char in_idle);
+extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle);
 #endif // WIN32
 
 //
@@ -418,7 +418,7 @@
     // the idle function may turn off idle, we can then wait:
     if (idle) time_to_wait = 0.0;
   }
-  return fl_MAC_flush_and_wait(time_to_wait, in_idle);
+  return fl_mac_flush_and_wait(time_to_wait, in_idle);
 
 #else
 
@@ -1218,7 +1218,7 @@
   for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return;
   *pp = ip->next;
 #ifdef __APPLE__
-  MacUnlinkWindow(ip);
+  ip->unlink();
   // MacOS X manages a single pointer per application. Make sure that hiding
   // a toplevel window will not leave us with some random pointer shape, or
   // worst case, an invisible pointer
@@ -1291,7 +1291,7 @@
   }
   XDestroyWindow(fl_display, ip->xid);
 #elif defined(__APPLE_QUARTZ__)
-  MacDestroyWindow(this, ip->xid);
+  ip->destroy();
 #else
 # error unsupported platform
 #endif
@@ -1329,7 +1329,7 @@
 #if defined(USE_X11) || defined(WIN32)
         XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
 #elif defined(__APPLE_QUARTZ__)
-        MacMapWindow(this, i->xid);
+       i->map();
 #else
 # error unsupported platform
 #endif // __APPLE__
@@ -1351,7 +1351,7 @@
 #if defined(USE_X11) || defined(WIN32)
        XUnmapWindow(fl_display, fl_xid(this));
 #elif defined(__APPLE_QUARTZ__)
-       MacUnmapWindow(this, i->xid);
+       i->unmap();
 #else
 # error platform unsupported
 #endif

Modified: branches/branch-1.3/src/Fl_Gl_Choice.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Gl_Choice.cxx    2010-12-18 15:57:35 UTC (rev 
8054)
+++ branches/branch-1.3/src/Fl_Gl_Choice.cxx    2010-12-18 22:31:01 UTC (rev 
8055)
@@ -312,17 +312,17 @@
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
 #if __LP64__
   // 64 bit version
-  aglSetWindowRef(context, MACwindowRef(window) );
+  aglSetWindowRef(context, 
Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ );
 #else
   // 32 bit version >= 10.5
   if (aglSetWindowRef != NULL)
-    aglSetWindowRef(context, MACwindowRef(window) );
+    aglSetWindowRef(context, 
Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ );
   else
-    aglSetDrawable( context, GetWindowPort( MACwindowRef(window) ) );
+    aglSetDrawable( context, GetWindowPort( 
Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ ) );
 #endif
 #else
   // 32 bit version < 10.5
-  aglSetDrawable( context, GetWindowPort( MACwindowRef(window) ) );
+  aglSetDrawable( context, GetWindowPort( 
Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ ) );
 #endif
   return (context);
 }
@@ -352,17 +352,17 @@
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
 #if __LP64__
     // 64 bit version
-    aglSetWindowRef(context, MACwindowRef(w) );
+    aglSetWindowRef(context, Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ );
 #else
     // 32 bit version >= 10.5
     if (aglSetWindowRef != NULL)
-      aglSetWindowRef(context, MACwindowRef(w) );
+      aglSetWindowRef(context, Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ 
);
     else
-      aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
+      aglSetDrawable( context, GetWindowPort( 
Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ ) );
 #endif
 #else
     // 32 bit version < 10.5
-    aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
+    aglSetDrawable( context, GetWindowPort( 
Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ ) );
 #endif
     aglSetCurrentContext(context);
 #  else

Modified: branches/branch-1.3/src/Fl_Gl_Window.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Gl_Window.cxx    2010-12-18 15:57:35 UTC (rev 
8054)
+++ branches/branch-1.3/src/Fl_Gl_Window.cxx    2010-12-18 22:31:01 UTC (rev 
8055)
@@ -91,9 +91,8 @@
     Fl_X::make_xid(this, g->vis, g->colormap);
     if (overlay && overlay != this) ((Fl_Gl_Window*)overlay)->show();
 #elif defined(__APPLE__)
-       extern void MACsetContainsGLsubwindow(Fl_Window *);
        if( ! parent() ) need_redraw=1;
-       else MACsetContainsGLsubwindow( window() );
+       else Fl_X::i(window())->contains_GL_subwindow();
 #endif
   }
   Fl_Window::show();
@@ -278,7 +277,7 @@
   // warning: the Quartz version should probably use Core GL (CGL) instead of 
AGL
   //: clear previous clipping in this shared port
 #if ! __LP64__
-  GrafPtr port = GetWindowPort( MACwindowRef(this) );
+  GrafPtr port = GetWindowPort( Fl_X::i(this)->window_ref() );
   Rect rect; SetRect( &rect, 0, 0, 0x7fff, 0x7fff );
   GrafPtr old; GetPort( &old );
   SetPort( port );

Modified: branches/branch-1.3/src/Fl_Window_iconize.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Window_iconize.cxx       2010-12-18 15:57:35 UTC 
(rev 8054)
+++ branches/branch-1.3/src/Fl_Window_iconize.cxx       2010-12-18 22:31:01 UTC 
(rev 8055)
@@ -37,7 +37,7 @@
 #ifdef WIN32
     ShowWindow(i->xid, SW_SHOWMINNOACTIVE);
 #elif defined(__APPLE__)
-    MacCollapseWindow((Window)i->xid);
+    i->collapse();
 #else
     XIconifyWindow(fl_display, i->xid, fl_screen);
 #endif

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2010-12-18 15:57:35 UTC (rev 8054)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2010-12-18 22:31:01 UTC (rev 8055)
@@ -105,11 +105,6 @@
 // external functions
 extern void fl_fix_focus();
 extern Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h);
-extern CGContextRef CreateWatchImage(void);
-extern CGContextRef CreateHelpImage(void);
-extern CGContextRef CreateNESWImage(void);
-extern CGContextRef CreateNWSEImage(void);
-extern CGContextRef CreateNoneImage(void);
 
 // forward definition of functions in this file
 // converting cr lf converter function
@@ -703,7 +698,7 @@
   return (got_events);
 }
 
-double fl_MAC_flush_and_wait(double time_to_wait, char in_idle) {
+double fl_mac_flush_and_wait(double time_to_wait, char in_idle) {
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   Fl::flush();
   if (Fl::idle && !in_idle) // 'idle' may have been set within flush()
@@ -728,7 +723,7 @@
 /*
  * Cocoa Mousewheel handler
  */
-void cocoaMouseWheelHandler(NSEvent *theEvent)
+static void cocoaMouseWheelHandler(NSEvent *theEvent)
 {
   // Handle the new "MightyMouse" mouse wheel events. Please, someone explain
   // to me why Apple changed the API on this even though the current API
@@ -885,7 +880,7 @@
 
 
 // this gets called by CJK character palette input
-OSStatus carbonTextHandler( EventHandlerCallRef nextHandler, EventRef event, 
void *unused )
+static OSStatus carbonTextHandler( EventHandlerCallRef nextHandler, EventRef 
event, void *unused )
 {
   // make sure the key window is an FLTK window
   NSWindow *keywindow = [NSApp keyWindow];
@@ -923,7 +918,7 @@
   return noErr;
 }
 
-OSStatus cocoaKeyboardHandler(NSEvent *theEvent);
+static OSStatus cocoaKeyboardHandler(NSEvent *theEvent);
 
 @interface FLTextView : NSTextView
 {
@@ -973,7 +968,7 @@
     replace the temporary character by this one
  - keyup -> [theEvent characters] contains the standard character
  */
-OSStatus cocoaKeyboardHandler(NSEvent *theEvent)
+static OSStatus cocoaKeyboardHandler(NSEvent *theEvent)
 {
   static char buffer[32];
   int sendEvent = 0, retval = 0;
@@ -1363,8 +1358,7 @@
     beenHereDoneThat = 1;
          
     [FLApplication sharedApplication];
-    NSAutoreleasePool *localPool;
-    localPool = [[NSAutoreleasePool alloc] init]; 
+    NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; // never 
released
     mydelegate = [[FLDelegate alloc] init];
     [NSApp setDelegate:mydelegate];
     [NSApp finishLaunching];
@@ -2277,28 +2271,12 @@
 #endif
 }
 
-/* the former implementation
 void Fl_X::q_begin_image(CGRect &rect, int cx, int cy, int w, int h) {
   CGContextSaveGState(fl_gc);
-  CGAffineTransform mx = CGContextGetCTM(fl_gc);
   CGRect r2 = rect;
   r2.origin.x -= 0.5f;
   r2.origin.y -= 0.5f;
   CGContextClipToRect(fl_gc, r2);
-  mx.d = -1.0; mx.tx = -mx.tx;
-  CGContextConcatCTM(fl_gc, mx);
-  rect.origin.x = -(mx.tx+0.5f) + rect.origin.x     - cx;
-  rect.origin.y =  (mx.ty+0.5f) - rect.origin.y - h + cy;
-  rect.size.width = w;
-  rect.size.height = h;
-}
-*/
-void Fl_X::q_begin_image(CGRect &rect, int cx, int cy, int w, int h) {
-  CGContextSaveGState(fl_gc);
-  CGRect r2 = rect;
-  r2.origin.x -= 0.5f;
-  r2.origin.y -= 0.5f;
-  CGContextClipToRect(fl_gc, r2);
   // move graphics context to origin of vertically reversed image 
   CGContextTranslateCTM(fl_gc, rect.origin.x - cx - 0.5, rect.origin.y - cy + 
h - 0.5);
   CGContextScaleCTM(fl_gc, 1, -1);
@@ -2518,35 +2496,36 @@
   }
 }
 
-int MacUnlinkWindow(Fl_X *ip, Fl_X *start) {
-  if (!ip) return 0;
+int Fl_X::unlink(Fl_X *start) {
   if (start) {
     Fl_X *pc = start;
     while (pc) {
-      if (pc->xidNext == ip) {
-        pc->xidNext = ip->xidNext;
+      if (pc->xidNext == this) {
+        pc->xidNext = xidNext;
         return 1;
       }
       if (pc->xidChildren) {
-        if (pc->xidChildren == ip) {
-          pc->xidChildren = ip->xidNext;
+        if (pc->xidChildren == this) {
+          pc->xidChildren = xidNext;
           return 1;
         }
-        if (MacUnlinkWindow(ip, pc->xidChildren))
+        if (unlink(pc->xidChildren))
           return 1;
       }
       pc = pc->xidNext;
     }
   } else {
     for ( Fl_X *pc = Fl_X::first; pc; pc = pc->next ) {
-      if (MacUnlinkWindow(ip, pc))
+      if (unlink(pc))
         return 1;
     }
   }  
   return 0;
 }
 
-static void MacRelinkWindow(Fl_X *x, Fl_X *p) {
+void Fl_X::relink(Fl_Window *w, Fl_Window *wp) {
+  Fl_X *x = Fl_X::i(w);
+  Fl_X *p = Fl_X::i(wp);
   if (!x || !p) return;
   // first, check if 'x' is already registered as a child of 'p'
   for (Fl_X *i = p->xidChildren; i; i=i->xidNext) {
@@ -2557,35 +2536,35 @@
   p->xidChildren = x;
 }
 
-void MacDestroyWindow(Fl_Window *w, void *p) {
-  if (w && !w->parent() && p) {
-    [[(NSWindow *)p contentView] release];
-    [(NSWindow *)p close];
+void Fl_X::destroy() {
+  if (w && !w->parent() && xid) {
+    [[(NSWindow *)xid contentView] release];
+    [(NSWindow *)xid close];
   }
 }
 
-void MacMapWindow(Fl_Window *w, void *p) {
-  if (w && p) {
-    [(NSWindow *)p orderFront:nil];
+void Fl_X::map() {
+  if (w && xid) {
+    [(NSWindow *)xid orderFront:nil];
   }
   //+ link to window list
   if (w && w->parent()) {
-    MacRelinkWindow(Fl_X::i(w), Fl_X::i(w->window()));
+    Fl_X::relink(w, w->window() );
     w->redraw();
   }
 }
 
-void MacUnmapWindow(Fl_Window *w, void *p) {
-  if (w && !w->parent() && p) {
-    [(NSWindow *)p orderOut:nil];
+void Fl_X::unmap() {
+  if (w && !w->parent() && xid) {
+    [(NSWindow *)xid orderOut:nil];
   }
   if (w && Fl_X::i(w)) 
-    MacUnlinkWindow(Fl_X::i(w));
+    Fl_X::i(w)->unlink();
 }
 
+
+// removes x,y,w,h rectangle from region r and returns result as a new 
Fl_Region
 static Fl_Region MacRegionMinusRect(Fl_Region r, int x,int y,int w,int h)
-/* removes x,y,w,h rectangle from region r and returns result as a new 
Fl_Region
- */
 {
   Fl_Region outr = (Fl_Region)malloc(sizeof(*outr));
   outr->rects = (CGRect*)malloc(4 * r->count * sizeof(CGRect));
@@ -2630,9 +2609,8 @@
   return outr;
 }
 
-Fl_Region MacRectRegionIntersect(Fl_Region current, int x,int y,int w, int h)
-/* intersects current and x,y,w,h rectangle and returns result as a new 
Fl_Region
- */
+// intersects current and x,y,w,h rectangle and returns result as a new 
Fl_Region
+Fl_Region Fl_X::intersect_region_and_rect(Fl_Region current, int x,int y,int 
w, int h)
 {
   if (current == NULL) return XRectangleRegion(x,y,w,h);
   CGRect r = fl_cgrectmake_cocoa(x, y, w, h);
@@ -2655,9 +2633,8 @@
   return outr;
 }
 
-void MacCollapseWindow(Window w)
-{
-  [(NSWindow*)w miniaturize:nil];
+void Fl_X::collapse() {
+  [(NSWindow *)xid miniaturize:nil];
 }
 
 static NSImage *CGBitmapContextToNSImage(CGContextRef c)
@@ -2691,14 +2668,14 @@
   return cursor;
 }
 
-void *MACSetCursor(Fl_Cursor c)
+void Fl_X::set_cursor(Fl_Cursor c)
 {
   NSCursor *icrsr;
   switch (c) {
     case FL_CURSOR_CROSS:  icrsr = [NSCursor crosshairCursor]; break;
     case FL_CURSOR_WAIT:
       static NSCursor *watch = nil;
-      watch = PrepareCursor(watch,  CreateWatchImage);
+      watch = PrepareCursor(watch,  &Fl_X::watch_cursor_image);
       icrsr = watch;
       break;
     case FL_CURSOR_INSERT: icrsr = [NSCursor IBeamCursor]; break;
@@ -2707,7 +2684,7 @@
     case FL_CURSOR_NS:     icrsr = [NSCursor resizeUpDownCursor]; break;
     case FL_CURSOR_HELP:   
       static NSCursor *help = nil;
-      help = PrepareCursor(help,  CreateHelpImage);
+      help = PrepareCursor(help,  &Fl_X::help_cursor_image);
       icrsr = help;
       break;
     case FL_CURSOR_HAND:   icrsr = [NSCursor pointingHandCursor]; break;
@@ -2716,7 +2693,7 @@
     case FL_CURSOR_SW:
     case FL_CURSOR_NESW:   
       static NSCursor *nesw = nil;
-      nesw = PrepareCursor(nesw,  CreateNESWImage);
+      nesw = PrepareCursor(nesw,  &Fl_X::nesw_cursor_image);
       icrsr = nesw;
       break;
     case FL_CURSOR_E:      icrsr = [NSCursor resizeRightCursor]; break;
@@ -2726,12 +2703,12 @@
     case FL_CURSOR_NW:
     case FL_CURSOR_NWSE:   
       static NSCursor *nwse = nil;
-      nwse = PrepareCursor(nwse,  CreateNWSEImage);
+      nwse = PrepareCursor(nwse,  &Fl_X::nwse_cursor_image);
       icrsr = nwse;
       break;
     case FL_CURSOR_NONE:   
       static NSCursor *none = nil;
-      none = PrepareCursor(none,  CreateNoneImage);
+      none = PrepareCursor(none,  &Fl_X::none_cursor_image);
       icrsr = none; 
       break;
     case FL_CURSOR_ARROW:
@@ -2740,13 +2717,12 @@
       break;
   }
   [icrsr set];
-  return icrsr;
+  cursor = icrsr;
 }
 
-int MACscreen_init(XRectangle screens[])
+int Fl_X::screen_init(XRectangle screens[])
 {
-  NSAutoreleasePool *localPool;
-  localPool = [[NSAutoreleasePool alloc] init]; 
+  NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; 
   NSArray *a = [NSScreen screens]; 
   int count = (int)[a count]; 
   NSRect r; 
@@ -3101,9 +3077,9 @@
   return retval;
 }
 
-void MACsetkeywindow(void *nsw)
+void Fl_X::set_key_window()
 {
-  [(NSWindow*)nsw makeKeyAndOrderFront:nil];
+  [(NSWindow*)xid makeKeyAndOrderFront:nil];
 }
 
 static NSImage *imageFromText(const char *text, int *pwidth, int *pheight)
@@ -3170,7 +3146,7 @@
   return image;
 }
 
-int MACpreparedrag(void)
+int Fl::dnd(void)
 {
   CFDataRef text = CFDataCreate(kCFAllocatorDefault, 
(UInt8*)fl_selection_buffer[0], fl_selection_length[0]);
   if (text==NULL) return false;
@@ -3216,7 +3192,7 @@
   return true;
 }
 
-unsigned char *MACbitmapFromRectOfWindow(Fl_Window *win, int x, int y, int w, 
int h, int *bytesPerPixel)
+unsigned char *Fl_X::bitmap_from_window_rect(Fl_Window *win, int x, int y, int 
w, int h, int *bytesPerPixel)
 // delete the returned pointer after use
 {
   while(win->window()) {
@@ -3257,11 +3233,11 @@
   delete (unsigned char *)data;
 }
 
-CGImageRef MAC_CGImageFromRectOfWindow(Fl_Window *win, int x, int y, int w, 
int h)
+CGImageRef Fl_X::CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, 
int h)
 // CFRelease the returned CGImageRef after use
 {
   int bpp;
-  unsigned char *bitmap = MACbitmapFromRectOfWindow(win, x, y, w, h, &bpp);
+  unsigned char *bitmap = bitmap_from_window_rect(win, x, y, w, h, &bpp);
   CGImageRef img;
   CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
   CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap, 
w*h*bpp, imgProviderReleaseData);
@@ -3273,14 +3249,14 @@
   return img;
 }
 
-void MACsetContainsGLsubwindow(Fl_Window *w) 
+void Fl_X::contains_GL_subwindow() 
 {
-  [(FLWindow*)Fl_X::i(w)->xid setContainsGLsubwindow:YES];
+  [(FLWindow*)xid setContainsGLsubwindow:YES];
 }
 
-WindowRef MACwindowRef(Fl_Window *w)
+WindowRef Fl_X::window_ref()
 {
-  return (WindowRef)[(FLWindow*)Fl_X::i(w)->xid windowRef];
+  return (WindowRef)[(FLWindow*)xid windowRef];
 }
 
 // so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes

Modified: branches/branch-1.3/src/Fl_grab.cxx
===================================================================
--- branches/branch-1.3/src/Fl_grab.cxx 2010-12-18 15:57:35 UTC (rev 8054)
+++ branches/branch-1.3/src/Fl_grab.cxx 2010-12-18 22:31:01 UTC (rev 8055)
@@ -47,7 +47,6 @@
 #endif
 
 #ifdef __APPLE__
-extern void MACsetkeywindow(void *nsw);
 extern void *fl_capture;
 #endif
 
@@ -59,7 +58,7 @@
       SetCapture(fl_capture);
 #elif defined(__APPLE__)
       fl_capture = Fl_X::i(first_window())->xid;
-      MACsetkeywindow(fl_capture);
+      Fl_X::i(first_window())->set_key_window();
 #else
       XGrabPointer(fl_display,
                   fl_xid(first_window()),

Modified: branches/branch-1.3/src/fl_cursor.cxx
===================================================================
--- branches/branch-1.3/src/fl_cursor.cxx       2010-12-18 15:57:35 UTC (rev 
8054)
+++ branches/branch-1.3/src/fl_cursor.cxx       2010-12-18 22:31:01 UTC (rev 
8055)
@@ -134,11 +134,10 @@
 # error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined"
 #endif
 
-extern void *MACSetCursor(Fl_Cursor c);
 extern Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h);
 
 
-CGContextRef CreateHelpImage(void)
+CGContextRef Fl_X::help_cursor_image(void)
 {
   int w = 20, h = 20;
   Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h);
@@ -152,7 +151,7 @@
   return (CGContextRef)off;
 }
 
-CGContextRef CreateNoneImage(void)
+CGContextRef Fl_X::none_cursor_image(void)
 {
   int w = 20, h = 20;
   Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h);
@@ -163,7 +162,7 @@
   return (CGContextRef)off;
 }
 
-CGContextRef CreateWatchImage(void)
+CGContextRef Fl_X::watch_cursor_image(void)
 {
   int w, h, r = 5;
   w = 2*r+6;
@@ -188,7 +187,7 @@
   return (CGContextRef)off;
 }
 
-CGContextRef CreateNESWImage(void)
+CGContextRef Fl_X::nesw_cursor_image(void)
 {
   int c = 7, r = 2*c;
   int w = r, h = r;
@@ -208,7 +207,7 @@
   return (CGContextRef)off;
 }
 
-CGContextRef CreateNWSEImage(void)
+CGContextRef Fl_X::nwse_cursor_image(void)
 {
   int c = 7, r = 2*c;
   int w = r, h = r;
@@ -232,10 +231,7 @@
   if (c == FL_CURSOR_DEFAULT) {
     c = cursor_default;
   }
-  void *cursor = MACSetCursor( c );
-  if (i) {
-         i->cursor = cursor;
-  }
+  if (i) i->set_cursor(c);
 }
 
 #else

Modified: branches/branch-1.3/src/fl_dnd.cxx
===================================================================
--- branches/branch-1.3/src/fl_dnd.cxx  2010-12-18 15:57:35 UTC (rev 8054)
+++ branches/branch-1.3/src/fl_dnd.cxx  2010-12-18 22:31:01 UTC (rev 8055)
@@ -28,7 +28,7 @@
 #ifdef WIN32
 #  include "fl_dnd_win32.cxx"
 #elif defined(__APPLE__)
-#  include "fl_dnd_mac.cxx"
+//#  include "fl_dnd_mac.cxx"
 #else
 #  include "fl_dnd_x.cxx"
 #endif

Modified: branches/branch-1.3/src/fl_dnd_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_dnd_mac.cxx      2010-12-18 15:57:35 UTC (rev 
8054)
+++ branches/branch-1.3/src/fl_dnd_mac.cxx      2010-12-18 22:31:01 UTC (rev 
8055)
@@ -30,11 +30,11 @@
 
 #include <FL/Fl.H>
 
-extern int MACpreparedrag(void);
+extern int fl_mac_prepare_drag(void);
 
 int Fl::dnd()
 {
-  return MACpreparedrag();
+  return fl_mac_prepare_drag();
 }
   
 //

Modified: branches/branch-1.3/src/fl_read_image_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_read_image_mac.cxx       2010-12-18 15:57:35 UTC 
(rev 8054)
+++ branches/branch-1.3/src/fl_read_image_mac.cxx       2010-12-18 22:31:01 UTC 
(rev 8055)
@@ -26,7 +26,6 @@
 //
 
 #include <config.h>
-extern unsigned char *MACbitmapFromRectOfWindow(Fl_Window *win, int x, int y, 
int w, int h, int *bytesPerPixel);
 
 //
 // 'fl_read_image()' - Read an image from the current window or off-screen 
buffer.
@@ -54,7 +53,7 @@
   else { // reading from current window
     Fl_Window *window = Fl_Window::current();
     while(window->window()) window = window->window();
-    base = MACbitmapFromRectOfWindow(window,x,y,w,h,&delta);
+    base = Fl_X::bitmap_from_window_rect(window,x,y,w,h,&delta);
     rowBytes = delta*w;
     x = y = 0;
     }

Modified: branches/branch-1.3/src/fl_rect.cxx
===================================================================
--- branches/branch-1.3/src/fl_rect.cxx 2010-12-18 15:57:35 UTC (rev 8054)
+++ branches/branch-1.3/src/fl_rect.cxx 2010-12-18 22:31:01 UTC (rev 8055)
@@ -580,7 +580,7 @@
       CombineRgn(r,r,current,RGN_AND);
 #elif defined(__APPLE_QUARTZ__)
       XDestroyRegion(r);
-      r = MacRectRegionIntersect(current, x,y,w,h);
+      r = Fl_X::intersect_region_and_rect(current, x,y,w,h);
 #else
 # error unsupported platform
 #endif

Modified: branches/branch-1.3/src/fl_scroll_area.cxx
===================================================================
--- branches/branch-1.3/src/fl_scroll_area.cxx  2010-12-18 15:57:35 UTC (rev 
8054)
+++ branches/branch-1.3/src/fl_scroll_area.cxx  2010-12-18 22:31:01 UTC (rev 
8055)
@@ -151,8 +151,7 @@
   BitBlt(fl_gc, dest_x, dest_y, src_w, src_h, fl_gc, src_x, src_y,SRCCOPY);
 
 #elif defined(__APPLE_QUARTZ__)
-  extern CGImageRef MAC_CGImageFromRectOfWindow(Fl_Window*, int x, int y, int 
w, int h);
-  CGImageRef img = MAC_CGImageFromRectOfWindow(Fl_Window::current(), src_x, 
src_y, src_w, src_h);
+  CGImageRef img = Fl_X::CGImage_from_window_rect(Fl_Window::current(), src_x, 
src_y, src_w, src_h);
   CGRect rect = { { dest_x, dest_y }, { src_w, src_h } };
   Fl_X::q_begin_image(rect, 0, 0, src_w, src_h);
   CGContextDrawImage(fl_gc, rect, img);

Modified: branches/branch-1.3/src/screen_xywh.cxx
===================================================================
--- branches/branch-1.3/src/screen_xywh.cxx     2010-12-18 15:57:35 UTC (rev 
8054)
+++ branches/branch-1.3/src/screen_xywh.cxx     2010-12-18 22:31:01 UTC (rev 
8055)
@@ -107,9 +107,8 @@
 #elif defined(__APPLE__)
 XRectangle screens[16];
 
-extern int MACscreen_init(XRectangle screens[]);
 static void screen_init() {
-  num_screens = MACscreen_init(screens);
+  num_screens = Fl_X::screen_init(screens);
 }
 #elif HAVE_XINERAMA
 #  include <X11/extensions/Xinerama.h>

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to