Browse Source

Mark places that need to be refactored with // PORTME:

Searching for __APPLE, WIN32 or X11 did give me many false results. I instead marked most ifdef's that I would like to get rid of with the text // PORTME:, so they can be easily found by a global search.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11155 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/1/head
Matthias Melcher 9 years ago
parent
commit
50ee3bcd66
  1. 4
      FL/Enumerations.H
  2. 6
      FL/Fl.H
  3. 2
      FL/Fl_Cairo.H
  4. 4
      FL/Fl_Copy_Surface.H
  5. 2
      FL/Fl_Gl_Window.H
  6. 2
      FL/Fl_Graphics_Driver.H
  7. 4
      FL/Fl_Image_Surface.H
  8. 2
      FL/Fl_Menu_Item.H
  9. 8
      FL/Fl_Native_File_Chooser.H
  10. 6
      FL/Fl_PostScript.H
  11. 10
      FL/Fl_Printer.H
  12. 4
      FL/Fl_Sys_Menu_Bar.H
  13. 2
      FL/Fl_Tooltip.H
  14. 8
      FL/Fl_Window.H
  15. 4
      FL/fl_utf8.h
  16. 6
      FL/gl.h
  17. 2
      FL/glu.h
  18. 1
      FL/mac.H
  19. 2
      FL/x.H
  20. 40
      src/Fl.cxx
  21. 14
      src/Fl_Copy_Surface.cxx
  22. 4
      src/Fl_Double_Window.cxx
  23. 10
      src/Fl_File_Browser.cxx
  24. 2
      src/Fl_File_Chooser2.cxx
  25. 2
      src/Fl_File_Icon.cxx
  26. 14
      src/Fl_Font.H
  27. 8
      src/Fl_Gl_Choice.H
  28. 16
      src/Fl_Gl_Choice.cxx
  29. 14
      src/Fl_Gl_Device_Plugin.cxx
  30. 6
      src/Fl_Gl_Overlay.cxx
  31. 44
      src/Fl_Gl_Window.cxx
  32. 12
      src/Fl_Image_Surface.cxx
  33. 32
      src/Fl_Input.cxx
  34. 10
      src/Fl_Input_.cxx
  35. 6
      src/Fl_Menu.cxx
  36. 2
      src/Fl_Native_File_Chooser.cxx
  37. 8
      src/Fl_Paged_Device.cxx
  38. 8
      src/Fl_PostScript.cxx
  39. 12
      src/Fl_Preferences.cxx
  40. 10
      src/Fl_Printer.cxx
  41. 4
      src/Fl_Sys_Menu_Bar.mm
  42. 16
      src/Fl_Text_Display.cxx
  43. 10
      src/Fl_Text_Editor.cxx
  44. 4
      src/Fl_Tooltip.cxx
  45. 2
      src/Fl_Tree_Item.cxx
  46. 14
      src/Fl_Tree_Prefs.cxx
  47. 6
      src/Fl_Window.cxx
  48. 2
      src/Fl_Window_fullscreen.cxx
  49. 2
      src/Fl_Window_hotspot.cxx
  50. 2
      src/Fl_Window_iconize.cxx
  51. 16
      src/Fl_Window_shape.cxx
  52. 2
      src/Fl_abort.cxx
  53. 24
      src/Fl_arg.cxx
  54. 4
      src/Fl_cocoa.mm
  55. 16
      src/Fl_compose.cxx
  56. 4
      src/Fl_display.cxx
  57. 2
      src/Fl_get_key.cxx
  58. 10
      src/Fl_get_system_colors.cxx
  59. 6
      src/Fl_grab.cxx
  60. 2
      src/Fl_own_colormap.cxx
  61. 2
      src/Fl_visual.cxx
  62. 2
      src/Fl_x.cxx
  63. 8
      src/config_lib.h
  64. 2
      src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
  65. 8
      src/drivers/Cocoa/Fl_Cocoa_Window_Driver.h
  66. 80
      src/drivers/Quartz/Fl_Quartz_Display_Device.cxx
  67. 35
      src/drivers/Quartz/Fl_Quartz_Display_Device.h
  68. 4
      src/filename_absolute.cxx
  69. 2
      src/filename_ext.cxx
  70. 2
      src/filename_isdir.cxx
  71. 16
      src/filename_list.cxx
  72. 2
      src/fl_call_main.c
  73. 2
      src/fl_dnd.cxx
  74. 8
      src/fl_draw_pixmap.cxx
  75. 2
      src/fl_encoding_latin1.cxx
  76. 2
      src/fl_encoding_mac_roman.cxx
  77. 4
      src/fl_font.cxx
  78. 12
      src/fl_open_uri.cxx
  79. 6
      src/fl_overlay.cxx
  80. 8
      src/fl_read_image.cxx
  81. 2
      src/fl_scroll_area.cxx
  82. 6
      src/fl_set_font.cxx
  83. 16
      src/fl_shortcut.cxx
  84. 2
      src/fl_utf.c
  85. 2
      src/fl_utf8.cxx
  86. 2
      src/forms_timer.cxx
  87. 4
      src/gl_draw.cxx
  88. 2
      src/gl_start.cxx
  89. 2
      src/xutf8/is_right2left.c
  90. 2
      src/xutf8/keysym2Ucs.c
  91. 4
      src/xutf8/lcUniConv/cp936ext.h
  92. 2
      src/xutf8/utf8Input.c
  93. 2
      src/xutf8/utf8Utils.c
  94. 2
      src/xutf8/utf8Wrap.c

4
FL/Enumerations.H

@ -574,7 +574,7 @@ enum Fl_When { // Fl_Widget::when():
#define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now #define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now
// FIXME: Unicode needs 24 bits! // FIXME: Unicode needs 24 bits!
#ifdef __APPLE__ #ifdef __APPLE__ // look and feel
# define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X # define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
# define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X # define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
@ -584,7 +584,7 @@ enum Fl_When { // Fl_Widget::when():
#else #else
# define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X # define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
# define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X # define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
#endif // __APPLE__ #endif // __APPLE__ look and feel
/*@}*/ // group: Event States /*@}*/ // group: Event States

6
FL/Fl.H

@ -54,7 +54,7 @@ struct Fl_Label;
# else # else
# define FL_SOCKET int # define FL_SOCKET int
# endif # endif
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: socket types
# define FL_SOCKET int # define FL_SOCKET int
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: define a type for FL_SOCKET" # pragma message "FL_PORTING: define a type for FL_SOCKET"
@ -199,7 +199,7 @@ public: // should be private!
static Fl_Window* grab_; static Fl_Window* grab_;
static int compose_state; // used for dead keys (WIN32) or marked text (MacOS) static int compose_state; // used for dead keys (WIN32) or marked text (MacOS)
static void call_screen_init(); // recompute screen number and dimensions static void call_screen_init(); // recompute screen number and dimensions
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: additional functions
static void reset_marked_text(); // resets marked text static void reset_marked_text(); // resets marked text
static void insertion_point_location(int x, int y, int height); // sets window coordinates & height of insertion point static void insertion_point_location(int x, int y, int height); // sets window coordinates & height of insertion point
#elif defined(WIN32) #elif defined(WIN32)
@ -907,7 +907,7 @@ int main() {
*/ */
static void copy(const char* stuff, int len, int destination = 0, const char *type = Fl::clipboard_plain_text); // platform dependent static void copy(const char* stuff, int len, int destination = 0, const char *type = Fl::clipboard_plain_text); // platform dependent
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: additional functions
// not needed // not needed
#elif defined(WIN32) #elif defined(WIN32)
// not needed // not needed

2
FL/Fl_Cairo.H

@ -33,7 +33,7 @@
# include <cairo-xlib.h> # include <cairo-xlib.h>
#elif defined(WIN32) #elif defined(WIN32)
# include <cairo-win32.h> # include <cairo-win32.h>
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: Cairo Support
# include <cairo-quartz.h> # include <cairo-quartz.h>
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: is the Cairo library available on this platform?" # pragma message "FL_PORTING: is the Cairo library available on this platform?"

4
FL/Fl_Copy_Surface.H

@ -53,7 +53,7 @@ private:
int width; int width;
int height; int height;
Fl_Paged_Device *helper; Fl_Paged_Device *helper;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform surface driver
CFMutableDataRef pdfdata; CFMutableDataRef pdfdata;
CGContextRef oldgc; CGContextRef oldgc;
CGContextRef gc; CGContextRef gc;
@ -86,7 +86,7 @@ public:
int h() { return height; } int h() { return height; }
}; };
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform surface driver
/* Mac class to reimplement Fl_Paged_Device::printable_rect() */ /* Mac class to reimplement Fl_Paged_Device::printable_rect() */
class FL_EXPORT Fl_Quartz_Surface_ : public Fl_System_Printer { class FL_EXPORT Fl_Quartz_Surface_ : public Fl_System_Printer {

2
FL/Fl_Gl_Window.H

@ -239,7 +239,7 @@ public:
Fl::event_y() to the pixel units used by the OpenGL source code. Fl::event_y() to the pixel units used by the OpenGL source code.
\version 1.3.4 \version 1.3.4
*/ */
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: additional functionality
int pixels_per_unit(); int pixels_per_unit();
#elif defined(WIN32) #elif defined(WIN32)
int pixels_per_unit() { return 1; } int pixels_per_unit() { return 1; }

2
FL/Fl_Graphics_Driver.H

@ -51,7 +51,7 @@ typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
#ifdef WIN32 #ifdef WIN32
typedef int COORD_T; typedef int COORD_T;
# define XPOINT XPoint # define XPOINT XPoint
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform specific types
typedef float COORD_T; typedef float COORD_T;
typedef struct { float x; float y; } QPoint; typedef struct { float x; float y; } QPoint;
# define XPOINT QPoint # define XPOINT QPoint

4
FL/Fl_Image_Surface.H

@ -49,7 +49,7 @@ private:
int width; int width;
int height; int height;
Fl_Paged_Device *helper; Fl_Paged_Device *helper;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform image surface driver
#elif defined(WIN32) #elif defined(WIN32)
HDC _sgc; HDC _sgc;
Window _sw; Window _sw;
@ -73,7 +73,7 @@ public:
void draw_decorated_window(Fl_Window* win, int delta_x = 0, int delta_y = 0); void draw_decorated_window(Fl_Window* win, int delta_x = 0, int delta_y = 0);
}; };
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform surface driver
/* Mac class to implement translate()/untranslate() for a flipped bitmap graphics context */ /* Mac class to implement translate()/untranslate() for a flipped bitmap graphics context */
class FL_EXPORT Fl_Quartz_Flipped_Surface_ : public Fl_Quartz_Surface_ { class FL_EXPORT Fl_Quartz_Flipped_Surface_ : public Fl_Quartz_Surface_ {
public: public:

2
FL/Fl_Menu_Item.H

@ -22,7 +22,7 @@
# include "Fl_Widget.H" # include "Fl_Widget.H"
# include "Fl_Image.H" # include "Fl_Image.H"
# if (defined(__APPLE__) || defined(FL_PORTING)) && defined(check) # if (defined(__APPLE__) || defined(FL_PORTING)) && defined(check) // name conflict
# undef check # undef check
# endif # endif

8
FL/Fl_Native_File_Chooser.H

@ -40,7 +40,7 @@ typedef void fl_BROWSEINFOW;
# include <FL/filename.H> // FL_EXPORT # include <FL/filename.H> // FL_EXPORT
// Use Apple's chooser // Use Apple's chooser
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: native file chooser support
# define MAXFILTERS 80 # define MAXFILTERS 80
# include <FL/filename.H> // FL_EXPORT # include <FL/filename.H> // FL_EXPORT
@ -192,7 +192,7 @@ private:
void clear_filters(); void clear_filters();
void add_filter(const char *, const char *); void add_filter(const char *, const char *);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: native file chooser support
private: private:
int _btype; // kind-of browser to show() int _btype; // kind-of browser to show()
int _options; // general options int _options; // general options
@ -244,7 +244,7 @@ private:
}; };
#if !defined(__APPLE__) && !defined(WIN32) && !defined(FL_PORTING) #if !defined(__APPLE__) && !defined(WIN32) && !defined(FL_PORTING) // PORTME: FLTK file chooser option
class FL_EXPORT Fl_FLTK_File_Chooser { class FL_EXPORT Fl_FLTK_File_Chooser {
friend class Fl_Native_File_Chooser; friend class Fl_Native_File_Chooser;
protected: protected:
@ -328,7 +328,7 @@ private:
static int custom_gtk_filter_function(const GtkFileFilterInfo*, Fl_GTK_File_Chooser::pair*); static int custom_gtk_filter_function(const GtkFileFilterInfo*, Fl_GTK_File_Chooser::pair*);
static void free_pair(pair *p); static void free_pair(pair *p);
}; };
#endif // !defined(__APPLE__) && !defined(WIN32) #endif // !defined(__APPLE__) && !defined(WIN32) // PORTME: native file chooser option
#endif /*FL_NATIVE_FILE_CHOOSER_H*/ #endif /*FL_NATIVE_FILE_CHOOSER_H*/

6
FL/Fl_PostScript.H

@ -199,7 +199,7 @@ class Clip {
void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1); void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1);
void draw(const char* s, int nBytes, int x, int y) {transformed_draw(s,nBytes,x,y); }; void draw(const char* s, int nBytes, int x, int y) {transformed_draw(s,nBytes,x,y); };
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: additional functionality
void draw(const char* s, int nBytes, float x, float y) {transformed_draw(s,nBytes,x,y); }; void draw(const char* s, int nBytes, float x, float y) {transformed_draw(s,nBytes,x,y); };
#elif defined(WIN32) #elif defined(WIN32)
// not needed // not needed
@ -233,7 +233,7 @@ class Clip {
two variants of which are usable and allow to specify what page format and layout are desired. two variants of which are usable and allow to specify what page format and layout are desired.
*/ */
class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device { class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform specifics for PostScript
CGContextRef gc; CGContextRef gc;
#elif defined(WIN32) #elif defined(WIN32)
// not needed // not needed
@ -265,7 +265,7 @@ public:
void untranslate(void); void untranslate(void);
int end_page (void); int end_page (void);
void end_job(void); void end_job(void);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform specifics for PostScript
void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); } void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); }
#elif defined(WIN32) #elif defined(WIN32)
// not needed // not needed

10
FL/Fl_Printer.H

@ -32,7 +32,7 @@
#include <stdio.h> #include <stdio.h>
#ifdef WIN32 #ifdef WIN32
#include <commdlg.h> #include <commdlg.h>
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform printer driver
// not needed // not needed
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: include files needed for printing support" # pragma message "FL_PORTING: include files needed for printing support"
@ -40,7 +40,7 @@
#include <FL/Fl_PostScript.H> #include <FL/Fl_PostScript.H>
#endif #endif
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) #if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: platform printer driver
/** /**
Print support under MSWindows and Mac OS. Print support under MSWindows and Mac OS.
@ -54,7 +54,7 @@ private:
/** \brief the printer's graphics context, if there's one, NULL otherwise */ /** \brief the printer's graphics context, if there's one, NULL otherwise */
void *gc; void *gc;
void set_current(void); void set_current(void);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform printer driver
float scale_x; float scale_x;
float scale_y; float scale_y;
float angle; // rotation angle in radians float angle; // rotation angle in radians
@ -88,7 +88,7 @@ public:
void untranslate(void); void untranslate(void);
int end_page (void); int end_page (void);
void end_job (void); void end_job (void);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform printer driver
void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y); void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y);
#endif #endif
/** \brief The destructor */ /** \brief The destructor */
@ -235,7 +235,7 @@ public:
~Fl_Printer(void); ~Fl_Printer(void);
private: private:
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: system printer driver
Fl_System_Printer *printer; Fl_System_Printer *printer;
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate your own Fl_xxx_Printer here" # pragma message "FL_PORTING: instantiate your own Fl_xxx_Printer here"

4
FL/Fl_Sys_Menu_Bar.H

@ -22,7 +22,7 @@
#include "Fl_Menu_Bar.H" #include "Fl_Menu_Bar.H"
#include "x.H" #include "x.H"
#if defined(__APPLE__) || defined(FL_DOXYGEN) #if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: system menu bar
/** /**
A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen. A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen.
@ -105,7 +105,7 @@ typedef Fl_Menu_Bar Fl_Sys_Menu_Bar;
typedef Fl_Menu_Bar Fl_Sys_Menu_Bar; typedef Fl_Menu_Bar Fl_Sys_Menu_Bar;
#endif // defined(__APPLE__) || defined(FL_DOXYGEN) #endif // defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: system menu bar
#endif // Fl_Sys_Menu_Bar_H #endif // Fl_Sys_Menu_Bar_H

2
FL/Fl_Tooltip.H

@ -97,7 +97,7 @@ public:
static int wrap_width() { return 400; } static int wrap_width() { return 400; }
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: additional functionality?
// the unique tooltip window // the unique tooltip window
static Fl_Window* current_window(void); static Fl_Window* current_window(void);
#elif defined(WIN32) #elif defined(WIN32)

8
FL/Fl_Window.H

@ -78,7 +78,7 @@ class FL_EXPORT Fl_Window : public Fl_Group {
#ifdef WIN32 #ifdef WIN32
HICON big_icon; HICON big_icon;
HICON small_icon; HICON small_icon;
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: per-window icons
// not needed // not needed
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: define storage for per-window icons here if needed" # pragma message "FL_PORTING: define storage for per-window icons here if needed"
@ -105,7 +105,7 @@ protected:
int lw_; ///< width of shape image int lw_; ///< width of shape image
int lh_; ///< height of shape image int lh_; ///< height of shape image
Fl_Image* shape_; ///< shape image Fl_Image* shape_; ///< shape image
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: per-window shape information
typedef struct CGImage* CGImageRef; typedef struct CGImage* CGImageRef;
CGImageRef mask; CGImageRef mask;
#elif defined(WIN32) #elif defined(WIN32)
@ -129,7 +129,7 @@ public:
\see void shape(const Fl_Image* img) \see void shape(const Fl_Image* img)
*/ */
inline void shape(const Fl_Image& b) { shape(&b); } inline void shape(const Fl_Image& b) { shape(&b); }
#if defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN) #if defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: per-window shape
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you need a combine_mask() function in Fl_Window?" # pragma message "FL_PORTING: do you need a combine_mask() function in Fl_Window?"
#else // X11 #else // X11
@ -456,7 +456,7 @@ public:
#ifdef WIN32 #ifdef WIN32
static void default_icons(HICON big_icon, HICON small_icon); static void default_icons(HICON big_icon, HICON small_icon);
void icons(HICON big_icon, HICON small_icon); void icons(HICON big_icon, HICON small_icon);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: per-window icon
// not needed // not needed
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: define functions to handle window icons here if needed" # pragma message "FL_PORTING: define functions to handle window icons here if needed"

