diff options
| author | Manolo Gouy <Manolo> | 2010-12-17 10:43:41 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-12-17 10:43:41 +0000 |
| commit | f3c7efc8d2feb9a67b6fdff09f4f428125eb5b79 (patch) | |
| tree | 63543707427edef3bfc49af7bee60ede908527fe /src | |
| parent | ff4cafeb303cd8e9d24b62c45661f6da5067d556 (diff) | |
The 3 objective-c++ files used for the Mac OS X support are no longer included
by other files but added to the list of source files to be compiled
for Mac OS X only. Support files for autoconf/configure/make, CMake and Xcode
are also modified accordingly.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8049 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 15 | ||||
| -rw-r--r-- | src/Fl.cxx | 17 | ||||
| -rw-r--r-- | src/Fl_Native_File_Chooser.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_Printer.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 10 | ||||
| -rw-r--r-- | src/Makefile | 27 |
6 files changed, 46 insertions, 27 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3d4d569d1..8b35ac57a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -194,13 +194,18 @@ set(CFILES ) if(APPLE) - set_source_files_properties( - Fl.cxx Fl_Native_File_Chooser.cxx Fl_Printer.cxx - PROPERTIES COMPILE_FLAGS "-x objective-c++") + set(MMFILES + Fl_cocoa.mm + Fl_Quartz_Printer.mm + Fl_Native_File_Chooser_MAC.mm + ) +else() + set(MMFILES + ) endif(APPLE) ####################################################################### -add_library(fltk STATIC ${CPPFILES} ${CFILES} fl_call_main.c) +add_library(fltk STATIC ${CPPFILES} ${MMFILES} ${CFILES} fl_call_main.c) set_target_properties(fltk PROPERTIES CLEAN_DIRECT_OUTPUT 1) if(MSVC) if(OPTION_LARGE_FILE) @@ -307,7 +312,7 @@ endif(OPENGL_FOUND) if(OPTION_BUILD_SHARED_LIBS) ####################################################################### -add_library(fltk_SHARED SHARED ${CPPFILES} ${CFILES}) +add_library(fltk_SHARED SHARED ${CPPFILES} ${MMFILES} ${CFILES}) set_target_properties(fltk_SHARED PROPERTIES CLEAN_DIRECT_OUTPUT 1 VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR} diff --git a/src/Fl.cxx b/src/Fl.cxx index 42d3fff03..845e7b7de 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -48,10 +48,6 @@ #include <stdlib.h> #include "flstring.h" -#if defined(__APPLE__) -#import <Cocoa/Cocoa.h> -#endif - #if defined(DEBUG) || defined(DEBUG_WATCH) # include <stdio.h> #endif // DEBUG || DEBUG_WATCH @@ -63,6 +59,8 @@ HBRUSH fl_brush_action(int action); void fl_cleanup_pens(void); 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); #endif // WIN32 // @@ -420,13 +418,7 @@ double Fl::wait(double time_to_wait) { // the idle function may turn off idle, we can then wait: if (idle) time_to_wait = 0.0; } - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - flush(); - if (idle && !in_idle) // 'idle' may have been set within flush() - time_to_wait = 0.0; - double retval = fl_wait(time_to_wait); - [pool release]; - return retval; + return fl_MAC_flush_and_wait(time_to_wait, in_idle); #else @@ -1556,8 +1548,7 @@ void Fl_Window::flush() { #ifdef WIN32 # include "Fl_win32.cxx" -#elif defined(__APPLE__) -# include "Fl_cocoa.mm" +//#elif defined(__APPLE__) #endif // diff --git a/src/Fl_Native_File_Chooser.cxx b/src/Fl_Native_File_Chooser.cxx index 2941c9b62..02f3ab9c1 100644 --- a/src/Fl_Native_File_Chooser.cxx +++ b/src/Fl_Native_File_Chooser.cxx @@ -32,7 +32,7 @@ // Use Apple's chooser #ifdef __APPLE__ -#include "Fl_Native_File_Chooser_MAC.mm" +//#include "Fl_Native_File_Chooser_MAC.mm" #endif // All else falls back to FLTK's own chooser diff --git a/src/Fl_Printer.cxx b/src/Fl_Printer.cxx index 7ac7bf203..94d53e280 100644 --- a/src/Fl_Printer.cxx +++ b/src/Fl_Printer.cxx @@ -29,7 +29,7 @@ #include <FL/Fl_Printer.H> #ifdef __APPLE__ -#include "Fl_Quartz_Printer.mm" +//#include "Fl_Quartz_Printer.mm" #elif defined(WIN32) #include "Fl_GDI_Printer.cxx" #endif diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 49deb785f..2c8702313 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -703,6 +703,16 @@ int fl_wait( double time ) return (got_events); } +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() + time_to_wait = 0.0; + double retval = fl_wait(time_to_wait); + [pool release]; + return retval; +} + // updates Fl::e_x, Fl::e_y, Fl::e_x_root, and Fl::e_y_root static void update_e_xy_and_e_xy_root(NSWindow *nsw) { diff --git a/src/Makefile b/src/Makefile index 286921eba..924d8f8cf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -166,7 +166,12 @@ CPPFILES = \ screen_xywh.cxx \ fl_utf8.cxx \ ps_image.cxx - + +OBJCPPFILES = \ + Fl_cocoa.mm \ + Fl_Quartz_Printer.mm \ + Fl_Native_File_Chooser_MAC.mm + FLCPPFILES = \ forms_compatability.cxx \ forms_bitmap.cxx \ @@ -215,7 +220,12 @@ UTF8CFILES = \ include ../makeinclude -OBJECTS = $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) $(UTF8CFILES:.c=.o) +MMFILES = $(shell \ + if [ $(USEMMFILES) = Yes ]; then echo $(OBJCPPFILES);\ + fi) + + +OBJECTS = $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) $(UTF8CFILES:.c=.o) GLOBJECTS = $(GLCPPFILES:.cxx=.o) FLOBJECTS = $(FLCPPFILES:.cxx=.o) IMGOBJECTS = $(IMGCPPFILES:.cxx=.o) @@ -472,8 +482,8 @@ clean: libfltk_gl.dylib libfltk_images.dylib \ cmap core -depend: $(CPPFILES) $(FLCPPFILES) $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES) - makedepend -Y -I.. -f makedepend $(CPPFILES) $(FLCPPFILES) \ +depend: $(CPPFILES) $(MMFILES) $(FLCPPFILES) $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES) + makedepend -Y -I.. -f makedepend $(CPPFILES) $(MMFILES) $(FLCPPFILES) \ $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES) # Automatically generated dependencies... generated on a Linux/Unix host ! @@ -484,8 +494,10 @@ include makedepend # Please add only non-Linux/Unix files or such that are optional # (like "*xft*") here: Fl_get_key.o: Fl_get_key_mac.cxx Fl_get_key_win32.cxx -Fl_Native_File_Chooser.o : Fl_Native_File_Chooser_MAC.mm Fl_Native_File_Chooser_WIN32.cxx -Fl.o: Fl_mac.cxx Fl_win32.cxx Fl_cocoa.mm +Fl_Native_File_Chooser.o : Fl_Native_File_Chooser_WIN32.cxx +Fl_Native_File_Chooser_MAC.o: Fl_Native_File_Chooser_MAC.mm +Fl.o: Fl_win32.cxx +Fl_cocoa.o: Fl_cocoa.mm fl_color.o: fl_color_mac.cxx fl_color_win32.cxx fl_dnd.o: fl_dnd_mac.cxx fl_dnd_win32.cxx fl_dnd_x.cxx fl_draw_image.o: fl_draw_image_mac.cxx fl_draw_image_win32.cxx @@ -493,7 +505,8 @@ fl_font.o: fl_font_mac.cxx fl_font_x.cxx fl_font_xft.cxx fl_font_win32.cxx fl_read_image.o: fl_read_image_mac.cxx fl_read_image_win32.cxx fl_set_fonts.o: fl_set_fonts_mac.cxx fl_set_fonts_x.cxx \ fl_set_fonts_xft.cxx fl_set_fonts_win32.cxx -Fl_Printer.o: Fl_Quartz_Printer.mm Fl_GDI_Printer.cxx Fl_PostScript.cxx +Fl_Printer.o: Fl_GDI_Printer.cxx Fl_PostScript.cxx +Fl_Quartz_Printer.o: Fl_Quartz_Printer.mm fl_arci.o: ../FL/mac.H ../FL/win32.H Fl_arg.o: ../FL/mac.H ../FL/win32.H fl_ask.o: ../FL/mac.H ../FL/win32.H |
