mirror of
https://github.com/fltk/fltk.git
synced 2026-06-03 22:17:12 +08:00
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
This commit is contained in:
+1
-5
@@ -517,11 +517,7 @@ public:
|
|||||||
static const char *class_id;
|
static const char *class_id;
|
||||||
const char *class_name() {return class_id;};
|
const char *class_name() {return class_id;};
|
||||||
/** \brief A constructor that sets the graphics driver used by the display */
|
/** \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) {
|
Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
|
||||||
#ifdef __APPLE__
|
|
||||||
fl_open_display();
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
/** Returns the platform display device. */
|
/** Returns the platform display device. */
|
||||||
static inline Fl_Display_Device *display_device() {return _display;};
|
static inline Fl_Display_Device *display_device() {return _display;};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -72,6 +72,14 @@ void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int
|
|||||||
dy = descent();
|
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$".
|
// End of "$Id$".
|
||||||
|
|||||||
+1
-3
@@ -293,6 +293,7 @@ static DataReady dataready;
|
|||||||
|
|
||||||
void DataReady::AddFD(int n, int events, void (*cb)(int, void*), void *v)
|
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);
|
RemoveFD(n, events);
|
||||||
int i = nfds++;
|
int i = nfds++;
|
||||||
if (i >= fd_array_size)
|
if (i >= fd_array_size)
|
||||||
@@ -1289,9 +1290,6 @@ void fl_open_display() {
|
|||||||
while (ign_event);
|
while (ign_event);
|
||||||
|
|
||||||
fl_default_cursor = [NSCursor arrowCursor];
|
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
|
// bring the application into foreground without a 'CARB' resource
|
||||||
Boolean same_psn;
|
Boolean same_psn;
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
|
|||||||
q_name = strdup(name);
|
q_name = strdup(name);
|
||||||
size = Size;
|
size = Size;
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
#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!
|
if (fl_mac_os_version >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL on 10.4 also!
|
||||||
CFStringRef str = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);
|
CFStringRef str = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);
|
||||||
fontref = CTFontCreateWithName(str, size, NULL);
|
fontref = CTFontCreateWithName(str, size, NULL);
|
||||||
|
|||||||
@@ -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 (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 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(fl_mac_os_version >= 0x1050) {
|
||||||
//if(CTFontCreateWithFontDescriptor != NULL) {// CTFontCreateWithFontDescriptor != NULL on 10.4 also!
|
//if(CTFontCreateWithFontDescriptor != NULL) {// CTFontCreateWithFontDescriptor != NULL on 10.4 also!
|
||||||
int value[1] = {1};
|
int value[1] = {1};
|
||||||
|
|||||||
Reference in New Issue
Block a user