4
FL/fl_utf8.h

@ -53,7 +53,7 @@
# undef chdir # undef chdir
# define chdir _chdir # define chdir _chdir
# endif # endif
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: should not be in the header
# include <wchar.h> # include <wchar.h>
# include <sys/stat.h> # include <sys/stat.h>
# define xchar wchar_t # define xchar wchar_t
@ -164,7 +164,7 @@ FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage)
/* OD: Attempt to convert a string in the current locale to UTF-8 */ /* OD: Attempt to convert a string in the current locale to UTF-8 */
FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage); FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform text encoding and conversion
// not needed // not needed
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to be able to convert from a local charset to utf8?" # pragma message "FL_PORTING: do you want to be able to convert from a local charset to utf8?"

6
FL/gl.h

@ -54,11 +54,11 @@
# endif # endif
# endif # endif
# ifdef __APPLE__ # ifdef __APPLE__ // PORTME: OpenGL path abstraction
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# else # else
# include <GL/gl.h> # include <GL/gl.h>
# endif // __APPLE__ # endif // __APPLE__ // PORTME: OpenGL Path abstraction
FL_EXPORT void gl_start(); FL_EXPORT void gl_start();
FL_EXPORT void gl_finish(); FL_EXPORT void gl_finish();
@ -89,7 +89,7 @@ FL_EXPORT void gl_draw(const char*, int n, int x, int y);
FL_EXPORT void gl_draw(const char*, int n, float x, float y); FL_EXPORT void gl_draw(const char*, int n, float x, float y);
FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align); FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align);
FL_EXPORT void gl_measure(const char*, int& x, int& y); FL_EXPORT void gl_measure(const char*, int& x, int& y);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: OpenGL platform texture
extern FL_EXPORT void gl_texture_pile_height(int max); extern FL_EXPORT void gl_texture_pile_height(int max);
extern FL_EXPORT int gl_texture_pile_height(); extern FL_EXPORT int gl_texture_pile_height();
#elif defined(WIN32) #elif defined(WIN32)

2
FL/glu.h

@ -38,7 +38,7 @@
# endif # endif
# endif # endif
# ifdef __APPLE__ # ifdef __APPLE__ // PORTME: OpenGL Path abstraction
# include <OpenGL/glu.h> # include <OpenGL/glu.h>
# else # else
# include <GL/glu.h> # include <GL/glu.h>

1
FL/mac.H

@ -138,7 +138,6 @@ extern NSCursor *fl_default_cursor;
// This object contains all mac-specific stuff about a window: // This object contains all mac-specific stuff about a window:
// WARNING: this object is highly subject to change! // WARNING: this object is highly subject to change!
class Fl_X { class Fl_X {
public: public:
Window xid; // pointer to the Cocoa window object (FLWindow*) Window xid; // pointer to the Cocoa window object (FLWindow*)
Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window) Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window)

2
FL/x.H

@ -28,7 +28,7 @@
# ifdef WIN32 # ifdef WIN32
# include "win32.H" # include "win32.H"
# elif defined(__APPLE__) # elif defined(__APPLE__) // PORTME: Fl_X Window Driver interface
# include "mac.H" # include "mac.H"
# elif defined(ANDROID) # elif defined(ANDROID)
# pragma message "A clean port requires a driver-style system for Fl_X" # pragma message "A clean port requires a driver-style system for Fl_X"

40
src/Fl.cxx

