summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-03-01 11:58:36 +0000
committerManolo Gouy <Manolo>2011-03-01 11:58:36 +0000
commitf7d7eff7ad584b22ef43211f833073e0dad5ff10 (patch)
tree150ebe681186c2972def5f93a298ddf15e399762 /src
parent1a4fd8ecc3e7b16fcedca72a0f6326edf3feb06a (diff)
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. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8488 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Device.cxx8
-rw-r--r--src/Fl_cocoa.mm4
-rw-r--r--src/fl_font_mac.cxx1
-rw-r--r--src/fl_set_fonts_mac.cxx1
4 files changed, 9 insertions, 5 deletions
diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx
index 54a3224a3..2a7ff08be 100644
--- a/src/Fl_Device.cxx
+++ b/src/Fl_Device.cxx
@@ -72,6 +72,14 @@ void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int
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$".
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 57b03a889..eee31a9d7 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -293,6 +293,7 @@ static DataReady dataready;
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 @@ void fl_open_display() {
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;
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index 1ee8342ba..14b7d3053 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -46,7 +46,6 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
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);
diff --git a/src/fl_set_fonts_mac.cxx b/src/fl_set_fonts_mac.cxx
index 8d4c48b86..cfe2f7f20 100644
--- a/src/fl_set_fonts_mac.cxx
+++ b/src/fl_set_fonts_mac.cxx
@@ -70,7 +70,6 @@ Fl_Font Fl::set_fonts(const char* xstarname) {
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};