Author: manolo
Date: 2011-03-01 03:58:36 -0800 (Tue, 01 Mar 2011)
New Revision: 8488
Log:
STR 2580: Fl::add_fd() now calls fl_open_display() because that is necessary 
for the fd event 
to be recovered by the event loop. Before main() is called, only 
fl_mac_os_version is 
initialized.

Modified:
   branches/branch-1.3/FL/Fl_Device.H
   branches/branch-1.3/src/Fl_Device.cxx
   branches/branch-1.3/src/Fl_cocoa.mm
   branches/branch-1.3/src/fl_font_mac.cxx
   branches/branch-1.3/src/fl_set_fonts_mac.cxx

Modified: branches/branch-1.3/FL/Fl_Device.H
===================================================================
--- branches/branch-1.3/FL/Fl_Device.H  2011-02-28 17:57:19 UTC (rev 8487)
+++ branches/branch-1.3/FL/Fl_Device.H  2011-03-01 11:58:36 UTC (rev 8488)
@@ -517,11 +517,7 @@
   static const char *class_id;
   const char *class_name() {return class_id;};
   /** \brief A constructor that sets the graphics driver used by the display */
-  Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device( 
graphics_driver) {
-#ifdef __APPLE__
-    fl_open_display();
-#endif
-  };
+  Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
   /** Returns the platform display device. */
   static inline Fl_Display_Device *display_device() {return _display;};
 };

Modified: branches/branch-1.3/src/Fl_Device.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Device.cxx       2011-02-28 17:57:19 UTC (rev 
8487)
+++ branches/branch-1.3/src/Fl_Device.cxx       2011-03-01 11:58:36 UTC (rev 
8488)
@@ -72,7 +72,15 @@
   dy = descent();
 }
 
+Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : 
Fl_Surface_Device( graphics_driver) {
+#ifdef __APPLE__
+  SInt32 version;
+  Gestalt(gestaltSystemVersion, &version);
+  fl_mac_os_version = (int)version;
+#endif
+};
 
+
 //
 // End of "$Id$".
 //

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-02-28 17:57:19 UTC (rev 8487)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-03-01 11:58:36 UTC (rev 8488)
@@ -293,6 +293,7 @@
 
 void DataReady::AddFD(int n, int events, void (*cb)(int, void*), void *v)
 {
+  fl_open_display(); // necessary for NSApp to be defined
   RemoveFD(n, events);
   int i = nfds++;
   if (i >= fd_array_size) 
@@ -1289,9 +1290,6 @@
     while (ign_event);
     
     fl_default_cursor = [NSCursor arrowCursor];
-    SInt32 version;
-    Gestalt(gestaltSystemVersion, &version);
-    fl_mac_os_version = (int)version;
 
     // bring the application into foreground without a 'CARB' resource
     Boolean same_psn;

Modified: branches/branch-1.3/src/fl_font_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_font_mac.cxx     2011-02-28 17:57:19 UTC (rev 
8487)
+++ branches/branch-1.3/src/fl_font_mac.cxx     2011-03-01 11:58:36 UTC (rev 
8488)
@@ -46,7 +46,6 @@
   q_name = strdup(name);
   size = Size;
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-if (fl_mac_os_version == 0) fl_open_display();
 if (fl_mac_os_version >= 0x1050) {//unfortunately, CTFontCreateWithName != 
NULL on 10.4 also!
   CFStringRef str = CFStringCreateWithCString(NULL, name, 
kCFStringEncodingUTF8);
   fontref = CTFontCreateWithName(str, size, NULL);

Modified: branches/branch-1.3/src/fl_set_fonts_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_set_fonts_mac.cxx        2011-02-28 17:57:19 UTC 
(rev 8487)
+++ branches/branch-1.3/src/fl_set_fonts_mac.cxx        2011-03-01 11:58:36 UTC 
(rev 8488)
@@ -70,7 +70,6 @@
 if (fl_free_font > FL_FREE_FONT) return (Fl_Font)fl_free_font; // if already 
called
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-  if(fl_mac_os_version == 0) fl_open_display();
 if(fl_mac_os_version >= 0x1050) {
 //if(CTFontCreateWithFontDescriptor != NULL) {// 
CTFontCreateWithFontDescriptor != NULL on 10.4 also!
   int value[1] = {1};

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

Reply via email to