@ -60,7 +60,7 @@
#endif // DEBUG || DEBUG_WATCH #endif // DEBUG || DEBUG_WATCH
#ifdef WIN32 #ifdef WIN32
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: window driver and main loop
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement global variables for your platform here" # pragma message "FL_PORTING: implement global variables for your platform here"
#else // X11 #else // X11
@ -73,7 +73,7 @@ HBRUSH fl_brush_action(int action);
void fl_cleanup_pens(void); void fl_cleanup_pens(void);
void fl_release_dc(HWND,HDC); void fl_release_dc(HWND,HDC);
void fl_cleanup_dc_list(void); void fl_cleanup_dc_list(void);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform functions
extern double fl_mac_flush_and_wait(double time_to_wait); extern double fl_mac_flush_and_wait(double time_to_wait);
#endif // WIN32 #endif // WIN32
@ -159,7 +159,7 @@ bool Fl::cfg_sys_win32 = 0;
// //
// Globals... // Globals...
// //
#if defined(__APPLE__) || defined(FL_DOXYGEN) #if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: platform text
const char *Fl_Mac_App_Menu::about = "About %@"; const char *Fl_Mac_App_Menu::about = "About %@";
const char *Fl_Mac_App_Menu::print = "Print Front Window"; const char *Fl_Mac_App_Menu::print = "Print Front Window";
const char *Fl_Mac_App_Menu::services = "Services"; const char *Fl_Mac_App_Menu::services = "Services";
@ -167,7 +167,7 @@ const char *Fl_Mac_App_Menu::hide = "Hide %@";
const char *Fl_Mac_App_Menu::hide_others = "Hide Others"; const char *Fl_Mac_App_Menu::hide_others = "Hide Others";
const char *Fl_Mac_App_Menu::show = "Show All"; const char *Fl_Mac_App_Menu::show = "Show All";
const char *Fl_Mac_App_Menu::quit = "Quit %@"; const char *Fl_Mac_App_Menu::quit = "Quit %@";
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform text, system menu
#ifndef FL_DOXYGEN #ifndef FL_DOXYGEN
Fl_Widget *Fl::belowmouse_, Fl_Widget *Fl::belowmouse_,
*Fl::pushed_, *Fl::pushed_,
@ -341,7 +341,7 @@ int Fl::event_inside(const Fl_Widget *o) /*const*/ {
// implementation in Fl_win32.cxx // implementation in Fl_win32.cxx
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: core stuff from screen, platform, and window driver
// implementation in Fl_cocoa.mm (was Fl_mac.cxx) // implementation in Fl_cocoa.mm (was Fl_mac.cxx)
@ -557,7 +557,7 @@ static void run_checks()
} }
} }
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__) // PORTME: ??
static char in_idle; static char in_idle;
#endif #endif
@ -644,7 +644,7 @@ double Fl::wait(double time_to_wait) {
return fl_wait(time_to_wait); return fl_wait(time_to_wait);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform fl_wait
run_checks(); run_checks();
return fl_mac_flush_and_wait(time_to_wait); return fl_mac_flush_and_wait(time_to_wait);
@ -787,7 +787,7 @@ int Fl::check() {
\endcode \endcode
*/ */
int Fl::ready() { int Fl::ready() {
#if defined( WIN32 ) || defined(__APPLE__) #if defined( WIN32 ) || defined(__APPLE__) // PORTME: platform timeouts
// not used // not used
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: you may need to handle timers here." # pragma message "FL_PORTING: you may need to handle timers here."
@ -1071,7 +1071,7 @@ void Fl::focus(Fl_Widget *o) {
if (!w1) w1 = o->window(); if (!w1) w1 = o->window();
while (w1) { win=w1; w1=win->window(); } while (w1) { win=w1; w1=win->window(); }
if (win) { if (win) {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform window focus
if (fl_xfocus != win) { if (fl_xfocus != win) {
Fl_X *x = Fl_X::i(win); Fl_X *x = Fl_X::i(win);
if (x) x->set_key_window(); if (x) x->set_key_window();
@ -1210,7 +1210,7 @@ void fl_fix_focus() {
} }
} }
#if !(defined(WIN32) || defined(__APPLE__)) #if !(defined(WIN32) || defined(__APPLE__)) // PORTME: platform selection
extern Fl_Widget *fl_selection_requestor; // from Fl_x.cxx extern Fl_Widget *fl_selection_requestor; // from Fl_x.cxx
#endif #endif
@ -1230,7 +1230,7 @@ void fl_throw_focus(Fl_Widget *o) {
if (o->contains(Fl::pushed())) Fl::pushed_ = 0; if (o->contains(Fl::pushed())) Fl::pushed_ = 0;
#ifdef WIN32 #ifdef WIN32
// not used // not used
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform selection
// not used // not used
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: platform specific code when deleting a window" # pragma message "FL_PORTING: platform specific code when deleting a window"
@ -1457,7 +1457,7 @@ int Fl::handle_(int e, Fl_Window* window)
if (grab()) wi = grab(); if (grab()) wi = grab();
{ int ret; { int ret;
Fl_Widget* pbm = belowmouse(); Fl_Widget* pbm = belowmouse();
#ifdef __APPLE__ #ifdef __APPLE__ // bug fix
if (fl_mac_os_version < 100500) { if (fl_mac_os_version < 100500) {
// before 10.5, mouse moved events aren't sent to borderless windows such as tooltips // before 10.5, mouse moved events aren't sent to borderless windows such as tooltips
Fl_Window *tooltip = Fl_Tooltip::current_window(); Fl_Window *tooltip = Fl_Tooltip::current_window();
@ -1659,7 +1659,7 @@ void Fl_Window::hide() {
Fl_X** pp = &Fl_X::first; Fl_X** pp = &Fl_X::first;
for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return; for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return;
*pp = ip->next; *pp = ip->next;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform pointer handling
// MacOS X manages a single pointer per application. Make sure that hiding // 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 // a toplevel window will not leave us with some random pointer shape, or
// worst case, an invisible pointer // worst case, an invisible pointer
@ -1708,7 +1708,7 @@ void Fl_Window::hide() {
if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0); if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0);
# endif # endif
} }
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping
Fl_X::q_release_context(ip); Fl_X::q_release_context(ip);
if ( ip->xid == fl_window ) if ( ip->xid == fl_window )
fl_window = 0; fl_window = 0;
@ -1740,7 +1740,7 @@ void Fl_Window::hide() {
} }
delete[] doit; delete[] doit;
} }
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping
ip->destroy(); ip->destroy();
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: code to destroy a window on screen" # pragma message "FL_PORTING: code to destroy a window on screen"
@ -1774,13 +1774,13 @@ int Fl_Window::handle(int ev)
else { else {
#if defined(USE_X11) || defined(WIN32) #if defined(USE_X11) || defined(WIN32)
XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform window mapping
i->map(); i->map();
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: code to show a window on screen" # pragma message "FL_PORTING: code to show a window on screen"
#else #else
# error unsupported platform # error unsupported platform
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform window mapping
} }
break; break;
case FL_HIDE: case FL_HIDE:
@ -1798,7 +1798,7 @@ int Fl_Window::handle(int ev)
} }
#if defined(USE_X11) || defined(WIN32) #if defined(USE_X11) || defined(WIN32)
XUnmapWindow(fl_display, fl_xid(this)); XUnmapWindow(fl_display, fl_xid(this));
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping, again
i->unmap(); i->unmap();
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: code to hide a window from screen" # pragma message "FL_PORTING: code to hide a window from screen"
@ -1966,7 +1966,7 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
Fl_Region R = XRectangleRegion(X, Y, W, H); Fl_Region R = XRectangleRegion(X, Y, W, H);
CombineRgn(i->region, i->region, R, RGN_OR); CombineRgn(i->region, i->region, R, RGN_OR);
XDestroyRegion(R); XDestroyRegion(R);
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform damage region
CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H); CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H);
int j; // don't add a rectangle totally inside the Fl_Region int j; // don't add a rectangle totally inside the Fl_Region
for(j = 0; j < i->region->count; j++) { for(j = 0; j < i->region->count; j++) {
@ -2001,7 +2001,7 @@ void Fl_Window::flush() {
#ifdef WIN32 #ifdef WIN32
# include "Fl_win32.cxx" # include "Fl_win32.cxx"
//#elif defined(__APPLE__) //#elif defined(__APPLE__) // nothing here to see
#endif #endif

14
src/Fl_Copy_Surface.cxx

@ -21,7 +21,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform copy surface
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
Fl_Quartz_Surface_::Fl_Quartz_Surface_(int w, int h) : Fl_System_Printer(), width(w), height(h) { Fl_Quartz_Surface_::Fl_Quartz_Surface_(int w, int h) : Fl_System_Printer(), width(w), height(h) {
@ -75,7 +75,7 @@ Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) : Fl_Surface_Device(NULL)
{ {
width = w; width = w;
height = h; height = h;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform copy surface
helper = new Fl_Quartz_Surface_(width, height); helper = new Fl_Quartz_Surface_(width, height);
driver(helper->driver()); driver(helper->driver());
prepare_copy_pdf_and_tiff(w, h); prepare_copy_pdf_and_tiff(w, h);
@ -120,7 +120,7 @@ Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) : Fl_Surface_Device(NULL)
*/ */
Fl_Copy_Surface::~Fl_Copy_Surface() Fl_Copy_Surface::~Fl_Copy_Surface()
{ {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform copy surface
complete_copy_pdf_and_tiff(); complete_copy_pdf_and_tiff();
fl_gc = oldgc; fl_gc = oldgc;
delete (Fl_Quartz_Surface_*)helper; delete (Fl_Quartz_Surface_*)helper;
@ -165,7 +165,7 @@ void Fl_Copy_Surface::draw(Fl_Widget* widget, int delta_x, int delta_y)
void Fl_Copy_Surface::set_current() void Fl_Copy_Surface::set_current()
{ {
#if defined(__APPLE__) || defined(WIN32) #if defined(__APPLE__) || defined(WIN32) // PORTME: platform copy surface
fl_gc = gc; fl_gc = gc;
fl_window = (Window)1; fl_window = (Window)1;
Fl_Surface_Device::set_current(); Fl_Surface_Device::set_current();
@ -180,7 +180,7 @@ void Fl_Copy_Surface::set_current()
} }
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform copy surface
size_t Fl_Copy_Surface::MyPutBytes(void* info, const void* buffer, size_t count) size_t Fl_Copy_Surface::MyPutBytes(void* info, const void* buffer, size_t count)
{ {
@ -218,7 +218,7 @@ void Fl_Copy_Surface::prepare_copy_pdf_and_tiff(int w, int h)
CGContextSaveGState(gc); CGContextSaveGState(gc);
} }
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform copy surface
/** Copies a window and its borders and title bar to the clipboard. /** Copies a window and its borders and title bar to the clipboard.
@ -232,7 +232,7 @@ void Fl_Copy_Surface::draw_decorated_window(Fl_Window* win, int delta_x, int del
} }
#if defined(WIN32) #if defined(WIN32)
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform copy surface
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you need a helper class for your graphics driver" # pragma message "FL_PORTING: do you need a helper class for your graphics driver"
#elif !defined(FL_DOXYGEN) #elif !defined(FL_DOXYGEN)

4
src/Fl_Double_Window.cxx

@ -137,7 +137,7 @@ void Fl_Double_Window::flush(int eraseoverlay) {
#if defined(USE_X11) || defined(WIN32) #if defined(USE_X11) || defined(WIN32)
myi->other_xid = fl_create_offscreen(w(), h()); myi->other_xid = fl_create_offscreen(w(), h());
clear_damage(FL_DAMAGE_ALL); clear_damage(FL_DAMAGE_ALL);
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform double buffering
if (force_doublebuffering_) { if (force_doublebuffering_) {
myi->other_xid = fl_create_offscreen(w(), h()); myi->other_xid = fl_create_offscreen(w(), h());
clear_damage(FL_DAMAGE_ALL); clear_damage(FL_DAMAGE_ALL);
@ -187,7 +187,7 @@ void Fl_Double_Window::flush(int eraseoverlay) {
//# if defined(FLTK_USE_CAIRO) //# if defined(FLTK_USE_CAIRO)
//if Fl::cairo_autolink_context() Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately //if Fl::cairo_autolink_context() Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
//# endif //# endif
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform double buffering
if ( myi->other_xid ) { if ( myi->other_xid ) {
fl_begin_offscreen( myi->other_xid ); fl_begin_offscreen( myi->other_xid );
fl_clip_region( 0 ); fl_clip_region( 0 );

10
src/Fl_File_Browser.cxx

@ -26,7 +26,7 @@
// Fl_File_Browser::filter() - Set the filename filter. // Fl_File_Browser::filter() - Set the filename filter.
// //
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform file browser
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the internals of your file browser here" # pragma message "FL_PORTING: implement the internals of your file browser here"
#else #else
@ -62,11 +62,11 @@
# include <os2.h> # include <os2.h>
#endif // __EMX__ #endif // __EMX__
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform file browser
# include <sys/param.h> # include <sys/param.h>
# include <sys/ucred.h> # include <sys/ucred.h>
# include <sys/mount.h> # include <sys/mount.h>
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform file browser
#if defined(_AIX) #if defined(_AIX)
extern "C" { extern "C" {
@ -518,7 +518,7 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
num_files ++; num_files ++;
} }
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform file browser
// MacOS X and Darwin use getfsstat() system call... // MacOS X and Darwin use getfsstat() system call...
int numfs; // Number of file systems int numfs; // Number of file systems
struct statfs *fs; // Buffer for file system info struct statfs *fs; // Buffer for file system info
@ -664,7 +664,7 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
// window after requesting filesystem list. // window after requesting filesystem list.
add("/", icon); add("/", icon);
} }
#endif // WIN32 || __EMX__ || __APPLE__ || _AIX || ... #endif // WIN32 || __EMX__ || __APPLE__ || _AIX || ... // PORTME: platform file browser
} }
else else
{ {

2
src/Fl_File_Chooser2.cxx

@ -357,7 +357,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform file browser
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the internals of your filechooser here" # pragma message "FL_PORTING: implement the internals of your filechooser here"
#else #else

2
src/Fl_File_Icon.cxx

@ -51,7 +51,7 @@
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <FL/filename.H> #include <FL/filename.H>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform file browser
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement file type interpretation here" # pragma message "FL_PORTING: implement file type interpretation here"
#else #else

14
src/Fl_Font.H

@ -26,7 +26,7 @@
#include <config.h> #include <config.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform font stuff
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement font descriptor details here" # pragma message "FL_PORTING: implement font descriptor details here"
#else #else
@ -36,7 +36,7 @@
#if USE_XFT #if USE_XFT
typedef struct _XftFont XftFont; typedef struct _XftFont XftFont;
#elif defined(WIN32) #elif defined(WIN32)
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform font stuff
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?" # pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else #else
@ -61,7 +61,7 @@ public:
TEXTMETRIC metr; TEXTMETRIC metr;
int angle; int angle;
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size); FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
# elif defined(__APPLE_QUARTZ__) # elif defined(__APPLE_QUARTZ__) // PORTME: platform font stuff
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size); FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
ATSUTextLayout layout; ATSUTextLayout layout;
# 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
@ -84,9 +84,9 @@ public:
# endif # endif
# if HAVE_GL # if HAVE_GL
unsigned int listbase;// base of display list, 0 = none unsigned int listbase;// base of display list, 0 = none
#ifndef __APPLE_QUARTZ__ #ifndef __APPLE_QUARTZ__ // PORTME: platform font stuff
char glok[64]; char glok[64];
#endif // __APPLE_QUARTZ__ #endif // __APPLE_QUARTZ__ // PORTME: platform font stuff
# endif // HAVE_GL # endif // HAVE_GL
FL_EXPORT ~Fl_Font_Descriptor(); FL_EXPORT ~Fl_Font_Descriptor();
@ -101,7 +101,7 @@ struct Fl_Fontdesc {
char fontname[128]; // "Pretty" font name char fontname[128]; // "Pretty" font name
Fl_Font_Descriptor *first; // linked list of sizes of this style Fl_Font_Descriptor *first; // linked list of sizes of this style
#ifdef WIN32 #ifdef WIN32
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform font stuff
char **xlist; // matched X font names char **xlist; // matched X font names
int n; // size of xlist, negative = don't free xlist! int n; // size of xlist, negative = don't free xlist!
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
@ -115,7 +115,7 @@ struct Fl_Fontdesc {
extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table
#ifdef WIN32 #ifdef WIN32
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform font stuff
// functions for parsing X font names: // functions for parsing X font names:
FL_EXPORT const char* fl_font_word(const char *p, int n); FL_EXPORT const char* fl_font_word(const char *p, int n);
FL_EXPORT char *fl_find_fontsize(char *name); FL_EXPORT char *fl_find_fontsize(char *name);

8
src/Fl_Gl_Choice.H

@ -45,7 +45,7 @@
#ifndef Fl_Gl_Choice_H #ifndef Fl_Gl_Choice_H
#define Fl_Gl_Choice_H #define Fl_Gl_Choice_H
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform OpenGL management
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: add code to list and select OpenGL drawing contexts" # pragma message "FL_PORTING: add code to list and select OpenGL drawing contexts"
#else #else
@ -56,7 +56,7 @@
#ifdef WIN32 #ifdef WIN32
# include <FL/gl.h> # include <FL/gl.h>
# define GLContext HGLRC # define GLContext HGLRC
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
#ifdef __OBJC__ #ifdef __OBJC__
@class NSOpenGLPixelFormat; @class NSOpenGLPixelFormat;
@ -81,7 +81,7 @@ public:
#ifdef WIN32 #ifdef WIN32
int pixelformat; // the visual to use int pixelformat; // the visual to use
PIXELFORMATDESCRIPTOR pfd; // some wgl calls need this thing PIXELFORMATDESCRIPTOR pfd; // some wgl calls need this thing
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
NSOpenGLPixelFormat* pixelformat; NSOpenGLPixelFormat* pixelformat;
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: define OpenGL pixel format containers" # pragma message "FL_PORTING: define OpenGL pixel format containers"
@ -101,7 +101,7 @@ class Fl_Window;
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0); GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0); GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);

16
src/Fl_Gl_Choice.cxx

@ -27,7 +27,7 @@
# include "flstring.h" # include "flstring.h"
# include <FL/fl_utf8.h> # include <FL/fl_utf8.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform OpenGL management
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: add code to list and select OpenGL drawing contexts" # pragma message "FL_PORTING: add code to list and select OpenGL drawing contexts"
#else #else
@ -35,7 +35,7 @@
# ifdef WIN32 # ifdef WIN32
void fl_save_dc(HWND, HDC); void fl_save_dc(HWND, HDC);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform OpenGL management
extern void gl_texture_reset(); extern void gl_texture_reset();
#endif #endif
@ -110,7 +110,7 @@ Fl_Gl_Choice *Fl_Gl_Choice::find(int m, const int *alistp) {
return 0; return 0;
} }
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
NSOpenGLPixelFormat* fmt = Fl_X::mode_to_NSOpenGLPixelFormat(m, alistp); NSOpenGLPixelFormat* fmt = Fl_X::mode_to_NSOpenGLPixelFormat(m, alistp);
if (!fmt) return 0; if (!fmt) return 0;
@ -172,7 +172,7 @@ Fl_Gl_Choice *Fl_Gl_Choice::find(int m, const int *alistp) {
# elif defined(WIN32) # elif defined(WIN32)
g->pixelformat = pixelformat; g->pixelformat = pixelformat;
g->pfd = chosen_pfd; g->pfd = chosen_pfd;
# elif defined(__APPLE_QUARTZ__) # elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
g->pixelformat = fmt; g->pixelformat = fmt;
# else # else
# error unsupported platform # error unsupported platform
@ -242,7 +242,7 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
return context; return context;
} }
# elif defined(__APPLE_QUARTZ__) # elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) { GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
GLContext context, shared_ctx = 0; GLContext context, shared_ctx = 0;
@ -270,7 +270,7 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
glXMakeCurrent(fl_display, fl_xid(w), context); glXMakeCurrent(fl_display, fl_xid(w), context);
# elif defined(WIN32) # elif defined(WIN32)
wglMakeCurrent(Fl_X::i(w)->private_dc, context); wglMakeCurrent(Fl_X::i(w)->private_dc, context);
# elif defined(__APPLE_QUARTZ__) # elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
Fl_X::GLcontext_makecurrent(context); Fl_X::GLcontext_makecurrent(context);
# else # else
# error unsupported platform # error unsupported platform
@ -285,7 +285,7 @@ void fl_no_gl_context() {
glXMakeCurrent(fl_display, 0, 0); glXMakeCurrent(fl_display, 0, 0);
# elif defined(WIN32) # elif defined(WIN32)
wglMakeCurrent(0, 0); wglMakeCurrent(0, 0);
# elif defined(__APPLE_QUARTZ__) # elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
Fl_X::GL_cleardrawable(); Fl_X::GL_cleardrawable();
# else # else
# error unsupported platform # error unsupported platform
@ -298,7 +298,7 @@ void fl_delete_gl_context(GLContext context) {
glXDestroyContext(fl_display, context); glXDestroyContext(fl_display, context);
# elif defined(WIN32) # elif defined(WIN32)
wglDeleteContext(context); wglDeleteContext(context);
# elif defined(__APPLE_QUARTZ__) # elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
Fl_X::GLcontext_release(context); Fl_X::GLcontext_release(context);
# else # else
# error unsupported platform # error unsupported platform

14
src/Fl_Gl_Device_Plugin.cxx

@ -24,14 +24,14 @@
#include <FL/Fl_RGB_Image.H> #include <FL/Fl_RGB_Image.H>
#include "FL/Fl.H" #include "FL/Fl.H"
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform OpenGL management
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement code to read OpenGL renderings into RGB maps" # pragma message "FL_PORTING: implement code to read OpenGL renderings into RGB maps"
#else #else
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform OpenGL management
uchar *convert_BGRA_to_RGB(uchar *baseAddress, int w, int h, int mByteWidth) uchar *convert_BGRA_to_RGB(uchar *baseAddress, int w, int h, int mByteWidth)
{ {
uchar *newimg = new uchar[3*w*h]; uchar *newimg = new uchar[3*w*h];
@ -59,7 +59,7 @@ static Fl_RGB_Image* capture_gl_rectangle(Fl_Gl_Window *glw, int x, int y, int w
stored from bottom to top. stored from bottom to top.
*/ */
{ {
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform OpenGL management
const int bytesperpixel = 4; const int bytesperpixel = 4;
int factor = glw->pixels_per_unit(); int factor = glw->pixels_per_unit();
if (factor > 1) { if (factor > 1) {
@ -81,14 +81,14 @@ static Fl_RGB_Image* capture_gl_rectangle(Fl_Gl_Window *glw, int x, int y, int w
mByteWidth = (mByteWidth + 3) & ~3; // Align to 4 bytes mByteWidth = (mByteWidth + 3) & ~3; // Align to 4 bytes
uchar *baseAddress = new uchar[mByteWidth * h]; uchar *baseAddress = new uchar[mByteWidth * h];
glReadPixels(x, glw->pixel_h() - (y+h), w, h, glReadPixels(x, glw->pixel_h() - (y+h), w, h,
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform OpenGL management
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
#else #else
GL_RGB, GL_UNSIGNED_BYTE, GL_RGB, GL_UNSIGNED_BYTE,
#endif #endif
baseAddress); baseAddress);
glPopClientAttrib(); glPopClientAttrib();
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform OpenGL management
baseAddress = convert_BGRA_to_RGB(baseAddress, w, h, mByteWidth); baseAddress = convert_BGRA_to_RGB(baseAddress, w, h, mByteWidth);
mByteWidth = 3 * w; mByteWidth = 3 * w;
#endif #endif
@ -97,7 +97,7 @@ static Fl_RGB_Image* capture_gl_rectangle(Fl_Gl_Window *glw, int x, int y, int w
return img; return img;
} }
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
static void imgProviderReleaseData (void *info, const void *data, size_t size) static void imgProviderReleaseData (void *info, const void *data, size_t size)
{ {
delete (Fl_RGB_Image *)info; delete (Fl_RGB_Image *)info;
@ -116,7 +116,7 @@ public:
Fl_Gl_Window *glw = w->as_gl_window(); Fl_Gl_Window *glw = w->as_gl_window();
if (!glw) return 0; if (!glw) return 0;
Fl_RGB_Image *img = capture_gl_rectangle(glw, 0, 0, glw->w(), glw->h()); Fl_RGB_Image *img = capture_gl_rectangle(glw, 0, 0, glw->w(), glw->h());
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
if (Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) { if (Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) {
// convert the image to CGImage, and draw it at full res (useful on retina display) // convert the image to CGImage, and draw it at full res (useful on retina display)
CGColorSpaceRef cSpace = CGColorSpaceCreateDeviceRGB(); CGColorSpaceRef cSpace = CGColorSpaceCreateDeviceRGB();

6
src/Fl_Gl_Overlay.cxx

@ -25,7 +25,7 @@
#include <FL/Fl_Gl_Window.H> #include <FL/Fl_Gl_Window.H>
#include <stdlib.h> #include <stdlib.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform OpenGL management
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement OpenGL hardware overlays if they are availbale in a compatible way. This is rarely needed." # pragma message "FL_PORTING: implement OpenGL hardware overlays if they are availbale in a compatible way. This is rarely needed."
#else #else
@ -193,7 +193,7 @@ int Fl_Gl_Window::can_do_overlay() {
void Fl_Gl_Window::redraw_overlay() { void Fl_Gl_Window::redraw_overlay() {
if (!shown()) return; if (!shown()) return;
make_overlay(); make_overlay();
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
redraw(); redraw();
#else #else
#ifndef WIN32 #ifndef WIN32
@ -207,7 +207,7 @@ void Fl_Gl_Window::redraw_overlay() {
void Fl_Gl_Window::make_overlay_current() { void Fl_Gl_Window::make_overlay_current() {
make_overlay(); make_overlay();
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
// this is not very useful, but unfortunately, Apple decided // this is not very useful, but unfortunately, Apple decided
// that front buffer drawing can no longer (OS X 10.4) be // that front buffer drawing can no longer (OS X 10.4) be
// supported on their platforms. // supported on their platforms.

44
src/Fl_Gl_Window.cxx

@ -25,7 +25,7 @@ extern int fl_gl_load_plugin;
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/x.H> #include <FL/x.H>
#include "Fl_Gl_Choice.H" #include "Fl_Gl_Choice.H"
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
#include <FL/gl.h> #include <FL/gl.h>
#include <OpenGL/OpenGL.h> #include <OpenGL/OpenGL.h>
#endif #endif
@ -36,7 +36,7 @@ extern int fl_gl_load_plugin;
#include "drivers/OpenGL/Fl_OpenGL_Display_Device.h" #include "drivers/OpenGL/Fl_OpenGL_Display_Device.h"
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform OpenGL management
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the creation and destruction of OpenGL surfaces" # pragma message "FL_PORTING: implement the creation and destruction of OpenGL surfaces"
#else #else
@ -74,7 +74,7 @@ int Fl_Gl_Window::can_do(int a, const int *b) {
} }
void Fl_Gl_Window::show() { void Fl_Gl_Window::show() {
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform OpenGL management
int need_redraw = 0; int need_redraw = 0;
#endif #endif
if (!shown()) { if (!shown()) {
@ -90,29 +90,29 @@ void Fl_Gl_Window::show() {
return; return;
} }
} }
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform OpenGL management
Fl_X::make_xid(this, g->vis, g->colormap); Fl_X::make_xid(this, g->vis, g->colormap);
if (overlay && overlay != this) ((Fl_Gl_Window*)overlay)->show(); if (overlay && overlay != this) ((Fl_Gl_Window*)overlay)->show();
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform OpenGL management
if( ! parent() ) need_redraw=1; if( ! parent() ) need_redraw=1;
#endif #endif
} }
Fl_Window::show(); Fl_Window::show();
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
set_visible(); set_visible();
if(need_redraw) redraw();//necessary only after creation of a top-level GL window if(need_redraw) redraw();//necessary only after creation of a top-level GL window
#endif /* __APPLE__ */ #endif /* __APPLE__ */ // PORTME: platform OpenGL management
} }
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform OpenGL management
int Fl_Gl_Window::pixels_per_unit() int Fl_Gl_Window::pixels_per_unit()
{ {
return (fl_mac_os_version >= 100700 && Fl::use_high_res_GL() && Fl_X::i(this) && Fl_X::i(this)->mapped_to_retina()) ? 2 : 1; return (fl_mac_os_version >= 100700 && Fl::use_high_res_GL() && Fl_X::i(this) && Fl_X::i(this)->mapped_to_retina()) ? 2 : 1;
} }
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform OpenGL management
/** /**
The invalidate() method turns off valid() and is The invalidate() method turns off valid() and is
@ -131,16 +131,16 @@ void Fl_Gl_Window::invalidate() {
int Fl_Gl_Window::mode(int m, const int *a) { int Fl_Gl_Window::mode(int m, const int *a) {
if (m == mode_ && a == alist) return 0; if (m == mode_ && a == alist) return 0;
#ifndef __APPLE__ #ifndef __APPLE__ // PORTME: platform OpenGL management
int oldmode = mode_; int oldmode = mode_;
#endif #endif
#if defined(__APPLE__) || defined(USE_X11) #if defined(__APPLE__) || defined(USE_X11) // PORTME: platform OpenGL management
if (a) { // when the mode is set using the a array of system-dependent values, and if asking for double buffer, if (a) { // when the mode is set using the a array of system-dependent values, and if asking for double buffer,
// the FL_DOUBLE flag must be set in the mode_ member variable // the FL_DOUBLE flag must be set in the mode_ member variable
const int *aa = a; const int *aa = a;
while (*aa) { while (*aa) {
if (*(aa++) == if (*(aa++) ==
# if defined(__APPLE__) # if defined(__APPLE__) // PORTME: platform OpenGL management
kCGLPFADoubleBuffer kCGLPFADoubleBuffer
# else # else
GLX_DOUBLEBUFFER GLX_DOUBLEBUFFER
@ -148,10 +148,10 @@ int Fl_Gl_Window::mode(int m, const int *a) {
) { m |= FL_DOUBLE; break; } ) { m |= FL_DOUBLE; break; }
} }
} }
#endif // !__APPLE__ #endif // !__APPLE__ // PORTME: platform OpenGL management
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform OpenGL management
Fl_Gl_Choice* oldg = g; Fl_Gl_Choice* oldg = g;
#endif // !WIN32 && !__APPLE__ #endif // !WIN32 && !__APPLE__ // PORTME: platform OpenGL management
context(0); context(0);
mode_ = m; alist = a; mode_ = m; alist = a;
if (shown()) { if (shown()) {
@ -168,7 +168,7 @@ int Fl_Gl_Window::mode(int m, const int *a) {
hide(); hide();
show(); show();
} }
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
redraw(); redraw();
#else #else
# error unsupported platform # error unsupported platform
@ -191,7 +191,7 @@ int Fl_Gl_Window::mode(int m, const int *a) {
void Fl_Gl_Window::make_current() { void Fl_Gl_Window::make_current() {
// puts("Fl_Gl_Window::make_current()"); // puts("Fl_Gl_Window::make_current()");
// printf("make_current: context_=%p\n", context_); // printf("make_current: context_=%p\n", context_);
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform OpenGL management
// detect if the window was moved between low and high resolution displays // detect if the window was moved between low and high resolution displays
if (Fl_X::i(this)->changed_resolution()){ if (Fl_X::i(this)->changed_resolution()){
Fl_X::i(this)->changed_resolution(false); Fl_X::i(this)->changed_resolution(false);
@ -256,7 +256,7 @@ void Fl_Gl_Window::swap_buffers() {
# else # else
SwapBuffers(Fl_X::i(this)->private_dc); SwapBuffers(Fl_X::i(this)->private_dc);
# endif # endif
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management
if(overlay != NULL) { if(overlay != NULL) {
// STR# 2944 [1] // STR# 2944 [1]
// Save matrixmode/proj/modelview/rasterpos before doing overlay. // Save matrixmode/proj/modelview/rasterpos before doing overlay.
@ -338,7 +338,7 @@ void Fl_Gl_Window::flush() {
glDrawBuffer(GL_BACK); glDrawBuffer(GL_BACK);
if (!SWAP_TYPE) { if (!SWAP_TYPE) {
#if defined (__APPLE_QUARTZ__) || defined (USE_X11) #if defined (__APPLE_QUARTZ__) || defined (USE_X11) // PORTME: platform OpenGL management
SWAP_TYPE = COPY; SWAP_TYPE = COPY;
#else #else
SWAP_TYPE = UNDEFINED; SWAP_TYPE = UNDEFINED;
@ -405,7 +405,7 @@ void Fl_Gl_Window::flush() {
} }
} }
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
Fl_X::GLcontext_flushbuffer(context_); Fl_X::GLcontext_flushbuffer(context_);
#endif #endif
@ -435,12 +435,12 @@ void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
int is_a_resize = (W != Fl_Widget::w() || H != Fl_Widget::h()); int is_a_resize = (W != Fl_Widget::w() || H != Fl_Widget::h());
if (is_a_resize) valid(0); if (is_a_resize) valid(0);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform OpenGL management
Fl_X *flx = Fl_X::i(this); Fl_X *flx = Fl_X::i(this);
if (flx && flx->in_windowDidResize()) Fl_X::GLcontext_update(context_); if (flx && flx->in_windowDidResize()) Fl_X::GLcontext_update(context_);
#endif #endif
#if ! ( defined(__APPLE__) || defined(WIN32) ) #if ! ( defined(__APPLE__) || defined(WIN32) ) // PORTME: platform OpenGL management
if (is_a_resize && !resizable() && overlay && overlay != this) { if (is_a_resize && !resizable() && overlay && overlay != this) {
((Fl_Gl_Window*)overlay)->resize(0,0,W,H); ((Fl_Gl_Window*)overlay)->resize(0,0,W,H);
} }

12
src/Fl_Image_Surface.cxx

@ -26,7 +26,7 @@
#endif #endif
#if defined(WIN32) #if defined(WIN32)
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform image surface
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement image surface handling here" # pragma message "FL_PORTING: implement image surface handling here"
#else #else
@ -40,7 +40,7 @@ const char *Fl_Image_Surface::class_id = "Fl_Image_Surface";
Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) { Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) {
width = w; width = w;
height = h; height = h;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform image surface
offscreen = fl_create_offscreen(w, h); offscreen = fl_create_offscreen(w, h);
helper = new Fl_Quartz_Flipped_Surface_(width, height); helper = new Fl_Quartz_Flipped_Surface_(width, height);
driver(helper->driver()); driver(helper->driver());
@ -71,7 +71,7 @@ Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) {
/** The destructor. /** The destructor.
*/ */
Fl_Image_Surface::~Fl_Image_Surface() { Fl_Image_Surface::~Fl_Image_Surface() {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform image surface
void *data = CGBitmapContextGetData((CGContextRef)offscreen); void *data = CGBitmapContextGetData((CGContextRef)offscreen);
free(data); free(data);
CGContextRelease((CGContextRef)offscreen); CGContextRelease((CGContextRef)offscreen);
@ -95,7 +95,7 @@ Fl_Image_Surface::~Fl_Image_Surface() {
Fl_RGB_Image* Fl_Image_Surface::image() Fl_RGB_Image* Fl_Image_Surface::image()
{ {
unsigned char *data; unsigned char *data;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform image surface
CGContextFlush(offscreen); CGContextFlush(offscreen);
data = fl_read_image(NULL, 0, 0, width, height, 0); data = fl_read_image(NULL, 0, 0, width, height, 0);
fl_gc = 0; fl_gc = 0;
@ -134,7 +134,7 @@ void Fl_Image_Surface::draw(Fl_Widget *widget, int delta_x, int delta_y)
void Fl_Image_Surface::set_current() void Fl_Image_Surface::set_current()
{ {
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform image surface
fl_gc = offscreen; fl_window = 0; fl_gc = offscreen; fl_window = 0;
Fl_Surface_Device::set_current(); Fl_Surface_Device::set_current();
#elif defined(WIN32) #elif defined(WIN32)
@ -157,7 +157,7 @@ void Fl_Image_Surface::set_current()
#endif #endif
} }
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform image surface
Fl_Quartz_Flipped_Surface_::Fl_Quartz_Flipped_Surface_(int w, int h) : Fl_Quartz_Surface_(w, h) { Fl_Quartz_Flipped_Surface_::Fl_Quartz_Flipped_Surface_(int w, int h) : Fl_Quartz_Surface_(w, h) {
} }

32
src/Fl_Input.cxx

@ -22,7 +22,7 @@
// In theory you can replace this code with another subclass to change // In theory you can replace this code with another subclass to change
// the keybindings. // the keybindings.
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform text editor look and feel
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement text input specifics here" # pragma message "FL_PORTING: implement text input specifics here"
// current custom code is for OS X keybaord specifics only // current custom code is for OS X keybaord specifics only
@ -365,7 +365,7 @@ int Fl_Input::handle_key() {
else replace(position(), del ? position()-del : mark(), else replace(position(), del ? position()-del : mark(),
Fl::event_text(), Fl::event_length()); Fl::event_text(), Fl::event_length());
} }
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform compose
if (Fl::compose_state) { if (Fl::compose_state) {
this->mark( this->position() - Fl::compose_state ); this->mark( this->position() - Fl::compose_state );
} }
@ -400,7 +400,7 @@ int Fl_Input::handle_key() {
return 0; // ignore other combos, pass to parent return 0; // ignore other combos, pass to parent
case FL_Delete: { case FL_Delete: {
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_delete_char_right(); // Delete (OSX-HIG,TE,SA,WOX) if (mods==0) return kf_delete_char_right(); // Delete (OSX-HIG,TE,SA,WOX)
if (mods==FL_CTRL) return kf_delete_char_right(); // Ctrl-Delete (??? TE,!SA,!WOX) if (mods==FL_CTRL) return kf_delete_char_right(); // Ctrl-Delete (??? TE,!SA,!WOX)
if (mods==FL_ALT) return kf_delete_word_right(); // Alt-Delete (OSX-HIG,TE,SA) if (mods==FL_ALT) return kf_delete_word_right(); // Alt-Delete (OSX-HIG,TE,SA)
@ -418,7 +418,7 @@ int Fl_Input::handle_key() {
} }
case FL_Left: case FL_Left:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_move_char_left(); // Left (OSX-HIG) if (mods==0) return kf_move_char_left(); // Left (OSX-HIG)
if (mods==FL_ALT) return kf_move_word_left(); // Alt-Left (OSX-HIG) if (mods==FL_ALT) return kf_move_word_left(); // Alt-Left (OSX-HIG)
if (mods==FL_META) return kf_move_sol(); // Meta-Left (OSX-HIG) if (mods==FL_META) return kf_move_sol(); // Meta-Left (OSX-HIG)
@ -432,7 +432,7 @@ int Fl_Input::handle_key() {
#endif #endif
case FL_Right: case FL_Right:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_move_char_right(); // Right (OSX-HIG) if (mods==0) return kf_move_char_right(); // Right (OSX-HIG)
if (mods==FL_ALT) return kf_move_word_right(); // Alt-Right (OSX-HIG) if (mods==FL_ALT) return kf_move_word_right(); // Alt-Right (OSX-HIG)
if (mods==FL_META) return kf_move_eol(); // Meta-Right (OSX-HIG) if (mods==FL_META) return kf_move_eol(); // Meta-Right (OSX-HIG)
@ -446,7 +446,7 @@ int Fl_Input::handle_key() {
#endif #endif
case FL_Up: case FL_Up:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_lines_up(1); // Up (OSX-HIG) if (mods==0) return kf_lines_up(1); // Up (OSX-HIG)
if (mods==FL_CTRL) return kf_page_up(); // Ctrl-Up (TE !HIG) if (mods==FL_CTRL) return kf_page_up(); // Ctrl-Up (TE !HIG)
if (mods==FL_ALT) return kf_move_up_and_sol(); // Alt-Up (OSX-HIG) if (mods==FL_ALT) return kf_move_up_and_sol(); // Alt-Up (OSX-HIG)
@ -459,7 +459,7 @@ int Fl_Input::handle_key() {
#endif #endif
case FL_Down: case FL_Down:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_lines_down(1); // Dn (OSX-HIG) if (mods==0) return kf_lines_down(1); // Dn (OSX-HIG)
if (mods==FL_CTRL) return kf_page_down(); // Ctrl-Dn (TE !HIG) if (mods==FL_CTRL) return kf_page_down(); // Ctrl-Dn (TE !HIG)
if (mods==FL_ALT) return kf_move_down_and_eol(); // Alt-Dn (OSX-HIG) if (mods==FL_ALT) return kf_move_down_and_eol(); // Alt-Dn (OSX-HIG)
@ -474,7 +474,7 @@ int Fl_Input::handle_key() {
case FL_Page_Up: case FL_Page_Up:
// Fl_Input has no scroll control, so instead we move the cursor by one page // Fl_Input has no scroll control, so instead we move the cursor by one page
// OSX-HIG recommends Alt increase one semantic unit, Meta next higher.. // OSX-HIG recommends Alt increase one semantic unit, Meta next higher..
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_page_up(); // PgUp (OSX-HIG) if (mods==0) return kf_page_up(); // PgUp (OSX-HIG)
if (mods==FL_ALT) return kf_page_up(); // Alt-PageUp (OSX-HIG) if (mods==FL_ALT) return kf_page_up(); // Alt-PageUp (OSX-HIG)
if (mods==FL_META) return kf_top(); // Meta-PageUp (OSX-HIG,!TE) if (mods==FL_META) return kf_top(); // Meta-PageUp (OSX-HIG,!TE)
@ -487,7 +487,7 @@ int Fl_Input::handle_key() {
#endif #endif
case FL_Page_Down: case FL_Page_Down:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
// Fl_Input has no scroll control, so instead we move the cursor by one page // Fl_Input has no scroll control, so instead we move the cursor by one page
// OSX-HIG recommends Alt increase one semantic unit, Meta next higher.. // OSX-HIG recommends Alt increase one semantic unit, Meta next higher..
if (mods==0) return kf_page_down(); // PgDn (OSX-HIG) if (mods==0) return kf_page_down(); // PgDn (OSX-HIG)
@ -502,7 +502,7 @@ int Fl_Input::handle_key() {
#endif #endif
case FL_Home: case FL_Home:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_top(); // Home (OSX-HIG) if (mods==0) return kf_top(); // Home (OSX-HIG)
if (mods==FL_ALT) return kf_top(); // Alt-Home (???) if (mods==FL_ALT) return kf_top(); // Alt-Home (???)
return 0; // ignore other combos, pass to parent return 0; // ignore other combos, pass to parent
@ -513,7 +513,7 @@ int Fl_Input::handle_key() {
#endif #endif
case FL_End: case FL_End:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_bottom(); // End (OSX-HIG) if (mods==0) return kf_bottom(); // End (OSX-HIG)
if (mods==FL_ALT) return kf_bottom(); // Alt-End (???) if (mods==FL_ALT) return kf_bottom(); // Alt-End (???)
return 0; // ignore other combos, pass to parent return 0; // ignore other combos, pass to parent
@ -524,7 +524,7 @@ int Fl_Input::handle_key() {
#endif #endif
case FL_BackSpace: case FL_BackSpace:
#ifdef __APPLE__ #ifdef __APPLE__ // platform text editor look and feel
if (mods==0) return kf_delete_char_left(); // Backspace (OSX-HIG) if (mods==0) return kf_delete_char_left(); // Backspace (OSX-HIG)
if (mods==FL_CTRL) return kf_delete_char_left(); // Ctrl-Backspace (TE/SA) if (mods==FL_CTRL) return kf_delete_char_left(); // Ctrl-Backspace (TE/SA)
if (mods==FL_ALT) return kf_delete_word_left(); // Alt-Backspace (OSX-HIG) if (mods==FL_ALT) return kf_delete_word_left(); // Alt-Backspace (OSX-HIG)
@ -597,7 +597,7 @@ int Fl_Input::handle(int event) {
static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos; static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos;
static Fl_Widget *dnd_save_focus = NULL; static Fl_Widget *dnd_save_focus = NULL;
switch (event) { switch (event) {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: compose text
case FL_UNFOCUS: case FL_UNFOCUS:
if (Fl::compose_state) { if (Fl::compose_state) {
this->mark( this->position() ); this->mark( this->position() );
@ -686,7 +686,7 @@ int Fl_Input::handle(int event) {
dnd_save_focus = this; dnd_save_focus = this;
// drag the data: // drag the data:
copy(0); copy(0);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: dnd
Fl_X::dnd(1); Fl_X::dnd(1);
#else #else
Fl::dnd(); Fl::dnd();
@ -753,7 +753,7 @@ int Fl_Input::handle(int event) {
Fl::focus(dnd_save_focus); Fl::focus(dnd_save_focus);
handle(FL_UNFOCUS); handle(FL_UNFOCUS);
} }
#if !(defined(__APPLE__) || defined(WIN32)) #if !(defined(__APPLE__) || defined(WIN32)) // PORTME: cursor
Fl::first_window()->cursor(FL_CURSOR_MOVE); Fl::first_window()->cursor(FL_CURSOR_MOVE);
#endif #endif
dnd_save_focus = NULL; dnd_save_focus = NULL;
@ -847,7 +847,7 @@ Fl_Secret_Input::Fl_Secret_Input(int X,int Y,int W,int H,const char *l)
int Fl_Secret_Input::handle(int event) { int Fl_Secret_Input::handle(int event) {
int retval = Fl_Input::handle(event); int retval = Fl_Input::handle(event);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: compose
if (event == FL_KEYBOARD && Fl::compose_state) { if (event == FL_KEYBOARD && Fl::compose_state) {
this->mark( this->position() ); // don't underline marked text this->mark( this->position() ); // don't underline marked text
} }

10
src/Fl_Input_.cxx

@ -27,7 +27,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // platform editor look and feel
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: manage character composing here" # pragma message "FL_PORTING: manage character composing here"
#else #else
@ -346,7 +346,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
int offset2; int offset2;
if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2); if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
else offset2 = (int) strlen(buf); else offset2 = (int) strlen(buf);
#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text #ifdef __APPLE__ // PORTME: Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
if (Fl::compose_state) { if (Fl::compose_state) {
fl_color(textcolor()); fl_color(textcolor());
} }
@ -358,7 +358,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
fl_color(fl_contrast(textcolor(), selection_color())); fl_color(fl_contrast(textcolor(), selection_color()));
} }
fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc)); fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text #ifdef __APPLE__ // PORTME: Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
if (Fl::compose_state) { if (Fl::compose_state) {
fl_color( fl_color_average(textcolor(), color(), 0.6) ); fl_color( fl_color_average(textcolor(), color(), 0.6) );
float width = fl_width(buf+offset1, offset2-offset1); float width = fl_width(buf+offset1, offset2-offset1);
@ -380,7 +380,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
CONTINUE2: CONTINUE2:
// draw the cursor: // draw the cursor:
if (Fl::focus() == this && ( if (Fl::focus() == this && (
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: compose
Fl::compose_state || Fl::compose_state ||
#endif #endif
selstart == selend) && selstart == selend) &&
@ -395,7 +395,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
} else { } else {
fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height); fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height);
} }
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: compose
Fl::insertion_point_location(xpos+curx, Y+ypos+height, height); Fl::insertion_point_location(xpos+curx, Y+ypos+height, height);
#endif #endif
} }

6
src/Fl_Menu.cxx

@ -122,7 +122,7 @@ class menuwindow : public Fl_Menu_Window {
public: public:
menutitle* title; menutitle* title;
int handle(int); int handle(int);
#if defined (__APPLE__) || defined (USE_X11) #if defined (__APPLE__) || defined (USE_X11) // PORTME: menubar
int early_hide_handle(int); int early_hide_handle(int);
#endif #endif
int itemheight; // zero == menubar int itemheight; // zero == menubar
@ -653,7 +653,7 @@ static int backward(int menu) { // previous item in menu menu if possible
} }
int menuwindow::handle(int e) { int menuwindow::handle(int e) {
#if defined (__APPLE__) || defined (USE_X11) #if defined (__APPLE__) || defined (USE_X11) // PORTME: menubar
// This off-route takes care of the "detached menu" bug on OS X. // This off-route takes care of the "detached menu" bug on OS X.
// Apple event handler requires that we hide all menu windows right // Apple event handler requires that we hide all menu windows right
// now, so that Carbon can continue undisturbed with handling window // now, so that Carbon can continue undisturbed with handling window
@ -746,7 +746,7 @@ int menuwindow::early_hide_handle(int e) {
} }
break; break;
case FL_MOVE: case FL_MOVE:
#if ! (defined(WIN32) || defined(__APPLE__)) #if ! (defined(WIN32) || defined(__APPLE__)) // PORTME: menubar
if (pp.state == DONE_STATE) { if (pp.state == DONE_STATE) {
return 1; // Fix for STR #2619 return 1; // Fix for STR #2619
} }

2
src/Fl_Native_File_Chooser.cxx

@ -21,7 +21,7 @@
#include "Fl_Native_File_Chooser_WIN32.cxx" #include "Fl_Native_File_Chooser_WIN32.cxx"
// Use Apple's chooser // Use Apple's chooser
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: native file chooser
#include <FL/Fl_Native_File_Chooser.H> #include <FL/Fl_Native_File_Chooser.H>
#elif defined(FL_PORTING) #elif defined(FL_PORTING)

8
src/Fl_Paged_Device.cxx

@ -141,7 +141,7 @@ void Fl_Paged_Device::print_window_part(Fl_Window *win, int x, int y, int w, int
win->make_current(); win->make_current();
uchar *image_data; uchar *image_data;
image_data = fl_read_image(NULL, x, y, w, h); image_data = fl_read_image(NULL, x, y, w, h);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform paged device
Fl_X::q_release_context(); // matches make_current() call above Fl_X::q_release_context(); // matches make_current() call above
#endif #endif
if (save_front != win) save_front->show(); if (save_front != win) save_front->show();
@ -305,11 +305,11 @@ void Fl_Paged_Device::draw_decorated_window(Fl_Window *win, int x_offset, int y_
int wsides = left ? left->w() : 0; int wsides = left ? left->w() : 0;
int toph = top ? top->h() : 0; int toph = top ? top->h() : 0;
if (top) { if (top) {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform paged device
top->draw(x_offset, y_offset); // draw with transparency top->draw(x_offset, y_offset); // draw with transparency
#else #else
fl_draw_image(top->array, x_offset, y_offset, top->w(), top->h(), top->d()); fl_draw_image(top->array, x_offset, y_offset, top->w(), top->h(), top->d());
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform paged device
delete top; delete top;
} }
if (left) { if (left) {
@ -327,7 +327,7 @@ void Fl_Paged_Device::draw_decorated_window(Fl_Window *win, int x_offset, int y_
this->print_widget(win, x_offset + wsides, y_offset + toph); this->print_widget(win, x_offset + wsides, y_offset + toph);
} }
#if !defined(__APPLE__) // Mac OS version in Fl_Cocoa.mm #if !defined(__APPLE__) // PORTME: platform paged device // Mac OS version in Fl_Cocoa.mm
void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset) void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
{ {
draw_decorated_window(win, x_offset, y_offset); draw_decorated_window(win, x_offset, y_offset);

8
src/Fl_PostScript.cxx

@ -61,7 +61,7 @@ Fl_PostScript_Graphics_Driver::~Fl_PostScript_Graphics_Driver() {
*/ */
Fl_PostScript_File_Device::Fl_PostScript_File_Device(void) Fl_PostScript_File_Device::Fl_PostScript_File_Device(void)
{ {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform PostScript
gc = fl_gc; // the display context is used by fl_text_extents() gc = fl_gc; // the display context is used by fl_text_extents()
#endif #endif
Fl_Surface_Device::driver( new Fl_PostScript_Graphics_Driver() ); Fl_Surface_Device::driver( new Fl_PostScript_Graphics_Driver() );
@ -176,7 +176,7 @@ int Fl_PostScript_Graphics_Driver::clocale_printf(const char *format, ...)
#ifndef FL_DOXYGEN #ifndef FL_DOXYGEN
#if ! (defined(__APPLE__) || defined(WIN32) ) #if ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: platform PostScript
# include "print_panel.cxx" # include "print_panel.cxx"
#endif #endif
@ -1562,7 +1562,7 @@ void Fl_PostScript_File_Device::end_job (void)
#endif // FL_DOXYGEN #endif // FL_DOXYGEN
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform PostScript
#elif defined(WIN32) #elif defined(WIN32)
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement postscript printing" # pragma message "FL_PORTING: implement postscript printing"
@ -1664,7 +1664,7 @@ int Fl_PostScript_Printer::start_job(int pages, int *firstpage, int *lastpage) {
return ps->start_postscript(pages, format, layout); // start printing return ps->start_postscript(pages, format, layout); // start printing
} }
#endif // ! (defined(__APPLE__) || defined(WIN32) ) #endif // ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: platform PostScript
// //

12
src/Fl_Preferences.cxx

@ -29,7 +29,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform Preferences
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement some file storage in a designated place" # pragma message "FL_PORTING: implement some file storage in a designated place"
#else #else
@ -43,7 +43,7 @@
// on Windows, which is supposed to be POSIX compliant... // on Windows, which is supposed to be POSIX compliant...
# define access _access # define access _access
# define mkdir _mkdir # define mkdir _mkdir
#elif defined (__APPLE__) #elif defined (__APPLE__) // PORTME: platform Preferences
# include <ApplicationServices/ApplicationServices.h> # include <ApplicationServices/ApplicationServices.h>
# include <unistd.h> # include <unistd.h>
# include <config.h> # include <config.h>
@ -86,7 +86,7 @@ Fl_Preferences *Fl_Preferences::runtimePrefs = 0;
* The buffer is overwritten during every call to this function! * The buffer is overwritten during every call to this function!
*/ */
const char *Fl_Preferences::newUUID() { const char *Fl_Preferences::newUUID() {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform Preferences
CFUUIDRef theUUID = CFUUIDCreate(NULL); CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFUUIDBytes b = CFUUIDGetUUIDBytes(theUUID); CFUUIDBytes b = CFUUIDGetUUIDBytes(theUUID);
sprintf(uuidBuffer, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", sprintf(uuidBuffer, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
@ -1026,7 +1026,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename), snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
"/%s/%s.prefs", vendor, application); "/%s/%s.prefs", vendor, application);
for (char *s = filename; *s; s++) if (*s == '\\') *s = '/'; for (char *s = filename; *s; s++) if (*s == '\\') *s = '/';
#elif defined ( __APPLE__ ) #elif defined ( __APPLE__ ) // PORTME: platform Preferences
// TODO: verify that this is the Apple sanctioned way of finding these folders // TODO: verify that this is the Apple sanctioned way of finding these folders
// (On MSWindows, this frequently leads to issues with internationalized systems) // (On MSWindows, this frequently leads to issues with internationalized systems)
// Carbon: err = FindFolder( kLocalDomain, kPreferencesFolderType, 1, &spec.vRefNum, &spec.parID ); // Carbon: err = FindFolder( kLocalDomain, kPreferencesFolderType, 1, &spec.vRefNum, &spec.parID );
@ -1168,7 +1168,7 @@ int Fl_Preferences::RootNode::write() {
fprintf( f, "; application: %s\n", application_ ); fprintf( f, "; application: %s\n", application_ );
prefs_->node->write( f ); prefs_->node->write( f );
fclose( f ); fclose( f );
#if !(defined(__APPLE__) || defined(WIN32)) #if !(defined(__APPLE__) || defined(WIN32)) // PORTME: platform Preferences
// unix: make sure that system prefs are user-readable // unix: make sure that system prefs are user-readable
if (strncmp(filename_, "/etc/fltk/", 10) == 0) { if (strncmp(filename_, "/etc/fltk/", 10) == 0) {
char *p; char *p;
@ -1197,7 +1197,7 @@ char Fl_Preferences::RootNode::getPath( char *path, int pathlen ) {
if ( !s ) return 0; if ( !s ) return 0;
*s = 0; *s = 0;
char ret = fl_make_path( path ); char ret = fl_make_path( path );
#if !(defined(__APPLE__) || defined(WIN32)) #if !(defined(__APPLE__) || defined(WIN32)) // PORTME: platform Preferences
// unix: make sure that system prefs dir. is user-readable // unix: make sure that system prefs dir. is user-readable
if (strncmp(path, "/etc/fltk/", 10) == 0) { if (strncmp(path, "/etc/fltk/", 10) == 0) {
fl_chmod(path, 0755); // rwxr-xr-x fl_chmod(path, 0755); // rwxr-xr-x

10
src/Fl_Printer.cxx

@ -66,7 +66,7 @@ const char *Fl_Printer::property_cancel = NULL;
#else #else
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform printing
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the printer device specifics" # pragma message "FL_PORTING: implement the printer device specifics"
#else #else
@ -116,7 +116,7 @@ const char *Fl_Printer::property_save = "Save";
/** [this text may be customized at run-time] */ /** [this text may be customized at run-time] */
const char *Fl_Printer::property_cancel = "Cancel"; const char *Fl_Printer::property_cancel = "Cancel";
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) #if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: platform printing
const char *Fl_System_Printer::class_id = Fl_Printer::class_id; const char *Fl_System_Printer::class_id = Fl_Printer::class_id;
#endif #endif
#if defined(__APPLE__) || defined(WIN32) #if defined(__APPLE__) || defined(WIN32)
@ -126,10 +126,10 @@ const char *Fl_System_Printer::class_id = Fl_Printer::class_id;
const char *Fl_PostScript_Printer::class_id = Fl_Printer::class_id; const char *Fl_PostScript_Printer::class_id = Fl_Printer::class_id;
#endif #endif
#if defined(__APPLE__) || defined(WIN32) #if defined(__APPLE__) || defined(WIN32) // PORTME: platform printing
void Fl_System_Printer::set_current(void) void Fl_System_Printer::set_current(void)
{ {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform printing
fl_gc = (CGContextRef)gc; fl_gc = (CGContextRef)gc;
#elif defined(WIN32) #elif defined(WIN32)
fl_gc = (HDC)gc; fl_gc = (HDC)gc;
@ -145,7 +145,7 @@ void Fl_System_Printer::origin(int *x, int *y)
#endif #endif
Fl_Printer::Fl_Printer(void) { Fl_Printer::Fl_Printer(void) {
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform printing
printer = new Fl_System_Printer(); printer = new Fl_System_Printer();
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the printer device specifics" # pragma message "FL_PORTING: implement the printer device specifics"

4
src/Fl_Sys_Menu_Bar.mm

@ -32,7 +32,7 @@
* Many other calls of the parent class don't work. * Many other calls of the parent class don't work.
*/ */
#if defined(__APPLE__) || defined(FL_DOXYGEN) #if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: platform system menu bar
#include <FL/Fl_Menu_Item.H> #include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Sys_Menu_Bar.H> #include <FL/Fl_Sys_Menu_Bar.H>
#include <FL/x.H> #include <FL/x.H>
@ -524,7 +524,7 @@ void Fl_Mac_App_Menu::custom_application_menu_items(const Fl_Menu_Item *m)
[item release]; [item release];
} }
} }
#endif /* __APPLE__ */ #endif /* __APPLE__ */ // PORTME: platform system menu bar
// //
// End of "$Id$". // End of "$Id$".

16
src/Fl_Text_Display.cxx

@ -31,7 +31,7 @@
#include <FL/Fl_Text_Display.H> #include <FL/Fl_Text_Display.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform editor feel
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: look out for some code that visualizes character composing" # pragma message "FL_PORTING: look out for some code that visualizes character composing"
#else #else
@ -2144,7 +2144,7 @@ void Fl_Text_Display::draw_string(int style,
if (style & PRIMARY_MASK) { if (style & PRIMARY_MASK) {
if (Fl::focus() == (Fl_Widget*)this) { if (Fl::focus() == (Fl_Widget*)this) {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform compose
if (Fl::compose_state) background = color();// Mac OS: underline marked text if (Fl::compose_state) background = color();// Mac OS: underline marked text
else else
#endif #endif
@ -2181,18 +2181,18 @@ void Fl_Text_Display::draw_string(int style,
if (!(style & BG_ONLY_MASK)) { if (!(style & BG_ONLY_MASK)) {
fl_color( foreground ); fl_color( foreground );
fl_font( font, fsize ); fl_font( font, fsize );
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT #if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT // PORTME: platform editor feel
// makes sure antialiased ÄÖÜ do not leak on line above // makes sure antialiased ÄÖÜ do not leak on line above
fl_push_clip(X, Y, toX - X, mMaxsize); fl_push_clip(X, Y, toX - X, mMaxsize);
#endif #endif
fl_draw( string, nChars, X, Y + mMaxsize - fl_descent()); fl_draw( string, nChars, X, Y + mMaxsize - fl_descent());
#ifdef __APPLE__ // Mac OS: underline marked (= selected + Fl::compose_state != 0) text #ifdef __APPLE__ // Mac OS: underline marked (= selected + Fl::compose_state != 0) text // PORTME: platform editor feel
if (Fl::compose_state && (style & PRIMARY_MASK)) { if (Fl::compose_state && (style & PRIMARY_MASK)) {
fl_color( fl_color_average(foreground, background, 0.6) ); fl_color( fl_color_average(foreground, background, 0.6) );
fl_line(X, Y + mMaxsize - 1, X + fl_width(string, nChars), Y + mMaxsize - 1); fl_line(X, Y + mMaxsize - 1, X + fl_width(string, nChars), Y + mMaxsize - 1);
} }
#endif #endif
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT #if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT // PORTME: platform editor feel
fl_pop_clip(); fl_pop_clip();
#endif #endif
} }
@ -2277,7 +2277,7 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) {
if ( X < text_area.x - 1 || X > text_area.x + text_area.w ) if ( X < text_area.x - 1 || X > text_area.x + text_area.w )
return; return;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform compose
Fl::insertion_point_location(X, bot, fontHeight); Fl::insertion_point_location(X, bot, fontHeight);
#endif #endif
/* For cursors other than the block, make them around 2/3 of a character /* For cursors other than the block, make them around 2/3 of a character
@ -3703,7 +3703,7 @@ void Fl_Text_Display::draw(void) {
int has_selection = buffer()->selection_position(&start, &end); int has_selection = buffer()->selection_position(&start, &end);
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE) if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE)
&& ( && (
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform compose
Fl::compose_state || Fl::compose_state ||
#endif #endif
!has_selection || mCursorPos < start || mCursorPos > end) && !has_selection || mCursorPos < start || mCursorPos > end) &&
@ -3881,7 +3881,7 @@ int Fl_Text_Display::handle(int event) {
if (dragType==DRAG_START_DND) { if (dragType==DRAG_START_DND) {
if (!Fl::event_is_click() && Fl::dnd_text_ops()) { if (!Fl::event_is_click() && Fl::dnd_text_ops()) {
const char* copy = buffer()->selection_text(); const char* copy = buffer()->selection_text();
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform compose
Fl_X::dnd(1); Fl_X::dnd(1);
#else #else
Fl::dnd(); Fl::dnd();

10
src/Fl_Text_Editor.cxx

@ -25,7 +25,7 @@
#include <FL/Fl_Text_Editor.H> #include <FL/Fl_Text_Editor.H>
#include <FL/fl_ask.H> #include <FL/fl_ask.H>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform editor
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: add common shortcut for your platform here" # pragma message "FL_PORTING: add common shortcut for your platform here"
#else #else
@ -146,7 +146,7 @@ static struct {
{ FL_Insert, FL_SHIFT, Fl_Text_Editor::kf_paste }, { FL_Insert, FL_SHIFT, Fl_Text_Editor::kf_paste },
{ 'a', FL_CTRL, Fl_Text_Editor::kf_select_all }, { 'a', FL_CTRL, Fl_Text_Editor::kf_select_all },
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform editor feel
// Define CMD+key accelerators... // Define CMD+key accelerators...
{ 'z', FL_COMMAND, Fl_Text_Editor::kf_undo }, { 'z', FL_COMMAND, Fl_Text_Editor::kf_undo },
{ 'x', FL_COMMAND, Fl_Text_Editor::kf_cut }, { 'x', FL_COMMAND, Fl_Text_Editor::kf_cut },
@ -161,7 +161,7 @@ static struct {
{ FL_Right, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move }, { FL_Right, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move },
{ FL_Up, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move }, { FL_Up, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move },
{ FL_Down, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move }, { FL_Down, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move },
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform editor feel
{ 0, 0, 0 } { 0, 0, 0 }
}; };
@ -543,7 +543,7 @@ int Fl_Text_Editor::handle_key() {
if (insert_mode()) insert(Fl::event_text()); if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text()); else overstrike(Fl::event_text());
} }
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform compose
if (Fl::compose_state) { if (Fl::compose_state) {
int pos = this->insert_position(); int pos = this->insert_position();
this->buffer()->select(pos - Fl::compose_state, pos); this->buffer()->select(pos - Fl::compose_state, pos);
@ -586,7 +586,7 @@ int Fl_Text_Editor::handle(int event) {
case FL_UNFOCUS: case FL_UNFOCUS:
show_cursor(mCursorOn); // redraws the cursor show_cursor(mCursorOn); // redraws the cursor
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform compose
if (buffer()->selected() && Fl::compose_state) { if (buffer()->selected() && Fl::compose_state) {
int pos = insert_position(); int pos = insert_position();
buffer()->select(pos, pos); buffer()->select(pos, pos);

4
src/Fl_Tooltip.cxx

@ -75,7 +75,7 @@ Fl_Widget* Fl_Tooltip::widget_ = 0;
static Fl_TooltipBox *window = 0; static Fl_TooltipBox *window = 0;
static int Y,H; static int Y,H;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform additonal function
// returns the unique tooltip window // returns the unique tooltip window
Fl_Window *Fl_Tooltip::current_window(void) Fl_Window *Fl_Tooltip::current_window(void)
{ {
@ -156,7 +156,7 @@ static void tooltip_timeout(void*) {
if (window) window->hide(); if (window) window->hide();
} else { } else {
int condition = 1; int condition = 1;
#if !(defined(__APPLE__) || defined(WIN32)) #if !(defined(__APPLE__) || defined(WIN32)) // PORTME: platform ??
condition = (Fl::grab() == NULL); condition = (Fl::grab() == NULL);
#endif #endif
if ( condition ) { if ( condition ) {

2
src/Fl_Tree_Item.cxx

@ -869,7 +869,7 @@ static void draw_item_focus(Fl_Boxtype B, Fl_Color fg, Fl_Color bg, int X, int Y
} }
fl_color(fl_contrast(fg, bg)); fl_color(fl_contrast(fg, bg));
#if defined(USE_X11) || defined(__APPLE_QUARTZ__) #if defined(USE_X11) || defined(__APPLE_QUARTZ__) // PORTME: platform look and feel
fl_line_style(FL_DOT); fl_line_style(FL_DOT);
fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B), fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B),
W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1); W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1);

14
src/Fl_Tree_Prefs.cxx

@ -28,7 +28,7 @@
// These can be replaced via prefs.openicon()/closeicon() // These can be replaced via prefs.openicon()/closeicon()
// //
static const char * const L_open_xpm[] = { static const char * const L_open_xpm[] = {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform look and feel
"11 11 2 1", "11 11 2 1",
". c None", ". c None",
"@ c #000000", "@ c #000000",
@ -43,7 +43,7 @@ static const char * const L_open_xpm[] = {
"...@@@.....", "...@@@.....",
"...@@......", "...@@......",
"...@......." "...@......."
#else /* __APPLE__ */ #else /* __APPLE__ */ // PORTME: platform look and feel
"11 11 3 1", "11 11 3 1",
". c #fefefe", ". c #fefefe",
"# c #444444", "# c #444444",
@ -59,12 +59,12 @@ static const char * const L_open_xpm[] = {
"#.........#", "#.........#",
"#.........#", "#.........#",
"###########" "###########"
#endif /* __APPLE__ */ #endif /* __APPLE__ */ // PORTME: platform look and feel
}; };
static Fl_Pixmap L_openpixmap(L_open_xpm); static Fl_Pixmap L_openpixmap(L_open_xpm);
static const char * const L_close_xpm[] = { static const char * const L_close_xpm[] = {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform look and feel
"11 11 2 1", "11 11 2 1",
". c None", ". c None",
"@ c #000000", "@ c #000000",
@ -79,7 +79,7 @@ static const char * const L_close_xpm[] = {
".....@.....", ".....@.....",
"...........", "...........",
"..........." "..........."
#else /* __APPLE__ */ #else /* __APPLE__ */ // PORTME: platform look and feel
"11 11 3 1", "11 11 3 1",
". c #fefefe", ". c #fefefe",
"# c #444444", "# c #444444",
@ -95,7 +95,7 @@ static const char * const L_close_xpm[] = {
"#.........#", "#.........#",
"#.........#", "#.........#",
"###########" "###########"
#endif /* __APPLE__ */ #endif /* __APPLE__ */ // PORTME: platform look and feel
}; };
static Fl_Pixmap L_closepixmap(L_close_xpm); static Fl_Pixmap L_closepixmap(L_close_xpm);
@ -157,7 +157,7 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() {
_labelfgcolor = FL_BLACK; _labelfgcolor = FL_BLACK;
_labelbgcolor = 0xffffffff; // we use this as 'transparent' _labelbgcolor = 0xffffffff; // we use this as 'transparent'
_connectorcolor = Fl_Color(43); _connectorcolor = Fl_Color(43);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform look and feel
_connectorstyle = FL_TREE_CONNECTOR_NONE; _connectorstyle = FL_TREE_CONNECTOR_NONE;
#else /* __APPLE__ */ #else /* __APPLE__ */
_connectorstyle = FL_TREE_CONNECTOR_DOTTED; _connectorstyle = FL_TREE_CONNECTOR_DOTTED;

6
src/Fl_Window.cxx

@ -90,7 +90,7 @@ Fl_Window::~Fl_Window() {
delete icon_; delete icon_;
if (shape_data_) { if (shape_data_) {
if (shape_data_->todelete_) delete shape_data_->todelete_; if (shape_data_->todelete_) delete shape_data_->todelete_;
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform window driver
if (shape_data_->mask) { if (shape_data_->mask) {
CGImageRelease(shape_data_->mask); CGImageRelease(shape_data_->mask);
} }
@ -404,7 +404,7 @@ void Fl_Window::free_icons() {
} }
#ifndef __APPLE__ #ifndef __APPLE__ // PORTME: platform window driver
/** /**
Waits for the window to be displayed after calling show(). Waits for the window to be displayed after calling show().
@ -482,7 +482,7 @@ void Fl_Window::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*&
#endif #endif
#endif // ! __APPLE__ #endif // ! __APPLE__ // PORTME: platform window driver
// //
// End of "$Id$". // End of "$Id$".

2
src/Fl_Window_fullscreen.cxx

@ -45,7 +45,7 @@ void Fl_Window::border(int b) {
#elif defined(WIN32) #elif defined(WIN32)
// not yet implemented, but it's possible // not yet implemented, but it's possible
// for full fullscreen we have to make the window topmost as well // for full fullscreen we have to make the window topmost as well
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform window driver
// warning: not implemented in Quartz/Carbon // warning: not implemented in Quartz/Carbon
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "handle window border setting" # pragma message "handle window border setting"

2
src/Fl_Window_hotspot.cxx

@ -49,7 +49,7 @@ void Fl_Window::hotspot(int X, int Y, int offscreen) {
top = bottom = GetSystemMetrics(SM_CYFIXEDFRAME); top = bottom = GetSystemMetrics(SM_CYFIXEDFRAME);
} }
top += GetSystemMetrics(SM_CYCAPTION); top += GetSystemMetrics(SM_CYCAPTION);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform window driver
top = 24; top = 24;
left = 2; left = 2;
right = 2; right = 2;

2
src/Fl_Window_iconize.cxx

@ -27,7 +27,7 @@ void Fl_Window::iconize() {
} else { } else {
#ifdef WIN32 #ifdef WIN32
ShowWindow(i->xid, SW_SHOWMINNOACTIVE); ShowWindow(i->xid, SW_SHOWMINNOACTIVE);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform window driver
i->collapse(); i->collapse();
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: add code to iconify a window" # pragma message "FL_PORTING: add code to iconify a window"

16
src/Fl_Window_shape.cxx

@ -24,7 +24,7 @@
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
#include <string.h> #include <string.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform window driver
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: add code to implement arbitrarily shaped windows" # pragma message "FL_PORTING: add code to implement arbitrarily shaped windows"
#else #else
@ -32,7 +32,7 @@
#ifdef WIN32 #ifdef WIN32
# include <malloc.h> // needed for VisualC2010 # include <malloc.h> // needed for VisualC2010
#elif !defined(__APPLE__) #elif !defined(__APPLE__) // PORTME: platform window driver
#include <config.h> #include <config.h>
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
#include <dlfcn.h> #include <dlfcn.h>
@ -42,7 +42,7 @@
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform window driver
static void MyProviderReleaseData (void *info, const void *data, size_t size) { static void MyProviderReleaseData (void *info, const void *data, size_t size) {
delete[] (uchar*)data; delete[] (uchar*)data;
@ -175,12 +175,12 @@ void Fl_Window::combine_mask()
} }
#endif // !FL_DOXYGEN #endif // !FL_DOXYGEN
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform window driver
void Fl_Window::shape_bitmap_(Fl_Image* b) { void Fl_Window::shape_bitmap_(Fl_Image* b) {
shape_data_->shape_ = b; shape_data_->shape_ = b;
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform window driver
if (b) { if (b) {
// complement mask bits and perform bitwise inversion of all bytes and also reverse top and bottom // complement mask bits and perform bitwise inversion of all bytes and also reverse top and bottom
int bytes_per_row = (b->w() + 7)/8; int bytes_per_row = (b->w() + 7)/8;
@ -201,7 +201,7 @@ void Fl_Window::shape_bitmap_(Fl_Image* b) {
} }
#if defined(__APPLE__) // on the mac, use an 8-bit mask #if defined(__APPLE__) // on the mac, use an 8-bit mask // PORTME: platform window driver
/* the image can be of any depth /* the image can be of any depth
offset gives the byte offset from the pixel start to the byte used to construct the shape offset gives the byte offset from the pixel start to the byte used to construct the shape
*/ */
@ -325,7 +325,7 @@ void Fl_Window::shape_pixmap_(Fl_Image* pixmap) {
void Fl_Window::shape(const Fl_Image* img) { void Fl_Window::shape(const Fl_Image* img) {
if (shape_data_) { if (shape_data_) {
if (shape_data_->todelete_) { delete shape_data_->todelete_; } if (shape_data_->todelete_) { delete shape_data_->todelete_; }
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform window driver
if (shape_data_->mask) { CGImageRelease(shape_data_->mask); } if (shape_data_->mask) { CGImageRelease(shape_data_->mask); }
#endif #endif
} }
@ -391,7 +391,7 @@ void Fl_Window::draw() {
} }
draw_children(); draw_children();
#ifdef __APPLE_QUARTZ__ #ifdef __APPLE_QUARTZ__ // PORTME: platform window driver
// on OS X, windows have no frame. Before OS X 10.7, to resize a window, we drag the lower right // on OS X, windows have no frame. Before OS X 10.7, to resize a window, we drag the lower right
// corner. This code draws a little ribbed triangle for dragging. // corner. This code draws a little ribbed triangle for dragging.
if (fl_mac_os_version < 100700 && fl_gc && !parent() && resizable() && if (fl_mac_os_version < 100700 && fl_gc && !parent() && resizable() &&

2
src/Fl_abort.cxx

@ -26,7 +26,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "flstring.h" #include "flstring.h"
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: native message box
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: use native message box below if one is available" # pragma message "FL_PORTING: use native message box below if one is available"
#else #else

24
src/Fl_arg.cxx

@ -28,13 +28,13 @@
#include <ctype.h> #include <ctype.h>
#include "flstring.h" #include "flstring.h"
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: command line arguments
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement special command line handling" # pragma message "FL_PORTING: implement special command line handling"
#else #else
#endif #endif
#if defined(WIN32) || defined(__APPLE__) || defined(FL_PORTING) #if defined(WIN32) || defined(__APPLE__) || defined(FL_PORTING) // PORTME: parse geometry
int XParseGeometry(const char*, int*, int*, unsigned int*, unsigned int*); int XParseGeometry(const char*, int*, int*, unsigned int*, unsigned int*);
# define NoValue 0x0000 # define NoValue 0x0000
# define XValue 0x0001 # define XValue 0x0001
@ -175,13 +175,13 @@ int Fl::arg(int argc, char **argv, int &i) {
Fl_Tooltip::disable(); Fl_Tooltip::disable();
i++; i++;
return 1; return 1;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform command line
// The Finder application in MacOS X passes the "-psn_N_NNNNN" option // The Finder application in MacOS X passes the "-psn_N_NNNNN" option
// to all apps... // to all apps...
} else if (strncmp(s, "psn_", 4) == 0) { } else if (strncmp(s, "psn_", 4) == 0) {
i++; i++;
return 1; return 1;
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform command line
} }
const char *v = argv[i+1]; const char *v = argv[i+1];
@ -195,16 +195,16 @@ int Fl::arg(int argc, char **argv, int &i) {
if (!flags) return 0; if (!flags) return 0;
geometry = v; geometry = v;
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform command line
} else if (fl_match(s, "display", 2)) { } else if (fl_match(s, "display", 2)) {
Fl::display(v); Fl::display(v);
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform command line
// Xcode in MacOS X may pass "-NSDocumentRevisionsDebugMode YES" // Xcode in MacOS X may pass "-NSDocumentRevisionsDebugMode YES"
} else if (strcmp(s, "NSDocumentRevisionsDebugMode") == 0) { } else if (strcmp(s, "NSDocumentRevisionsDebugMode") == 0) {
// nothing to do // nothing to do
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform command line
} else if (fl_match(s, "title", 2)) { } else if (fl_match(s, "title", 2)) {
title = v; title = v;
@ -303,7 +303,7 @@ void Fl_Window::show(int argc, char **argv) {
Fl::get_system_colors(); Fl::get_system_colors();
#if defined(WIN32) #if defined(WIN32)
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform default parameters
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: Parse additional default settings" # pragma message "FL_PORTING: Parse additional default settings"
#else // X11 #else // X11
@ -327,7 +327,7 @@ void Fl_Window::show(int argc, char **argv) {
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 || if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
strcasecmp(val, "on") == 0 || strcasecmp(val, "on") == 0 ||
strcasecmp(val, "yes") == 0); strcasecmp(val, "yes") == 0);
#endif // !WIN32 && !__APPLE__ #endif // !WIN32 && !__APPLE__ // PORTME: platform defaults
// set colors first, so background_pixel is correct: // set colors first, so background_pixel is correct:
static char beenhere; static char beenhere;
@ -367,7 +367,7 @@ void Fl_Window::show(int argc, char **argv) {
show(); show();
#if defined(WIN32) #if defined(WIN32)
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform properties
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: Parse additional default settings" # pragma message "FL_PORTING: Parse additional default settings"
#else // X11 #else // X11
@ -380,7 +380,7 @@ void Fl_Window::show(int argc, char **argv) {
XChangeProperty(fl_display, fl_xid(this), XA_WM_COMMAND, XA_STRING, 8, 0, XChangeProperty(fl_display, fl_xid(this), XA_WM_COMMAND, XA_STRING, 8, 0,
(unsigned char *)buffer, p-buffer-1); (unsigned char *)buffer, p-buffer-1);
delete[] buffer; delete[] buffer;
#endif // !WIN32 && !__APPLE__ #endif // !WIN32 && !__APPLE__ // PORTME: platform properties
} }
// Calls useful for simple demo programs, with automatic help message: // Calls useful for simple demo programs, with automatic help message:
@ -417,7 +417,7 @@ void Fl::args(int argc, char **argv) {
int i; if (Fl::args(argc,argv,i) < argc) Fl::error(helpmsg); int i; if (Fl::args(argc,argv,i) < argc) Fl::error(helpmsg);
} }
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform command line arguments
/* the following function was stolen from the X sources as indicated. */ /* the following function was stolen from the X sources as indicated. */

4
src/Fl_cocoa.mm

@ -29,8 +29,6 @@
// One Compile to copy them all and in the bundle bind them, // One Compile to copy them all and in the bundle bind them,
// in the Land of MacOS X where the Drop-Shadows lie." // in the Land of MacOS X where the Drop-Shadows lie."
#ifdef __APPLE__
#define CONSOLIDATE_MOTION 0 #define CONSOLIDATE_MOTION 0
extern "C" { extern "C" {
#include <pthread.h> #include <pthread.h>
@ -4525,8 +4523,6 @@ int Fl_X::calc_mac_os_version() {
return M*10000 + m*100 + b; return M*10000 + m*100 + b;
} }
#endif // __APPLE__
// //
// End of "$Id$". // End of "$Id$".
// //

16
src/Fl_compose.cxx

@ -26,12 +26,12 @@ Utility functions to support text input.
#ifndef FL_DOXYGEN #ifndef FL_DOXYGEN
int Fl::compose_state = 0; int Fl::compose_state = 0;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform character composition
int Fl_X::next_marked_length = 0; int Fl_X::next_marked_length = 0;
#endif #endif
#endif #endif
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform character composition
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement keyboard composing in the code below" # pragma message "FL_PORTING: implement keyboard composing in the code below"
#else // X11 #else // X11
@ -80,7 +80,7 @@ extern XIC fl_xim_ic;
*/ */
int Fl::compose(int& del) { int Fl::compose(int& del) {
int condition; int condition;
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform character composition
int has_text_key = Fl::compose_state || Fl::e_keysym <= '~' || Fl::e_keysym == FL_Iso_Key || int has_text_key = Fl::compose_state || Fl::e_keysym <= '~' || Fl::e_keysym == FL_Iso_Key ||
(Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last && Fl::e_keysym != FL_KP_Enter); (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last && Fl::e_keysym != FL_KP_Enter);
condition = Fl::e_state&(FL_META | FL_CTRL) || condition = Fl::e_state&(FL_META | FL_CTRL) ||
@ -93,10 +93,10 @@ unsigned char ascii = (unsigned char)e_text[0];
#else #else
condition = (e_state & (FL_ALT | FL_META | FL_CTRL)) && !(ascii & 128) ; condition = (e_state & (FL_ALT | FL_META | FL_CTRL)) && !(ascii & 128) ;
#endif // WIN32 #endif // WIN32
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform character composition
if (condition) { del = 0; return 0;} // this stuff is to be treated as a function key if (condition) { del = 0; return 0;} // this stuff is to be treated as a function key
del = Fl::compose_state; del = Fl::compose_state;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform character composition
Fl::compose_state = Fl_X::next_marked_length; Fl::compose_state = Fl_X::next_marked_length;
#else #else
Fl::compose_state = 0; Fl::compose_state = 0;
@ -106,7 +106,7 @@ unsigned char ascii = (unsigned char)e_text[0];
return 1; return 1;
} }
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform character composition
static int insertion_point_x = 0; static int insertion_point_x = 0;
static int insertion_point_y = 0; static int insertion_point_y = 0;
static int insertion_point_height = 0; static int insertion_point_height = 0;
@ -132,7 +132,7 @@ void Fl::insertion_point_location(int x, int y, int height) {
insertion_point_y = y; insertion_point_y = y;
insertion_point_height = height; insertion_point_height = height;
} }
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform character composition
/** /**
If the user moves the cursor, be sure to call Fl::compose_reset(). If the user moves the cursor, be sure to call Fl::compose_reset().
@ -143,7 +143,7 @@ void Fl::insertion_point_location(int x, int y, int height) {
void Fl::compose_reset() void Fl::compose_reset()
{ {
Fl::compose_state = 0; Fl::compose_state = 0;
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform character composition
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: compose reset extra functions" # pragma message "FL_PORTING: compose reset extra functions"
#else #else

4
src/Fl_display.cxx

@ -30,7 +30,7 @@
and does nothing useful under WIN32. and does nothing useful under WIN32.
*/ */
void Fl::display(const char *d) { void Fl::display(const char *d) {
#if defined(__APPLE__) || defined(WIN32) #if defined(__APPLE__) || defined(WIN32) // PORTME: platform screen stuff
(void)d; (void)d;
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: initiate a connection to the display" # pragma message "FL_PORTING: initiate a connection to the display"
@ -45,7 +45,7 @@ void Fl::display(const char *d) {
} }
} }
putenv(e); putenv(e);
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform screen stuff
} }
// //

2
src/Fl_get_key.cxx

@ -18,7 +18,7 @@
#ifdef WIN32 #ifdef WIN32
# include "Fl_get_key_win32.cxx" # include "Fl_get_key_win32.cxx"
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform keyboard stuff
# include "Fl_get_key_mac.cxx" # include "Fl_get_key_mac.cxx"
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement keyboard reading and interpretation in its own file" # pragma message "FL_PORTING: implement keyboard reading and interpretation in its own file"

10
src/Fl_get_system_colors.cxx

@ -92,7 +92,7 @@ static void set_selection_color(uchar r, uchar g, uchar b) {
Fl::set_color(FL_SELECTION_COLOR,r,g,b); Fl::set_color(FL_SELECTION_COLOR,r,g,b);
} }
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform system colors
# include <stdio.h> # include <stdio.h>
// simulation of XParseColor: // simulation of XParseColor:
@ -132,7 +132,7 @@ int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
return 1; return 1;
} else return 0; } else return 0;
} }
#endif // WIN32 || __APPLE__ #endif // WIN32 || __APPLE__ // PORTME: platform system colors
/** \fn Fl::get_system_colors() /** \fn Fl::get_system_colors()
@ -172,7 +172,7 @@ void Fl::get_system_colors() {
getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color); getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color);
} }
#elif defined(__APPLE__) // --- APPLE --- #elif defined(__APPLE__) // PORTME: platform system colors
// MacOS X currently supports two color schemes - Blue and Graphite. // MacOS X currently supports two color schemes - Blue and Graphite.
// Since we aren't emulating the Aqua interface (even if Apple would // Since we aren't emulating the Aqua interface (even if Apple would
@ -300,7 +300,7 @@ static Fl_Pixmap tile(tile_xpm);
int Fl::scheme(const char *s) { int Fl::scheme(const char *s) {
if (!s) { if (!s) {
if ((s = getenv("FLTK_SCHEME")) == NULL) { if ((s = getenv("FLTK_SCHEME")) == NULL) {
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform system scheme
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl::scheme" # pragma message "FL_PORTING: implement Fl::scheme"
#else #else
@ -309,7 +309,7 @@ int Fl::scheme(const char *s) {
if (!key) key = "fltk"; if (!key) key = "fltk";
fl_open_display(); fl_open_display();
s = XGetDefault(fl_display, key, "scheme"); s = XGetDefault(fl_display, key, "scheme");
#endif // !WIN32 && !__APPLE__ #endif // !WIN32 && !__APPLE__ // PORTME: platform system scheme
} }
} }

6
src/Fl_grab.cxx

@ -36,7 +36,7 @@ extern void fl_fix_focus(); // in Fl.cxx
// see where and how this is used. // see where and how this is used.
extern HWND fl_capture; extern HWND fl_capture;
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform focus grabbing
extern void *fl_capture; extern void *fl_capture;
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
@ -61,7 +61,7 @@ void Fl::grab(Fl_Window* win) {
#ifdef WIN32 #ifdef WIN32
SetActiveWindow(fl_capture = fl_xid(first_window())); SetActiveWindow(fl_capture = fl_xid(first_window()));
SetCapture(fl_capture); SetCapture(fl_capture);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform focus grabbing
fl_capture = Fl_X::i(first_window())->xid; fl_capture = Fl_X::i(first_window())->xid;
Fl_X::i(first_window())->set_key_window(); Fl_X::i(first_window())->set_key_window();
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
@ -92,7 +92,7 @@ void Fl::grab(Fl_Window* win) {
#ifdef WIN32 #ifdef WIN32
fl_capture = 0; fl_capture = 0;
ReleaseCapture(); ReleaseCapture();
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform focus grabbing
fl_capture = 0; fl_capture = 0;
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement event grabbing" # pragma message "FL_PORTING: implement event grabbing"

2
src/Fl_own_colormap.cxx

@ -41,7 +41,7 @@
void Fl::own_colormap() {} void Fl::own_colormap() {}
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform colormap
// MacOS X always provides a TrueColor interface... // MacOS X always provides a TrueColor interface...
void Fl::own_colormap() {} void Fl::own_colormap() {}

2
src/Fl_visual.cxx

@ -65,7 +65,7 @@ int Fl::visual(int flags) {
if ((flags & FL_RGB8) && GetDeviceCaps(fl_gc,BITSPIXEL)<24) return 0; if ((flags & FL_RGB8) && GetDeviceCaps(fl_gc,BITSPIXEL)<24) return 0;
return 1; return 1;
} }
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform visuals
// \todo Mac : need to implement Visual flags // \todo Mac : need to implement Visual flags
int Fl::visual(int flags) { int Fl::visual(int flags) {

2
src/Fl_x.cxx

@ -18,7 +18,7 @@
#ifdef WIN32 #ifdef WIN32
//# include "Fl_win32.cxx" //# include "Fl_win32.cxx"
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform window driver
//# include "Fl_mac.cxx" // now Fl_cocoa.mm //# include "Fl_mac.cxx" // now Fl_cocoa.mm
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the FLTK core in its own file" # pragma message "FL_PORTING: implement the FLTK core in its own file"

8
src/config_lib.h

@ -15,7 +15,7 @@
// find the right graphics configuration // find the right graphics configuration
#if !defined(FL_CFG_GFX_XLIB) && !defined(FL_CFG_GFX_QUARTZ) && !defined(FL_CFG_GFX_GDI) #if !defined(FL_CFG_GFX_XLIB) && !defined(FL_CFG_GFX_QUARTZ) && !defined(FL_CFG_GFX_GDI)
#ifdef __APPLE__ #ifdef __APPLE__ // default configurations
# define FL_CFG_GFX_QUARTZ # define FL_CFG_GFX_QUARTZ
# ifdef HAVE_GL # ifdef HAVE_GL
# define FL_CFG_GFX_OPENGL # define FL_CFG_GFX_OPENGL
@ -40,7 +40,7 @@
// find the right printer driver configuration // find the right printer driver configuration
#if !defined(FL_CFG_PRN_PS) && !defined(FL_CFG_PRN_QUARTZ) && !defined(FL_CFG_PRN_WIN32) #if !defined(FL_CFG_PRN_PS) && !defined(FL_CFG_PRN_QUARTZ) && !defined(FL_CFG_PRN_WIN32)
#ifdef __APPLE__ #ifdef __APPLE__ // default configurations
# define FL_CFG_PRN_QUARTZ # define FL_CFG_PRN_QUARTZ
#elif defined(WIN32) #elif defined(WIN32)
# define FL_CFG_WIN_WIN32 # define FL_CFG_WIN_WIN32
@ -56,7 +56,7 @@
// find the right window manager configuration // find the right window manager configuration
#if !defined(FL_CFG_WIN_X11) && !defined(FL_CFG_WIN_COCOA) && !defined(FL_CFG_WIN_WIN32) #if !defined(FL_CFG_WIN_X11) && !defined(FL_CFG_WIN_COCOA) && !defined(FL_CFG_WIN_WIN32)
#ifdef __APPLE__ #ifdef __APPLE__ // default configurations
# define FL_CFG_WIN_COCOA # define FL_CFG_WIN_COCOA
#elif defined(WIN32) #elif defined(WIN32)
# define FL_CFG_WIN_WIN32 # define FL_CFG_WIN_WIN32
@ -72,7 +72,7 @@
// find the right system configuration // find the right system configuration
#if !defined(FL_CFG_SYS_POSIX) && !defined(FL_CFG_SYS_WIN32) #if !defined(FL_CFG_SYS_POSIX) && !defined(FL_CFG_SYS_WIN32)
#ifdef __APPLE__ #ifdef __APPLE__ // default configurations
# define FL_CFG_SYS_POSIX # define FL_CFG_SYS_POSIX
#elif defined(WIN32) #elif defined(WIN32)
# define FL_CFG_SYS_WIN32 # define FL_CFG_SYS_WIN32

2
src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx

@ -21,6 +21,8 @@
#include "Fl_Cocoa_Window_Driver.h" #include "Fl_Cocoa_Window_Driver.h"
// Fl_Cocoa_Window_Driver
// //
// End of "$Id$". // End of "$Id$".
// //

8
src/drivers/Cocoa/Fl_Cocoa_Window_Driver.h

@ -25,7 +25,7 @@
#ifndef FL_COCOA_WINDOW_DRIVER_H #ifndef FL_COCOA_WINDOW_DRIVER_H
#define FL_COCOA_WINDOW_DRIVER_H #define FL_COCOA_WINDOW_DRIVER_H
#include <FL/Fl_Graphics_Driver.H> #include <FL/x.H>
/* /*
Move everything here that manages the native window interface. Move everything here that manages the native window interface.
@ -42,6 +42,12 @@
? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx? ? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx?
*/ */
class FL_EXPORT Fl_Cocoa_Window_Driver : public Fl_X
{
public:
};
#endif // FL_COCOA_WINDOW_DRIVER_H #endif // FL_COCOA_WINDOW_DRIVER_H

80
src/drivers/Quartz/Fl_Quartz_Display_Device.cxx

@ -19,102 +19,22 @@
// FIXME: implement this // FIXME: implement this
#if 0 #if 0
#include <FL/Fl.H>
#include <FL/Fl_Device.H>
#include <FL/Fl_Image.H>
#include "config_lib.h"
#ifdef FL_CFG_GFX_QUARTZ
#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.h"
#endif
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate and implement various device drivers here"
#else
#endif
const char *Fl_Device::class_id = "Fl_Device";
const char *Fl_Surface_Device::class_id = "Fl_Surface_Device";
const char *Fl_Display_Device::class_id = "Fl_Display_Device"; const char *Fl_Display_Device::class_id = "Fl_Display_Device";
const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
#if defined(WIN32) || defined(FL_DOXYGEN)
const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver";
#endif
#if !(defined(__APPLE__) || defined(WIN32))
#if defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate the main graphics driver here"
#else
const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
#endif
#endif
/** \brief Make this surface the current drawing surface.
This surface will receive all future graphics requests. */
void Fl_Surface_Device::set_current(void)
{
fl_graphics_driver = _driver;
_surface = this;
}
FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver; // the current target device of graphics operations
Fl_Surface_Device* Fl_Surface_Device::_surface; // the current target surface of graphics operations
const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
Fl_Graphics_Driver::Fl_Graphics_Driver() {
font_ = 0;
size_ = 0;
sptr=0; rstackptr=0;
rstack[0] = NULL;
fl_clip_state_number=0;
m = m0;
fl_matrix = &m;
p = (XPOINT *)0;
font_descriptor_ = NULL;
p_size = 0;
};
void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h)
{
w = (int)width(t, n);
h = - height();
dx = 0;
dy = descent();
}
/** A constructor that sets the graphics driver used by the display */ /** A constructor that sets the graphics driver used by the display */
Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device(graphics_driver) { Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device(graphics_driver) {
this->set_current(); this->set_current();
}; };
/** Returns the platform display device. */ /** Returns the platform display device. */
Fl_Display_Device *Fl_Display_Device::display_device() { Fl_Display_Device *Fl_Display_Device::display_device() {
static Fl_Display_Device *display = new Fl_Display_Device(new static Fl_Display_Device *display = new Fl_Display_Device(new
#if defined(__APPLE__)
Fl_Quartz_Graphics_Driver
#elif defined(WIN32)
Fl_GDI_Graphics_Driver
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate your display driver here"
Fl_XXX_Graphics_Driver Fl_XXX_Graphics_Driver
#else
Fl_Xlib_Graphics_Driver
#endif
); );
return display; return display;
}; };
Fl_Surface_Device *Fl_Surface_Device::default_surface()
{
return Fl_Display_Device::display_device();
}
Fl_Display_Device *Fl_Display_Device::_display = Fl_Display_Device::display_device(); Fl_Display_Device *Fl_Display_Device::_display = Fl_Display_Device::display_device();
#endif #endif

35
src/drivers/Quartz/Fl_Quartz_Display_Device.h

@ -26,41 +26,6 @@
#define FL_QUARTZ_DISPLAY_DEVICE_H #define FL_QUARTZ_DISPLAY_DEVICE_H
// FIXME: implement this // FIXME: implement this
#if 0
#include <FL/x.H>
#include <FL/Fl_Plugin.H>
#include <FL/Fl_Image.H>
#include <FL/Fl_Bitmap.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_RGB_Image.H>
#include <stdlib.h>
/**
A display to which the computer can draw.
When the program begins running, an Fl_Display_Device instance has been created and made the current drawing surface.
There is no need to create any other object of this class.
*/
class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
friend class Fl_Quartz_Graphics_Driver;
static Fl_Display_Device *_display; // the platform display device
#ifdef __APPLE__
friend class Fl_X;
friend class Fl_Graphics_Driver;
static bool high_res_window_; //< true when drawing to a window of a retina display (Mac OS X only)
static bool high_resolution() {return high_res_window_;}
#elif defined(WIN32)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement functions for extra high res drawing if your platform supports it"
#else
#endif
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
static Fl_Display_Device *display_device();
};
#endif
#endif // FL_QUARTZ_DISPLAY_DEVICE_H #endif // FL_QUARTZ_DISPLAY_DEVICE_H

4
src/filename_absolute.cxx

@ -219,11 +219,11 @@ fl_filename_relative(char *to, // O - Relative filename
*slash != '\0' && *newslash != '\0'; *slash != '\0' && *newslash != '\0';
slash ++, newslash ++) slash ++, newslash ++)
if (isdirsep(*slash) && isdirsep(*newslash)) continue; if (isdirsep(*slash) && isdirsep(*newslash)) continue;
#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__) #if defined(WIN32) || defined(__EMX__) || defined(__APPLE__) // PORTME: filename stuff
else if (tolower(*slash & 255) != tolower(*newslash & 255)) break; else if (tolower(*slash & 255) != tolower(*newslash & 255)) break;
#else #else
else if (*slash != *newslash) break; else if (*slash != *newslash) break;
#endif // WIN32 || __EMX__ || __APPLE__ #endif // WIN32 || __EMX__ || __APPLE__ // PORTME: filename stuff
// skip over trailing slashes // skip over trailing slashes
if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash) if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash)

2
src/filename_ext.cxx

@ -21,7 +21,7 @@
#include <FL/filename.H> #include <FL/filename.H>
#ifdef WIN32 #ifdef WIN32
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: filename stuff
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement directory and filename handling for your platform if needed" # pragma message "FL_PORTING: implement directory and filename handling for your platform if needed"
#else // X11 #else // X11

2
src/filename_isdir.cxx

@ -26,7 +26,7 @@
#include <FL/fl_utf8.h> #include <FL/fl_utf8.h>
#ifdef WIN32 #ifdef WIN32
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: directory stuff
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement directory and filename handling for your platform if needed" # pragma message "FL_PORTING: implement directory and filename handling for your platform if needed"
#else // X11 #else // X11

16
src/filename_list.cxx

@ -22,12 +22,12 @@
#include <FL/fl_utf8.h> #include <FL/fl_utf8.h>
#include "flstring.h" #include "flstring.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: directory stuff
#include <FL/x.H> #include <FL/x.H>
#endif #endif
#ifdef WIN32 #ifdef WIN32
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: directory stuff
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement directory and filename handling for your platform if needed" # pragma message "FL_PORTING: implement directory and filename handling for your platform if needed"
#else // X11 #else // X11
@ -94,7 +94,7 @@ int fl_filename_list(const char *d, dirent ***list,
// Assume that locale encoding is no less dense than UTF-8 // Assume that locale encoding is no less dense than UTF-8
dirlen = strlen(d); dirlen = strlen(d);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: directory stuff
dirloc = (char *)d; dirloc = (char *)d;
#else #else
dirloc = (char *)malloc(dirlen + 1); dirloc = (char *)malloc(dirlen + 1);
@ -104,7 +104,7 @@ int fl_filename_list(const char *d, dirent ***list,
#ifndef HAVE_SCANDIR #ifndef HAVE_SCANDIR
// This version is when we define our own scandir // This version is when we define our own scandir
int n = fl_scandir(dirloc, list, 0, sort); int n = fl_scandir(dirloc, list, 0, sort);
#elif defined(HAVE_SCANDIR_POSIX) && !defined(__APPLE__) #elif defined(HAVE_SCANDIR_POSIX) && !defined(__APPLE__) // PORTME: directory stuff
// POSIX (2008) defines the comparison function like this: // POSIX (2008) defines the comparison function like this:
int n = scandir(dirloc, list, 0, (int(*)(const dirent **, const dirent **))sort); int n = scandir(dirloc, list, 0, (int(*)(const dirent **, const dirent **))sort);
#elif defined(__osf__) #elif defined(__osf__)
@ -115,7 +115,7 @@ int fl_filename_list(const char *d, dirent ***list,
int n = scandir(dirloc, list, 0, (int(*)(void*, void*))sort); int n = scandir(dirloc, list, 0, (int(*)(void*, void*))sort);
#elif defined(__sgi) #elif defined(__sgi)
int n = scandir(dirloc, list, 0, sort); int n = scandir(dirloc, list, 0, sort);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: directory stuff
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
int n = scandir(dirloc, list, 0, (int(*)(const struct dirent**,const struct dirent**))sort); int n = scandir(dirloc, list, 0, (int(*)(const struct dirent**,const struct dirent**))sort);
# else # else
@ -131,7 +131,7 @@ int fl_filename_list(const char *d, dirent ***list,
int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort); int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort);
#endif #endif
#ifndef __APPLE__ #ifndef __APPLE__ // PORTME: directory stuff
free(dirloc); free(dirloc);
#endif #endif
@ -150,7 +150,7 @@ int fl_filename_list(const char *d, dirent ***list,
int newlen; int newlen;
dirent *de = (*list)[i]; dirent *de = (*list)[i];
int len = strlen(de->d_name); int len = strlen(de->d_name);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: directory stuff
newlen = len; newlen = len;
#else #else
newlen = fl_utf8from_mb(NULL, 0, de->d_name, len); newlen = fl_utf8from_mb(NULL, 0, de->d_name, len);
@ -159,7 +159,7 @@ int fl_filename_list(const char *d, dirent ***list,
// Conversion to UTF-8 // Conversion to UTF-8
memcpy(newde, de, de->d_name - (char*)de); memcpy(newde, de, de->d_name - (char*)de);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: directory stuff
strcpy(newde->d_name, de->d_name); strcpy(newde->d_name, de->d_name);
#else #else
fl_utf8from_mb(newde->d_name, newlen + 1, de->d_name, len); fl_utf8from_mb(newde->d_name, newlen + 1, de->d_name, len);

2
src/fl_call_main.c

@ -37,7 +37,7 @@
* Microsoft(r) Windows(r) that allows for it. * Microsoft(r) Windows(r) that allows for it.
*/ */
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform main()
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement 'main()' here if your platform provides another app entry point" # pragma message "FL_PORTING: implement 'main()' here if your platform provides another app entry point"
#else #else

2
src/fl_dnd.cxx

@ -18,7 +18,7 @@
#ifdef WIN32 #ifdef WIN32
# include "fl_dnd_win32.cxx" # include "fl_dnd_win32.cxx"
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform dnd
//# include "fl_dnd_mac.cxx" //# include "fl_dnd_mac.cxx"
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement drag and drop in its own platform file" # pragma message "FL_PORTING: implement drag and drop in its own platform file"

8
src/fl_draw_pixmap.cxx

@ -38,7 +38,7 @@
#include <stdio.h> #include <stdio.h>
#include "flstring.h" #include "flstring.h"
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform pixmap
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement platform specific about pixmap drawing here" # pragma message "FL_PORTING: implement platform specific about pixmap drawing here"
#else #else
@ -256,7 +256,7 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
} }
// FIXME: Hack until fl_draw_image() supports alpha properly // FIXME: Hack until fl_draw_image() supports alpha properly
#ifdef __APPLE_QUARTZ__ #ifdef __APPLE_QUARTZ__ // PORTME: platform pixmap
if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) { if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) {
Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4); Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4);
rgb->alloc_array = 1; rgb->alloc_array = 1;
@ -264,7 +264,7 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
delete rgb; delete rgb;
return 1; return 1;
} else { } else {
#endif // __APPLE_QUARTZ__ #endif // __APPLE_QUARTZ__ // PORTME: platform pixmap
// build the mask bitmap used by Fl_Pixmap: // build the mask bitmap used by Fl_Pixmap:
if (fl_mask_bitmap) { if (fl_mask_bitmap) {
int W = (w+7)/8; int W = (w+7)/8;
@ -289,7 +289,7 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
fl_draw_image(buffer, x, y, w, h, 4); fl_draw_image(buffer, x, y, w, h, 4);
#ifdef __APPLE_QUARTZ__ #ifdef __APPLE_QUARTZ__ // PORTME: platform pixmap
} }
#endif #endif
delete[] buffer; delete[] buffer;

2
src/fl_encoding_latin1.cxx

@ -21,7 +21,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "flstring.h" #include "flstring.h"
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform text encoding
// These function assume a western code page. If you need to support // These function assume a western code page. If you need to support
// scripts that are not part of this code page, you might want to // scripts that are not part of this code page, you might want to

2
src/fl_encoding_mac_roman.cxx

@ -35,7 +35,7 @@
// lookup tables below will convert all common character codes and replace // lookup tables below will convert all common character codes and replace
// unknown characters with an upsidedown question mark. // unknown characters with an upsidedown question mark.
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform text encoding
const char *fl_mac_roman_to_local(const char *t, int) const char *fl_mac_roman_to_local(const char *t, int)
{ {

4
src/fl_font.cxx

@ -31,7 +31,7 @@
// all driver code is now in drivers/XXX/Fl_XXX_Graphics_Driver_xyz.cxx // all driver code is now in drivers/XXX/Fl_XXX_Graphics_Driver_xyz.cxx
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform font stuff
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you need the XFontStruct ?" # pragma message "FL_PORTING: do you need the XFontStruct ?"
#else #else
@ -64,7 +64,7 @@ void fl_text_extents(const char *c, int &dx, int &dy, int &w, int &h) {
void fl_draw(const char* str, int l, float x, float y) { void fl_draw(const char* str, int l, float x, float y) {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform alternative API
fl_graphics_driver->draw(str, l, x, y); fl_graphics_driver->draw(str, l, x, y);
#else #else
fl_draw(str, l, (int)x, (int)y); fl_draw(str, l, (int)x, (int)y);

12
src/fl_open_uri.cxx

@ -45,9 +45,9 @@
// Local functions... // Local functions...
// //
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform open doc
static char *path_find(const char *program, char *filename, int filesize); static char *path_find(const char *program, char *filename, int filesize);
#endif // !WIN32 && !__APPLE__ #endif // !WIN32 && !__APPLE__ // PORTME: platform open doc
#ifndef WIN32 #ifndef WIN32
static int run_program(const char *program, char **argv, char *msg, int msglen); static int run_program(const char *program, char **argv, char *msg, int msglen);
#endif // !WIN32 #endif // !WIN32
@ -131,7 +131,7 @@ fl_open_uri(const char *uri, char *msg, int msglen) {
return (int)(ShellExecute(HWND_DESKTOP, "open", uri, NULL, NULL, SW_SHOW) > (void *)32); return (int)(ShellExecute(HWND_DESKTOP, "open", uri, NULL, NULL, SW_SHOW) > (void *)32);
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform open doc
char *argv[3]; // Command-line arguments char *argv[3]; // Command-line arguments
argv[0] = (char*)"open"; argv[0] = (char*)"open";
@ -145,7 +145,7 @@ fl_open_uri(const char *uri, char *msg, int msglen) {
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: add code to open any file type with an external app" # pragma message "FL_PORTING: add code to open any file type with an external app"
#else // !WIN32 && !__APPLE__ #else // !WIN32 && !__APPLE__ // PORTME: platform open doc
// Run any of several well-known commands to open the URI. // Run any of several well-known commands to open the URI.
// //
// We give preference to the Portland group's xdg-utils // We give preference to the Portland group's xdg-utils
@ -270,7 +270,7 @@ void fl_decode_uri(char *uri)
/** @} */ /** @} */
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform open doc
// Find a program in the path... // Find a program in the path...
static char *path_find(const char *program, char *filename, int filesize) { static char *path_find(const char *program, char *filename, int filesize) {
const char *path; // Search path const char *path; // Search path
@ -302,7 +302,7 @@ static char *path_find(const char *program, char *filename, int filesize) {
return 0; return 0;
} }
#endif // !WIN32 && !__APPLE__ #endif // !WIN32 && !__APPLE__ // PORTME: platform open doc
#ifndef WIN32 #ifndef WIN32

6
src/fl_overlay.cxx

@ -23,7 +23,7 @@
#include <FL/x.H> #include <FL/x.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform overlay
#include <config.h> #include <config.h>
#endif #endif
@ -48,7 +48,7 @@ static void draw_current_rect() {
int old = SetROP2(fl_gc, R2_NOT); int old = SetROP2(fl_gc, R2_NOT);
fl_rect(px, py, pw, ph); fl_rect(px, py, pw, ph);
SetROP2(fl_gc, old); SetROP2(fl_gc, old);
# elif defined(__APPLE_QUARTZ__) # elif defined(__APPLE_QUARTZ__) // PORTME: platform overlay
// warning: Quartz does not support xor drawing // warning: Quartz does not support xor drawing
// Use the Fl_Overlay_Window instead. // Use the Fl_Overlay_Window instead.
fl_color(FL_WHITE); fl_color(FL_WHITE);
@ -81,7 +81,7 @@ static void draw_current_rect() {
static void erase_current_rect() { static void erase_current_rect() {
#ifdef USE_XOR #ifdef USE_XOR
# ifdef __APPLE_QUARTZ__ # ifdef __APPLE_QUARTZ__ // PORTME: platform overlay
fl_rect(px, py, pw, ph); fl_rect(px, py, pw, ph);
# else # else
draw_current_rect(); draw_current_rect();

8
src/fl_read_image.cxx

@ -25,14 +25,14 @@
# include <stdio.h> # include <stdio.h>
#endif // DEBUG #endif // DEBUG
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform screenshots
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement code to read RGB data from screen" # pragma message "FL_PORTING: implement code to read RGB data from screen"
static uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha) { } static uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha) { }
#else #else
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__) // PORTME: platform screenshots
# include "fl_read_image_mac.cxx" # include "fl_read_image_mac.cxx"
#else #else
# include <FL/Fl_RGB_Image.H> # include <FL/Fl_RGB_Image.H>
@ -108,7 +108,7 @@ static Fl_RGB_Image *traverse_to_gl_subwindows(Fl_Group *g, uchar *p, int x, int
if (full_img) g->as_window()->make_current(); if (full_img) g->as_window()->make_current();
uchar *image_data; uchar *image_data;
int alloc_img = (full_img != NULL || p == NULL); // false means use p, don't alloc new memory for image int alloc_img = (full_img != NULL || p == NULL); // false means use p, don't alloc new memory for image
#ifdef __APPLE_CC__ #ifdef __APPLE_CC__ // PORTME: platform screenshots
// on Darwin + X11, read_win_rectangle() sometimes returns NULL when there are subwindows // on Darwin + X11, read_win_rectangle() sometimes returns NULL when there are subwindows
do image_data = read_win_rectangle( (alloc_img ? NULL : p), x, y, w, h, alpha); while (!image_data); do image_data = read_win_rectangle( (alloc_img ? NULL : p), x, y, w, h, alpha); while (!image_data);
#else #else
@ -638,7 +638,7 @@ static uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha
#endif // !WIN32 #endif // !WIN32
#endif // !__APPLE__ #endif // !__APPLE__ // PORTME: platform screenshots
// //
// End of "$Id$". // End of "$Id$".

2
src/fl_scroll_area.cxx

@ -141,7 +141,7 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
// Great, we can do an accelerated scroll instead of re-rendering // Great, we can do an accelerated scroll instead of re-rendering
BitBlt(fl_gc, dest_x, dest_y, src_w, src_h, fl_gc, src_x, src_y,SRCCOPY); BitBlt(fl_gc, dest_x, dest_y, src_w, src_h, fl_gc, src_x, src_y,SRCCOPY);
#elif defined(__APPLE_QUARTZ__) #elif defined(__APPLE_QUARTZ__) // PORTME: platform scrolling
CGImageRef img = Fl_X::CGImage_from_window_rect(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);
if (img) { if (img) {
CGRect rect = CGRectMake(dest_x, dest_y, src_w, src_h); CGRect rect = CGRectMake(dest_x, dest_y, src_w, src_h);

6
src/fl_set_font.cxx

@ -32,7 +32,7 @@ static int table_size;
the string is not copied, so the string must be in static memory. the string is not copied, so the string must be in static memory.
*/ */
void Fl::set_font(Fl_Font fnum, const char* name) { void Fl::set_font(Fl_Font fnum, const char* name) {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform fonts
if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts(); if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts();
#endif #endif
while (fnum >= table_size) { while (fnum >= table_size) {
@ -53,7 +53,7 @@ void Fl::set_font(Fl_Font fnum, const char* name) {
#if defined(USE_X11) #if defined(USE_X11)
fl_fonts[i].xlist = 0; fl_fonts[i].xlist = 0;
fl_fonts[i].n = 0; fl_fonts[i].n = 0;
#endif // !WIN32 && !__APPLE__ #endif // !WIN32 && !__APPLE__ // PORTME: platform fonts
} }
} }
Fl_Fontdesc* s = fl_fonts+fnum; Fl_Fontdesc* s = fl_fonts+fnum;
@ -85,7 +85,7 @@ void Fl::set_font(Fl_Font fnum, Fl_Font from) {
of this face. of this face.
*/ */
const char* Fl::get_font(Fl_Font fnum) { const char* Fl::get_font(Fl_Font fnum) {
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform fonts
if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts(); if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts();
#endif #endif
return fl_fonts[fnum].name; return fl_fonts[fnum].name;

16
src/fl_shortcut.cxx

@ -38,11 +38,11 @@
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <ctype.h> #include <ctype.h>
#include "flstring.h" #include "flstring.h"
#if !defined(WIN32) && !defined(__APPLE__) #if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform keyboard feel
#include <FL/x.H> #include <FL/x.H>
#endif #endif
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform keyboard feel
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement keyboard shortcut handling here" # pragma message "FL_PORTING: implement keyboard shortcut handling here"
#else #else
@ -123,7 +123,7 @@ static Keyname table[] = {
{FL_Alt_R, "Alt_R"}, {FL_Alt_R, "Alt_R"},
{FL_Delete, "Delete"} {FL_Delete, "Delete"}
}; };
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform keyboard feel
static Keyname table[] = { static Keyname table[] = {
// v - this column contains UTF-8 characters // v - this column contains UTF-8 characters
{' ', "Space"}, {' ', "Space"},
@ -194,7 +194,7 @@ const char* fl_shortcut_label(unsigned int shortcut, const char **eom) {
if (((unsigned)fl_tolower(v))!=v) { if (((unsigned)fl_tolower(v))!=v) {
shortcut |= FL_SHIFT; shortcut |= FL_SHIFT;
} }
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform keyboard feel
// this column contains utf8 characters - v // this column contains utf8 characters - v
if (shortcut & FL_SHIFT) {strcpy(p,"\xe2\x87\xa7"); p += 3;} // U+21E7 (upwards white arrow) if (shortcut & FL_SHIFT) {strcpy(p,"\xe2\x87\xa7"); p += 3;} // U+21E7 (upwards white arrow)
if (shortcut & FL_CTRL) {strcpy(p,"\xe2\x8c\x83"); p += 3;} // U+2303 (up arrowhead) if (shortcut & FL_CTRL) {strcpy(p,"\xe2\x8c\x83"); p += 3;} // U+2303 (up arrowhead)
@ -205,10 +205,10 @@ const char* fl_shortcut_label(unsigned int shortcut, const char **eom) {
if (shortcut & FL_ALT) {strcpy(p,"Alt+"); p += 4;} if (shortcut & FL_ALT) {strcpy(p,"Alt+"); p += 4;}
if (shortcut & FL_SHIFT) {strcpy(p,"Shift+"); p += 6;} if (shortcut & FL_SHIFT) {strcpy(p,"Shift+"); p += 6;}
if (shortcut & FL_CTRL) {strcpy(p,"Ctrl+"); p += 5;} if (shortcut & FL_CTRL) {strcpy(p,"Ctrl+"); p += 5;}
#endif // __APPLE__ #endif // __APPLE__ // PORTME: platform keyboard feel
if (eom) *eom = p; if (eom) *eom = p;
unsigned int key = shortcut & FL_KEY_MASK; unsigned int key = shortcut & FL_KEY_MASK;
#if defined(WIN32) || defined(__APPLE__) // if not X #if defined(WIN32) || defined(__APPLE__) // if not X // PORTME: platform keyboard feel
if (key >= FL_F && key <= FL_F_Last) { if (key >= FL_F && key <= FL_F_Last) {
*p++ = 'F'; *p++ = 'F';
if (key > FL_F+9) *p++ = (key-FL_F)/10+'0'; if (key > FL_F+9) *p++ = (key-FL_F)/10+'0';
@ -401,7 +401,7 @@ int Fl_Widget::test_shortcut(const char *t, const bool require_alt) {
// for menubars etc. shortcuts must work only if the Alt modifier is pressed // for menubars etc. shortcuts must work only if the Alt modifier is pressed
if (require_alt && Fl::event_state(FL_ALT)==0) return 0; if (require_alt && Fl::event_state(FL_ALT)==0) return 0;
unsigned int c = fl_utf8decode(Fl::event_text(), Fl::event_text()+Fl::event_length(), 0); unsigned int c = fl_utf8decode(Fl::event_text(), Fl::event_text()+Fl::event_length(), 0);
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform keyboard feel
// this line makes underline shortcuts work the same way they do on MSWindow // this line makes underline shortcuts work the same way they do on MSWindow
// and Linux. // and Linux.
if (c && Fl::event_state(FL_ALT)) if (c && Fl::event_state(FL_ALT))
@ -411,7 +411,7 @@ int Fl_Widget::test_shortcut(const char *t, const bool require_alt) {
unsigned int ls = label_shortcut(t); unsigned int ls = label_shortcut(t);
if (c == ls) if (c == ls)
return 1; return 1;
#ifdef __APPLE__ #ifdef __APPLE__ // PORTME: platform keyboard feel
// On OS X, we need to simulate the upper case keystroke as well // On OS X, we need to simulate the upper case keystroke as well
if (Fl::event_state(FL_ALT) && c<128 && isalpha(c) && (unsigned)toupper(c)==ls) if (Fl::event_state(FL_ALT) && c<128 && isalpha(c) && (unsigned)toupper(c)==ls)
return 1; return 1;

2
src/fl_utf.c

@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: look out for some unicode functions here. Default should be fine though." # pragma message "FL_PORTING: look out for some unicode functions here. Default should be fine though."
#else #else

2
src/fl_utf8.cxx

@ -21,7 +21,7 @@
#include <FL/filename.H> #include <FL/filename.H>
#include <stdarg.h> #include <stdarg.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: verify code for utf8 handling" # pragma message "FL_PORTING: verify code for utf8 handling"
#else #else

2
src/forms_timer.cxx

@ -52,7 +52,7 @@ void fl_gettime(long* sec, long* usec) {
*sec = (long) tp.time; *sec = (long) tp.time;
*usec = tp.millitm * 1000; *usec = tp.millitm * 1000;
# endif # endif
#elif defined(FL_PORTING) && !defined(__APPLE__) #elif defined(FL_PORTING) && !defined(__APPLE__) // PORTME: platform timer
# pragma message "FL_PORTING: implement time, rarely needed, if ever." # pragma message "FL_PORTING: implement time, rarely needed, if ever."
#else #else
struct timeval tp; struct timeval tp;

4
src/gl_draw.cxx

@ -19,7 +19,7 @@
// Functions from <FL/gl.h> // Functions from <FL/gl.h>
// See also Fl_Gl_Window and gl_start.cxx // See also Fl_Gl_Window and gl_start.cxx
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform opengl
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement OpenGL text rendering here" # pragma message "FL_PORTING: implement OpenGL text rendering here"
#else #else
@ -38,7 +38,7 @@
#include "Fl_Font.H" #include "Fl_Font.H"
#include <FL/fl_utf8.h> #include <FL/fl_utf8.h>
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform opengl
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h? It's written for X11." # pragma message "FL_PORTING: do you want to include Xutf8.h? It's written for X11."
#else #else

2
src/gl_start.cxx

@ -28,7 +28,7 @@
// be erased when the buffers are swapped (when double buffer hardware // be erased when the buffers are swapped (when double buffer hardware
// is being used) // is being used)
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform opengl
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: if possible, add OpenGL rendering in non-OpenGL contexts" # pragma message "FL_PORTING: if possible, add OpenGL rendering in non-OpenGL contexts"
#else #else

2
src/xutf8/is_right2left.c

@ -14,7 +14,7 @@
* http://www.fltk.org/str.php * http://www.fltk.org/str.php
*/ */
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: utf8 functionality" # pragma message "FL_PORTING: utf8 functionality"
#else #else

2
src/xutf8/keysym2Ucs.c

@ -17,7 +17,7 @@
#define KEYSYM2UCS_INCLUDED #define KEYSYM2UCS_INCLUDED
#if defined(WIN32) #if defined(WIN32)
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform unicode
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?" # pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else #else

4
src/xutf8/lcUniConv/cp936ext.h

@ -16,7 +16,7 @@
* http://www.fltk.org/str.php * http://www.fltk.org/str.php
*/ */
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: is this really needed? It's huge!
// not needed // not needed
@ -6251,7 +6251,7 @@ cp936ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
#endif /* CP936 */ #endif /* CP936 */
#endif /* __APPLE__ WIN32 */ #endif /* __APPLE__ WIN32 */ // PORTME: Unicode stuff
/* /*
* End of "$Id$". * End of "$Id$".

2
src/xutf8/utf8Input.c

@ -15,7 +15,7 @@
*/ */
#if defined(WIN32) #if defined(WIN32)
#elif defined(__APPLE__) #elif defined(__APPLE__) // PORTME: platform unicode
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?" # pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else #else

2
src/xutf8/utf8Utils.c

@ -14,7 +14,7 @@
* http://www.fltk.org/str.php * http://www.fltk.org/str.php
*/ */
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: utf8" # pragma message "FL_PORTING: utf8"
#else #else

2
src/xutf8/utf8Wrap.c

@ -14,7 +14,7 @@
* http://www.fltk.org/str.php * http://www.fltk.org/str.php
*/ */
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: utf8" # pragma message "FL_PORTING: utf8"
#else #else

Loading…
Cancel
Save