From 5d1df0e789c794b8040c5db0d84b03ae2b42fd8d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 13 Feb 2016 12:57:00 +0000 Subject: [PATCH] Details on PORTME items. Move fl_parse_color() to screen drivers. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11163 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl.H | 6 +-- FL/Fl_Copy_Surface.H | 4 +- FL/Fl_Gl_Window.H | 2 +- FL/Fl_Graphics_Driver.H | 2 +- FL/Fl_Image_Surface.H | 4 +- FL/Fl_Native_File_Chooser.H | 8 ++-- FL/Fl_PostScript.H | 6 +-- FL/Fl_Printer.H | 10 ++-- FL/Fl_Screen_Driver.H | 4 ++ FL/Fl_Sys_Menu_Bar.H | 4 +- FL/Fl_Tooltip.H | 19 +------- FL/Fl_Window.H | 9 ++-- FL/fl_utf8.h | 2 +- FL/x.H | 2 +- src/Fl.cxx | 42 +++++++---------- src/Fl_Copy_Surface.cxx | 14 +++--- src/Fl_Double_Window.cxx | 4 +- src/Fl_File_Browser.cxx | 10 ++-- src/Fl_File_Chooser2.cxx | 2 +- src/Fl_File_Icon.cxx | 2 +- src/Fl_Font.H | 14 +++--- src/Fl_Gl_Device_Plugin.cxx | 14 +++--- src/Fl_Image_Surface.cxx | 8 ++-- src/Fl_Input.cxx | 2 +- src/Fl_Input_.cxx | 8 ++-- src/Fl_Menu.cxx | 6 +-- src/Fl_Native_File_Chooser.cxx | 2 +- src/Fl_Paged_Device.cxx | 4 +- src/Fl_PostScript.cxx | 8 ++-- src/Fl_Preferences.cxx | 12 ++--- src/Fl_Printer.cxx | 10 ++-- src/Fl_Screen_Driver.cxx | 5 ++ src/Fl_Sys_Menu_Bar.mm | 4 +- src/Fl_Text_Display.cxx | 12 ++--- src/Fl_Text_Editor.cxx | 12 ++--- src/Fl_Tooltip.cxx | 7 +-- src/Fl_Tree_Item.cxx | 2 +- src/Fl_Tree_Prefs.cxx | 14 +++--- src/Fl_Window.cxx | 6 +-- src/Fl_Window_fullscreen.cxx | 2 +- src/Fl_Window_hotspot.cxx | 2 +- src/Fl_Window_iconize.cxx | 2 +- src/Fl_Window_shape.cxx | 16 +++---- src/Fl_abort.cxx | 2 +- src/Fl_arg.cxx | 22 ++++----- src/Fl_compose.cxx | 22 +++++---- src/Fl_display.cxx | 34 +++++--------- src/Fl_get_key.cxx | 2 +- src/Fl_get_system_colors.cxx | 46 ++----------------- src/Fl_grab.cxx | 6 +-- src/Fl_own_colormap.cxx | 2 +- src/Fl_visual.cxx | 2 +- src/Fl_x.cxx | 8 +++- src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 26 +++++++++++ src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h | 2 + .../WinAPI/Fl_WinAPI_Screen_Driver.cxx | 33 +++++++++++-- src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h | 3 ++ src/drivers/X11/Fl_X11_Screen_Driver.cxx | 36 +++++++++++++++ src/drivers/X11/Fl_X11_Screen_Driver.h | 5 ++ src/filename_absolute.cxx | 4 +- src/filename_ext.cxx | 2 +- src/filename_isdir.cxx | 2 +- src/filename_list.cxx | 16 +++---- src/fl_call_main.c | 2 +- src/fl_dnd.cxx | 2 +- src/fl_draw_pixmap.cxx | 8 ++-- src/fl_encoding_latin1.cxx | 2 +- src/fl_encoding_mac_roman.cxx | 2 +- src/fl_font.cxx | 4 +- src/fl_open_uri.cxx | 12 ++--- src/fl_overlay.cxx | 6 +-- src/fl_read_image.cxx | 8 ++-- src/fl_scroll_area.cxx | 2 +- src/fl_set_font.cxx | 6 +-- src/fl_shortcut.cxx | 16 +++---- src/fl_utf.c | 2 +- src/fl_utf8.cxx | 2 +- src/gl_draw.cxx | 4 +- src/xutf8/is_right2left.c | 2 +- src/xutf8/keysym2Ucs.c | 2 +- src/xutf8/utf8Input.c | 2 +- src/xutf8/utf8Utils.c | 2 +- src/xutf8/utf8Wrap.c | 2 +- 83 files changed, 361 insertions(+), 330 deletions(-) diff --git a/FL/Fl.H b/FL/Fl.H index 31f0a567b..3678b7c72 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -54,7 +54,7 @@ struct Fl_Label; # else # define FL_SOCKET int # endif -#elif defined(__APPLE__) // PORTME: socket types +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - socket types # define FL_SOCKET int #elif defined(FL_PORTING) # pragma message "FL_PORTING: define a type for FL_SOCKET" @@ -199,7 +199,7 @@ public: // should be private! static Fl_Window* grab_; static int compose_state; // used for dead keys (WIN32) or marked text (MacOS) static void call_screen_init(); // recompute screen number and dimensions -#ifdef __APPLE__ // PORTME: additional functions +#ifdef __APPLE__ // PORTME: add for all platforms - additional functions 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 #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 -#if defined(__APPLE__) // PORTME: additional functions +#if defined(__APPLE__) // PORTME: Fl_Screen_Driver ? - additional functions // not needed #elif defined(WIN32) // not needed diff --git a/FL/Fl_Copy_Surface.H b/FL/Fl_Copy_Surface.H index 9488175d3..d85c32ead 100644 --- a/FL/Fl_Copy_Surface.H +++ b/FL/Fl_Copy_Surface.H @@ -53,7 +53,7 @@ private: int width; int height; Fl_Paged_Device *helper; -#ifdef __APPLE__ // PORTME: platform surface driver +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform surface driver CFMutableDataRef pdfdata; CGContextRef oldgc; CGContextRef gc; @@ -86,7 +86,7 @@ public: int h() { return height; } }; -#if defined(__APPLE__) // PORTME: platform surface driver +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform surface driver /* Mac class to reimplement Fl_Paged_Device::printable_rect() */ class FL_EXPORT Fl_Quartz_Surface_ : public Fl_System_Printer { diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H index f18f8a526..8c5b9b723 100644 --- a/FL/Fl_Gl_Window.H +++ b/FL/Fl_Gl_Window.H @@ -239,7 +239,7 @@ public: Fl::event_y() to the pixel units used by the OpenGL source code. \version 1.3.4 */ -#ifdef __APPLE__ // PORTME: additional functionality +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - additional functionality int pixels_per_unit(); #elif defined(WIN32) int pixels_per_unit() { return 1; } diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 6a544d7be..cdf2f6611 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/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 typedef int COORD_T; # define XPOINT XPoint -#elif defined(__APPLE__) // PORTME: platform specific types +#elif defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform specific types typedef float COORD_T; typedef struct { float x; float y; } QPoint; # define XPOINT QPoint diff --git a/FL/Fl_Image_Surface.H b/FL/Fl_Image_Surface.H index a926a8d6e..bcd868d59 100644 --- a/FL/Fl_Image_Surface.H +++ b/FL/Fl_Image_Surface.H @@ -50,7 +50,7 @@ private: int width; int height; Fl_Paged_Device *helper; -#ifdef __APPLE__ // PORTME: platform image surface driver +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform image surface driver #elif defined(WIN32) HDC _sgc; Window _sw; @@ -75,7 +75,7 @@ public: Fl_Shared_Image *highres_image(); }; -#ifdef __APPLE__ // PORTME: platform surface driver +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform surface driver /* Mac class to implement translate()/untranslate() for a flipped bitmap graphics context */ class FL_EXPORT Fl_Quartz_Flipped_Surface_ : public Fl_Quartz_Surface_ { public: diff --git a/FL/Fl_Native_File_Chooser.H b/FL/Fl_Native_File_Chooser.H index 5e9d51bbe..cafdf9d95 100644 --- a/FL/Fl_Native_File_Chooser.H +++ b/FL/Fl_Native_File_Chooser.H @@ -40,7 +40,7 @@ typedef void fl_BROWSEINFOW; # include // FL_EXPORT // Use Apple's chooser -#elif defined(__APPLE__) // PORTME: native file chooser support +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - native file chooser support # define MAXFILTERS 80 # include // FL_EXPORT @@ -192,7 +192,7 @@ private: void clear_filters(); void add_filter(const char *, const char *); -#elif defined(__APPLE__) // PORTME: native file chooser support +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - native file chooser support private: int _btype; // kind-of browser to show() int _options; // general options @@ -244,7 +244,7 @@ private: }; -#if !defined(__APPLE__) && !defined(WIN32) && !defined(FL_PORTING) // PORTME: FLTK file chooser option +#if !defined(__APPLE__) && !defined(WIN32) && !defined(FL_PORTING) // PORTME: Fl_Screen_Driver - FLTK file chooser option class FL_EXPORT Fl_FLTK_File_Chooser { friend class Fl_Native_File_Chooser; protected: @@ -328,7 +328,7 @@ private: static int custom_gtk_filter_function(const GtkFileFilterInfo*, Fl_GTK_File_Chooser::pair*); static void free_pair(pair *p); }; -#endif // !defined(__APPLE__) && !defined(WIN32) // PORTME: native file chooser option +#endif // !defined(__APPLE__) && !defined(WIN32) // PORTME: Fl_Screen_Driver - native file chooser option #endif /*FL_NATIVE_FILE_CHOOSER_H*/ diff --git a/FL/Fl_PostScript.H b/FL/Fl_PostScript.H index 861fe590c..64e49f45d 100644 --- a/FL/Fl_PostScript.H +++ b/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(const char* s, int nBytes, int x, int y) {transformed_draw(s,nBytes,x,y); }; -#ifdef __APPLE__ // PORTME: additional functionality +#ifdef __APPLE__ // PORTME: merge into code - additional functionality void draw(const char* s, int nBytes, float x, float y) {transformed_draw(s,nBytes,x,y); }; #elif defined(WIN32) // 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. */ class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device { -#ifdef __APPLE__ // PORTME: platform specifics for PostScript +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver ? - platform specifics for PostScript CGContextRef gc; #elif defined(WIN32) // not needed @@ -265,7 +265,7 @@ public: void untranslate(void); int end_page (void); void end_job(void); -#ifdef __APPLE__ // PORTME: platform specifics for PostScript +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver ? - platform specifics for PostScript void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); } #elif defined(WIN32) // not needed diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H index b975d0701..c65dba83a 100644 --- a/FL/Fl_Printer.H +++ b/FL/Fl_Printer.H @@ -32,7 +32,7 @@ #include #ifdef WIN32 #include -#elif defined(__APPLE__) // PORTME: platform printer driver +#elif defined(__APPLE__) // PORTME: Fl_Surface_Driver ? - platform printer driver // not needed #elif defined(FL_PORTING) # pragma message "FL_PORTING: include files needed for printing support" @@ -40,7 +40,7 @@ #include #endif -#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: platform printer driver +#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: Fl_Surface_Driver ? - platform printer driver /** Print support under MSWindows and Mac OS. @@ -54,7 +54,7 @@ private: /** \brief the printer's graphics context, if there's one, NULL otherwise */ void *gc; void set_current(void); -#ifdef __APPLE__ // PORTME: platform printer driver +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver ? - platform printer driver float scale_x; float scale_y; float angle; // rotation angle in radians @@ -88,7 +88,7 @@ public: void untranslate(void); int end_page (void); void end_job (void); -#ifdef __APPLE__ // PORTME: platform printer driver +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver ? - platform printer driver void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y); #endif /** \brief The destructor */ @@ -235,7 +235,7 @@ public: ~Fl_Printer(void); private: -#if defined(WIN32) || defined(__APPLE__) // PORTME: system printer driver +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Surface_Driver ? - system printer driver Fl_System_Printer *printer; #elif defined(FL_PORTING) # pragma message "FL_PORTING: instantiate your own Fl_xxx_Printer here" diff --git a/FL/Fl_Screen_Driver.H b/FL/Fl_Screen_Driver.H index 3fe3837b6..d00cbb46a 100644 --- a/FL/Fl_Screen_Driver.H +++ b/FL/Fl_Screen_Driver.H @@ -44,6 +44,8 @@ protected: public: static Fl_Screen_Driver *newScreenDriver(); + // --- display management + virtual void display(const char *disp); // --- screen configuration virtual void init() = 0; virtual int x() = 0; @@ -65,6 +67,8 @@ public: virtual void beep(int type) = 0; // --- global events virtual void flush() = 0; + // --- global colors + virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b) = 0; }; diff --git a/FL/Fl_Sys_Menu_Bar.H b/FL/Fl_Sys_Menu_Bar.H index 1103f599a..b635fedc6 100644 --- a/FL/Fl_Sys_Menu_Bar.H +++ b/FL/Fl_Sys_Menu_Bar.H @@ -22,7 +22,7 @@ #include "Fl_Menu_Bar.H" #include "x.H" -#if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: system menu bar +#if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: Fl_Screen_Driver - 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. @@ -105,7 +105,7 @@ typedef Fl_Menu_Bar Fl_Sys_Menu_Bar; typedef Fl_Menu_Bar Fl_Sys_Menu_Bar; -#endif // defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: system menu bar +#endif // defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: Fl_Screen_Driver - system menu bar #endif // Fl_Sys_Menu_Bar_H diff --git a/FL/Fl_Tooltip.H b/FL/Fl_Tooltip.H index 84b2aba73..a7ddaa744 100644 --- a/FL/Fl_Tooltip.H +++ b/FL/Fl_Tooltip.H @@ -78,7 +78,6 @@ public: static Fl_Color textcolor() { return textcolor_; } /** Sets the color of the text in the tooltip. The default is black. */ static void textcolor(Fl_Color c) { textcolor_ = c; } -#if FLTK_ABI_VERSION >= 10301 /** Gets the amount of extra space left/right of the tooltip's text. Default is 3. */ static int margin_width() { return margin_width_; } /** Sets the amount of extra space left/right of the tooltip's text. Default is 3. */ @@ -91,22 +90,8 @@ public: static int wrap_width() { return wrap_width_; } /** Sets the maximum width for tooltip's text before it word wraps. Default is 400. */ static void wrap_width(int v) { wrap_width_ = v; } -#else - static int margin_width() { return 3; } - static int margin_height() { return 3; } - static int wrap_width() { return 400; } -#endif - -#ifdef __APPLE__ // PORTME: additional functionality? - // the unique tooltip window + /** Returns the window that is used for tooltips */ static Fl_Window* current_window(void); -#elif defined(WIN32) - // not needed -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: do you need to remember the tooltip parent window?" -#else // X11 - // not needed -#endif // These should not be public, but Fl_Widget::tooltip() needs them... // fabien: made it private with only a friend function access @@ -125,11 +110,9 @@ private: static Fl_Font font_; static Fl_Fontsize size_; static Fl_Widget* widget_; //!< Keeps track of the current target widget -#if FLTK_ABI_VERSION >= 10301 static int margin_width_; //!< distance around tooltip text left+right static int margin_height_; //!< distance around tooltip text top+bottom static int wrap_width_; //!< maximum width of tooltip text before it word wraps -#endif }; #endif diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index dc8a1579a..b4ba45034 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -79,7 +79,7 @@ class FL_EXPORT Fl_Window : public Fl_Group { #ifdef WIN32 HICON big_icon; HICON small_icon; -#elif defined(__APPLE__) // PORTME: per-window icons +#elif defined(__APPLE__) // PORTME: Fl_Window_Driver - per-window icons, move to FL_X/Fl_Window_Driver // not needed #elif defined(FL_PORTING) # pragma message "FL_PORTING: define storage for per-window icons here if needed" @@ -106,7 +106,7 @@ protected: int lw_; ///< width of shape image int lh_; ///< height of shape image Fl_Image* shape_; ///< shape image -#if defined(__APPLE__) // PORTME: per-window shape information +#if defined(__APPLE__) // PORTME: Fl_Window_Driver - per-window shape information, move to Fl_X/Fl_Window_Driver typedef struct CGImage* CGImageRef; CGImageRef mask; #elif defined(WIN32) @@ -130,7 +130,7 @@ public: \see void shape(const Fl_Image* img) */ inline void shape(const Fl_Image& b) { shape(&b); } -#if defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: per-window shape +#if defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: Fl_Window_Driver - per-window shape #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you need a combine_mask() function in Fl_Window?" #else // X11 @@ -138,7 +138,6 @@ public: #endif private: - void size_range_(); void _Fl_Window(); // constructor innards void fullscreen_x(); // platform-specific part of sending a window to full screen @@ -457,7 +456,7 @@ public: #ifdef WIN32 static void default_icons(HICON big_icon, HICON small_icon); void icons(HICON big_icon, HICON small_icon); -#elif defined(__APPLE__) // PORTME: per-window icon +#elif defined(__APPLE__) // PORTME: Fl_Window_Driver - per-window icon // not needed #elif defined(FL_PORTING) # pragma message "FL_PORTING: define functions to handle window icons here if needed" diff --git a/FL/fl_utf8.h b/FL/fl_utf8.h index 5e2ab947e..e1dc45bdc 100644 --- a/FL/fl_utf8.h +++ b/FL/fl_utf8.h @@ -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 */ FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage); -#elif defined(__APPLE__) // PORTME: platform text encoding and conversion +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver ? - platform text encoding and conversion // not needed #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you want to be able to convert from a local charset to utf8?" diff --git a/FL/x.H b/FL/x.H index 9adcf48c6..4e53adaa3 100644 --- a/FL/x.H +++ b/FL/x.H @@ -28,7 +28,7 @@ # ifdef WIN32 # include "win32.H" -# elif defined(__APPLE__) // PORTME: Fl_X Window Driver interface +# elif defined(__APPLE__) // PORTME: Fl_Window_Driver - Fl_X Window Driver interface # include "mac.H" # elif defined(ANDROID) # pragma message "A clean port requires a driver-style system for Fl_X" diff --git a/src/Fl.cxx b/src/Fl.cxx index f97d3a2d8..b3211f83b 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -60,7 +60,7 @@ #endif // DEBUG || DEBUG_WATCH #ifdef WIN32 -#elif defined(__APPLE__) // PORTME: window driver and main loop +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - window driver and main loop #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement global variables for your platform here" #else // X11 @@ -73,7 +73,7 @@ HBRUSH fl_brush_action(int action); void fl_cleanup_pens(void); void fl_release_dc(HWND,HDC); void fl_cleanup_dc_list(void); -#elif defined(__APPLE__) // PORTME: platform functions +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform functions extern double fl_mac_flush_and_wait(double time_to_wait); #endif // WIN32 @@ -159,7 +159,7 @@ bool Fl::cfg_sys_win32 = 0; // // Globals... // -#if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: platform text +#if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: Fl_Screen_Driver - platform text const char *Fl_Mac_App_Menu::about = "About %@"; const char *Fl_Mac_App_Menu::print = "Print Front Window"; 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::show = "Show All"; const char *Fl_Mac_App_Menu::quit = "Quit %@"; -#endif // __APPLE__ // PORTME: platform text, system menu +#endif // __APPLE__ // PORTME: Fl_Screen_Driver - platform text, system menu #ifndef FL_DOXYGEN Fl_Widget *Fl::belowmouse_, *Fl::pushed_, @@ -341,7 +341,7 @@ int Fl::event_inside(const Fl_Widget *o) /*const*/ { // implementation in Fl_win32.cxx -#elif defined(__APPLE__) // PORTME: core stuff from screen, platform, and window driver +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - core stuff from screen, platform, and window driver // implementation in Fl_cocoa.mm (was Fl_mac.cxx) @@ -644,7 +644,7 @@ double Fl::wait(double time_to_wait) { return fl_wait(time_to_wait); -#elif defined(__APPLE__) // PORTME: platform fl_wait +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform fl_wait run_checks(); return fl_mac_flush_and_wait(time_to_wait); @@ -787,7 +787,7 @@ int Fl::check() { \endcode */ int Fl::ready() { -#if defined( WIN32 ) || defined(__APPLE__) // PORTME: platform timeouts +#if defined( WIN32 ) || defined(__APPLE__) // PORTME: Fl_System_Driver - platform timeouts // not used #elif defined(FL_PORTING) # 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(); while (w1) { win=w1; w1=win->window(); } if (win) { -#ifdef __APPLE__ // PORTME: platform window focus +#ifdef __APPLE__ // PORTME: Fl_Window_Driver - platform window focus if (fl_xfocus != win) { Fl_X *x = Fl_X::i(win); if (x) x->set_key_window(); @@ -1210,9 +1210,7 @@ void fl_fix_focus() { } } -#if !(defined(WIN32) || defined(__APPLE__)) // PORTME: platform selection extern Fl_Widget *fl_selection_requestor; // from Fl_x.cxx -#endif // This function is called by ~Fl_Widget() and by Fl_Widget::deactivate() // and by Fl_Widget::hide(). It indicates that the widget does not want @@ -1228,15 +1226,7 @@ void fl_throw_focus(Fl_Widget *o) { #endif // DEBUG if (o->contains(Fl::pushed())) Fl::pushed_ = 0; -#ifdef WIN32 - // not used -#elif defined(__APPLE__) // PORTME: platform selection - // not used -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: platform specific code when deleting a window" -#else if (o->contains(fl_selection_requestor)) fl_selection_requestor = 0; -#endif if (o->contains(Fl::belowmouse())) Fl::belowmouse_ = 0; if (o->contains(Fl::focus())) Fl::focus_ = 0; if (o == fl_xfocus) fl_xfocus = 0; @@ -1626,7 +1616,7 @@ extern void fl_destroy_xft_draw(Window); #endif void Fl_Window::hide() { -#ifdef WIN32 +#ifdef WIN32 // platform fix // STR#3079: if there remains a window and a non-modal window, and the window is deleted, // the app remains running without any apparent window. // Bug mechanism: hiding an owner window unmaps the owned (non-modal) window(s) @@ -1659,7 +1649,7 @@ void Fl_Window::hide() { Fl_X** pp = &Fl_X::first; for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return; *pp = ip->next; -#ifdef __APPLE__ // PORTME: platform pointer handling +#ifdef __APPLE__ // platform fix // 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 // worst case, an invisible pointer @@ -1708,7 +1698,7 @@ void Fl_Window::hide() { if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0); # endif } -#elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping +#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window unmapping Fl_X::q_release_context(ip); if ( ip->xid == fl_window ) fl_window = 0; @@ -1740,7 +1730,7 @@ void Fl_Window::hide() { } delete[] doit; } -#elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping +#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window unmapping ip->destroy(); #elif defined(FL_PORTING) # pragma message "FL_PORTING: code to destroy a window on screen" @@ -1774,13 +1764,13 @@ int Fl_Window::handle(int ev) else { #if defined(USE_X11) || defined(WIN32) XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless -#elif defined(__APPLE_QUARTZ__) // PORTME: platform window mapping +#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window mapping i->map(); #elif defined(FL_PORTING) # pragma message "FL_PORTING: code to show a window on screen" #else # error unsupported platform -#endif // __APPLE__ // PORTME: platform window mapping +#endif // __APPLE__ // PORTME: Fl_Window_Driver - platform window mapping } break; case FL_HIDE: @@ -1798,7 +1788,7 @@ int Fl_Window::handle(int ev) } #if defined(USE_X11) || defined(WIN32) XUnmapWindow(fl_display, fl_xid(this)); -#elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping, again +#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window unmapping, again i->unmap(); #elif defined(FL_PORTING) # pragma message "FL_PORTING: code to hide a window from screen" @@ -1966,7 +1956,7 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) { Fl_Region R = XRectangleRegion(X, Y, W, H); CombineRgn(i->region, i->region, R, RGN_OR); XDestroyRegion(R); -#elif defined(__APPLE_QUARTZ__) // PORTME: platform damage region +#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform damage region CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H); int j; // don't add a rectangle totally inside the Fl_Region for(j = 0; j < i->region->count; j++) { diff --git a/src/Fl_Copy_Surface.cxx b/src/Fl_Copy_Surface.cxx index 56cf4d14f..b1cc00b8b 100644 --- a/src/Fl_Copy_Surface.cxx +++ b/src/Fl_Copy_Surface.cxx @@ -21,7 +21,7 @@ #include -#if defined(__APPLE__) // PORTME: platform copy surface +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform copy surface #include 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; height = h; -#ifdef __APPLE__ // PORTME: platform copy surface +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform copy surface helper = new Fl_Quartz_Surface_(width, height); driver(helper->driver()); 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() { -#ifdef __APPLE__ // PORTME: platform copy surface +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform copy surface complete_copy_pdf_and_tiff(); fl_gc = oldgc; 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() { -#if defined(__APPLE__) || defined(WIN32) // PORTME: platform copy surface +#if defined(__APPLE__) || defined(WIN32) // PORTME: Fl_Surface_Driver - platform copy surface fl_gc = gc; fl_window = (Window)1; Fl_Surface_Device::set_current(); @@ -180,7 +180,7 @@ void Fl_Copy_Surface::set_current() } -#if defined(__APPLE__) // PORTME: platform copy surface +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform copy surface 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); } -#endif // __APPLE__ // PORTME: platform copy surface +#endif // __APPLE__ // PORTME: Fl_Surface_Driver - platform copy surface /** 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) -#elif defined(__APPLE__) // PORTME: platform copy surface +#elif defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform copy surface #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you need a helper class for your graphics driver" #elif !defined(FL_DOXYGEN) diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 7add48df0..6403fc6fa 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -143,7 +143,7 @@ void Fl_Double_Window::flush(int eraseoverlay) { clear_damage(FL_DAMAGE_ALL); } #elif defined(FL_PORTING) -# pragma message "FL_PORTING: call a function to clear any graphics port damage flags" +# pragma message "FL_PORTING: Fl_Window_Driver - call a function to clear any graphics port damage flags" #else # error unsupported platform #endif @@ -187,7 +187,7 @@ void Fl_Double_Window::flush(int eraseoverlay) { //# 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 //# endif -#elif defined(__APPLE__) // PORTME: platform double buffering +#elif defined(__APPLE__) // PORTME: Fl_Window_Driver - platform double buffering if ( myi->other_xid ) { fl_begin_offscreen( myi->other_xid ); fl_clip_region( 0 ); diff --git a/src/Fl_File_Browser.cxx b/src/Fl_File_Browser.cxx index 2d60d1599..dbbf26c5c 100644 --- a/src/Fl_File_Browser.cxx +++ b/src/Fl_File_Browser.cxx @@ -26,7 +26,7 @@ // Fl_File_Browser::filter() - Set the filename filter. // -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform file browser +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform file browser #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement the internals of your file browser here" #else @@ -62,11 +62,11 @@ # include #endif // __EMX__ -#if defined(__APPLE__) // PORTME: platform file browser +#if defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform file browser # include # include # include -#endif // __APPLE__ // PORTME: platform file browser +#endif // __APPLE__ // PORTME: Fl_Screen_Driver - platform file browser #if defined(_AIX) extern "C" { @@ -518,7 +518,7 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load num_files ++; } -#elif defined(__APPLE__) // PORTME: platform file browser +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform file browser // MacOS X and Darwin use getfsstat() system call... int numfs; // Number of file systems 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. add("/", icon); } -#endif // WIN32 || __EMX__ || __APPLE__ || _AIX || ... // PORTME: platform file browser +#endif // WIN32 || __EMX__ || __APPLE__ || _AIX || ... // PORTME: Fl_Screen_Driver - platform file browser } else { diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 7e8834bc7..72ecac18e 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -357,7 +357,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform file browser +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform file browser #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement the internals of your filechooser here" #else diff --git a/src/Fl_File_Icon.cxx b/src/Fl_File_Icon.cxx index 8503c4873..e6cfe76ea 100644 --- a/src/Fl_File_Icon.cxx +++ b/src/Fl_File_Icon.cxx @@ -51,7 +51,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform file browser +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform file browser #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement file type interpretation here" #else diff --git a/src/Fl_Font.H b/src/Fl_Font.H index a66d7fee9..f5a576397 100644 --- a/src/Fl_Font.H +++ b/src/Fl_Font.H @@ -26,7 +26,7 @@ #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform font stuff +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform font stuff #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement font descriptor details here" #else @@ -36,7 +36,7 @@ #if USE_XFT typedef struct _XftFont XftFont; #elif defined(WIN32) -#elif defined(__APPLE__) // PORTME: platform font stuff +#elif defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform font stuff #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you want to include Xutf8.h?" #else @@ -61,7 +61,7 @@ public: TEXTMETRIC metr; int angle; FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size); -# elif defined(__APPLE_QUARTZ__) // PORTME: platform font stuff +# elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Graphics_Driver - platform font stuff FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size); ATSUTextLayout layout; # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 @@ -84,9 +84,9 @@ public: # endif # if HAVE_GL unsigned int listbase;// base of display list, 0 = none -#ifndef __APPLE_QUARTZ__ // PORTME: platform font stuff +#ifndef __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform font stuff char glok[64]; -#endif // __APPLE_QUARTZ__ // PORTME: platform font stuff +#endif // __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform font stuff # endif // HAVE_GL FL_EXPORT ~Fl_Font_Descriptor(); @@ -101,7 +101,7 @@ struct Fl_Fontdesc { char fontname[128]; // "Pretty" font name Fl_Font_Descriptor *first; // linked list of sizes of this style #ifdef WIN32 -#elif defined(__APPLE__) // PORTME: platform font stuff +#elif defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform font stuff char **xlist; // matched X font names int n; // size of xlist, negative = don't free xlist! #elif defined(FL_PORTING) @@ -115,7 +115,7 @@ struct Fl_Fontdesc { extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table #ifdef WIN32 -#elif defined(__APPLE__) // PORTME: platform font stuff +#elif defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform font stuff // functions for parsing X font names: FL_EXPORT const char* fl_font_word(const char *p, int n); FL_EXPORT char *fl_find_fontsize(char *name); diff --git a/src/Fl_Gl_Device_Plugin.cxx b/src/Fl_Gl_Device_Plugin.cxx index 661b1a2d1..df68a6000 100644 --- a/src/Fl_Gl_Device_Plugin.cxx +++ b/src/Fl_Gl_Device_Plugin.cxx @@ -24,14 +24,14 @@ #include #include "FL/Fl.H" -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform OpenGL management +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform OpenGL management #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement code to read OpenGL renderings into RGB maps" #else #endif -#if defined(__APPLE__) // PORTME: platform OpenGL management +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform OpenGL management uchar *convert_BGRA_to_RGB(uchar *baseAddress, int w, int h, int mByteWidth) { 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. */ { -#if defined(__APPLE__) // PORTME: platform OpenGL management +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform OpenGL management const int bytesperpixel = 4; int factor = glw->pixels_per_unit(); 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 uchar *baseAddress = new uchar[mByteWidth * h]; glReadPixels(x, glw->pixel_h() - (y+h), w, h, -#if defined(__APPLE__) // PORTME: platform OpenGL management +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform OpenGL management GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, #else GL_RGB, GL_UNSIGNED_BYTE, #endif baseAddress); glPopClientAttrib(); -#if defined(__APPLE__) // PORTME: platform OpenGL management +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform OpenGL management baseAddress = convert_BGRA_to_RGB(baseAddress, w, h, mByteWidth); mByteWidth = 3 * w; #endif @@ -97,7 +97,7 @@ static Fl_RGB_Image* capture_gl_rectangle(Fl_Gl_Window *glw, int x, int y, int w return img; } -#ifdef __APPLE__ // PORTME: platform OpenGL management +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform OpenGL management static void imgProviderReleaseData (void *info, const void *data, size_t size) { delete (Fl_RGB_Image *)info; @@ -116,7 +116,7 @@ public: Fl_Gl_Window *glw = w->as_gl_window(); if (!glw) return 0; Fl_RGB_Image *img = capture_gl_rectangle(glw, 0, 0, glw->w(), glw->h()); -#ifdef __APPLE__ // PORTME: platform OpenGL management +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform OpenGL management 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) CGColorSpaceRef cSpace = CGColorSpaceCreateDeviceRGB(); diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index 3385d2e25..f69d129fb 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -26,7 +26,7 @@ #endif #if defined(WIN32) -#elif defined(__APPLE__) // PORTME: platform image surface +#elif defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform image surface #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement image surface handling here" #else @@ -80,7 +80,7 @@ Fl_Image_Surface::Fl_Image_Surface(int w, int h, int highres) : Fl_Surface_Devic /** The destructor. */ Fl_Image_Surface::~Fl_Image_Surface() { -#ifdef __APPLE__ // PORTME: platform image surface +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform image surface void *data = CGBitmapContextGetData((CGContextRef)offscreen); free(data); CGContextRelease((CGContextRef)offscreen); @@ -162,7 +162,7 @@ void Fl_Image_Surface::draw(Fl_Widget *widget, int delta_x, int delta_y) void Fl_Image_Surface::set_current() { -#if defined(__APPLE__) // PORTME: platform image surface +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform image surface fl_gc = offscreen; fl_window = 0; Fl_Surface_Device::set_current(); Fl_X::set_high_resolution( CGBitmapContextGetWidth(offscreen) > width ); @@ -186,7 +186,7 @@ void Fl_Image_Surface::set_current() #endif } -#if defined(__APPLE__) // PORTME: platform image surface +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver - platform image surface Fl_Quartz_Flipped_Surface_::Fl_Quartz_Flipped_Surface_(int w, int h) : Fl_Quartz_Surface_(w, h) { } diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 14e8b444a..e26c30dd2 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -368,7 +368,7 @@ int Fl_Input::handle_key() { #ifdef __APPLE__ // PORTME: platform compose if (Fl::compose_state) { this->mark( this->position() - Fl::compose_state ); - } + } #endif return 1; } diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index afe3e5cfd..085ca80a6 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -346,7 +346,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { int offset2; if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2); else offset2 = (int) strlen(buf); -#ifdef __APPLE__ // PORTME: Mac OS: underline marked ( = selected + Fl::compose_state != 0) text +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - Mac OS: underline marked ( = selected + Fl::compose_state != 0) text if (Fl::compose_state) { 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_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc)); -#ifdef __APPLE__ // PORTME: Mac OS: underline marked ( = selected + Fl::compose_state != 0) text +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - Mac OS: underline marked ( = selected + Fl::compose_state != 0) text if (Fl::compose_state) { fl_color( fl_color_average(textcolor(), color(), 0.6) ); 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: // draw the cursor: if (Fl::focus() == this && ( -#ifdef __APPLE__ // PORTME: compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - compose Fl::compose_state || #endif selstart == selend) && @@ -395,7 +395,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { } else { fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height); } -#ifdef __APPLE__ // PORTME: compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - compose Fl::insertion_point_location(xpos+curx, Y+ypos+height, height); #endif } diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index 08991037d..1e3fa5f84 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -122,7 +122,7 @@ class menuwindow : public Fl_Menu_Window { public: menutitle* title; int handle(int); -#if defined (__APPLE__) || defined (USE_X11) // PORTME: menubar +#if defined (__APPLE__) || defined (USE_X11) // PORTME: Fl_Screen_Driver - menubar int early_hide_handle(int); #endif 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) { -#if defined (__APPLE__) || defined (USE_X11) // PORTME: menubar +#if defined (__APPLE__) || defined (USE_X11) // PORTME: Fl_Screen_Driver - menubar // This off-route takes care of the "detached menu" bug on OS X. // Apple event handler requires that we hide all menu windows right // now, so that Carbon can continue undisturbed with handling window @@ -746,7 +746,7 @@ int menuwindow::early_hide_handle(int e) { } break; case FL_MOVE: -#if ! (defined(WIN32) || defined(__APPLE__)) // PORTME: menubar +#if ! (defined(WIN32) || defined(__APPLE__)) // PORTME: Fl_Screen_Driver - menubar if (pp.state == DONE_STATE) { return 1; // Fix for STR #2619 } diff --git a/src/Fl_Native_File_Chooser.cxx b/src/Fl_Native_File_Chooser.cxx index 38ea96448..8b7c46673 100644 --- a/src/Fl_Native_File_Chooser.cxx +++ b/src/Fl_Native_File_Chooser.cxx @@ -21,7 +21,7 @@ #include "Fl_Native_File_Chooser_WIN32.cxx" // Use Apple's chooser -#elif defined(__APPLE__) // PORTME: native file chooser +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - native file chooser #include #elif defined(FL_PORTING) diff --git a/src/Fl_Paged_Device.cxx b/src/Fl_Paged_Device.cxx index e0a0f1a1b..becd43a85 100644 --- a/src/Fl_Paged_Device.cxx +++ b/src/Fl_Paged_Device.cxx @@ -142,7 +142,7 @@ void Fl_Paged_Device::print_window_part(Fl_Window *win, int x, int y, int w, int win->make_current(); uchar *image_data; image_data = fl_read_image(NULL, x, y, w, h); -#ifdef __APPLE__ // PORTME: platform paged device +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform paged device Fl_X::q_release_context(); // matches make_current() call above #endif if (save_front != win) save_front->show(); @@ -324,7 +324,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); } -#if !defined(__APPLE__) // PORTME: platform paged device // Mac OS version in Fl_Cocoa.mm +#if !defined(__APPLE__) // PORTME: Fl_Surface_Driver - 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) { draw_decorated_window(win, x_offset, y_offset); diff --git a/src/Fl_PostScript.cxx b/src/Fl_PostScript.cxx index 20ea5f5f0..df5a52fdf 100644 --- a/src/Fl_PostScript.cxx +++ b/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) { -#ifdef __APPLE__ // PORTME: platform PostScript +#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform PostScript gc = fl_gc; // the display context is used by fl_text_extents() #endif 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 -#if ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: platform PostScript +#if ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: Fl_Surface_Driver - platform PostScript # include "print_panel.cxx" #endif @@ -1562,7 +1562,7 @@ void Fl_PostScript_File_Device::end_job (void) #endif // FL_DOXYGEN -#if defined(__APPLE__) // PORTME: platform PostScript +#if defined(__APPLE__) // PORTME: Fl_Surface_Driver ? - platform PostScript #elif defined(WIN32) #elif defined(FL_PORTING) # 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 } -#endif // ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: platform PostScript +#endif // ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: Fl_Surface_Driver - platform PostScript // diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index 616c3c891..382186949 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -29,7 +29,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform Preferences +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_System_Driver - platform Preferences #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement some file storage in a designated place" #else @@ -43,7 +43,7 @@ // on Windows, which is supposed to be POSIX compliant... # define access _access # define mkdir _mkdir -#elif defined (__APPLE__) // PORTME: platform Preferences +#elif defined (__APPLE__) // PORTME: Fl_System_Driver - platform Preferences # include # include # include @@ -86,7 +86,7 @@ Fl_Preferences *Fl_Preferences::runtimePrefs = 0; * The buffer is overwritten during every call to this function! */ const char *Fl_Preferences::newUUID() { -#ifdef __APPLE__ // PORTME: platform Preferences +#ifdef __APPLE__ // PORTME: Fl_System_Driver - platform Preferences CFUUIDRef theUUID = CFUUIDCreate(NULL); CFUUIDBytes b = CFUUIDGetUUIDBytes(theUUID); 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), "/%s/%s.prefs", vendor, application); for (char *s = filename; *s; s++) if (*s == '\\') *s = '/'; -#elif defined ( __APPLE__ ) // PORTME: platform Preferences +#elif defined ( __APPLE__ ) // PORTME: Fl_System_Driver - platform Preferences // TODO: verify that this is the Apple sanctioned way of finding these folders // (On MSWindows, this frequently leads to issues with internationalized systems) // 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_ ); prefs_->node->write( f ); fclose( f ); -#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: platform Preferences +#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: Fl_System_Driver - platform Preferences // unix: make sure that system prefs are user-readable if (strncmp(filename_, "/etc/fltk/", 10) == 0) { char *p; @@ -1197,7 +1197,7 @@ char Fl_Preferences::RootNode::getPath( char *path, int pathlen ) { if ( !s ) return 0; *s = 0; char ret = fl_make_path( path ); -#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: platform Preferences +#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: Fl_System_Driver - platform Preferences // unix: make sure that system prefs dir. is user-readable if (strncmp(path, "/etc/fltk/", 10) == 0) { fl_chmod(path, 0755); // rwxr-xr-x diff --git a/src/Fl_Printer.cxx b/src/Fl_Printer.cxx index a08bd109c..55f95cd6d 100644 --- a/src/Fl_Printer.cxx +++ b/src/Fl_Printer.cxx @@ -66,7 +66,7 @@ const char *Fl_Printer::property_cancel = NULL; #else -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform printing +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform printing #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement the printer device specifics" #else @@ -116,7 +116,7 @@ const char *Fl_Printer::property_save = "Save"; /** [this text may be customized at run-time] */ const char *Fl_Printer::property_cancel = "Cancel"; -#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: platform printing +#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: Fl_Screen_Driver - platform printing const char *Fl_System_Printer::class_id = Fl_Printer::class_id; #endif #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; #endif -#if defined(__APPLE__) || defined(WIN32) // PORTME: platform printing +#if defined(__APPLE__) || defined(WIN32) // PORTME: Fl_Screen_Driver - platform printing void Fl_System_Printer::set_current(void) { -#ifdef __APPLE__ // PORTME: platform printing +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform printing fl_gc = (CGContextRef)gc; #elif defined(WIN32) fl_gc = (HDC)gc; @@ -145,7 +145,7 @@ void Fl_System_Printer::origin(int *x, int *y) #endif Fl_Printer::Fl_Printer(void) { -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform printing +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform printing printer = new Fl_System_Printer(); #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement the printer device specifics" diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index 46e9e5d2c..85996ba59 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -28,6 +28,11 @@ num_screens(-1) } +void Fl_Screen_Driver::display(const char *) { + // blank +} + + void Fl_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H) { int x, y; diff --git a/src/Fl_Sys_Menu_Bar.mm b/src/Fl_Sys_Menu_Bar.mm index e6415e03e..9a429963a 100644 --- a/src/Fl_Sys_Menu_Bar.mm +++ b/src/Fl_Sys_Menu_Bar.mm @@ -32,7 +32,7 @@ * Many other calls of the parent class don't work. */ -#if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: platform system menu bar +#if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: Fl_Screen_Driver - platform system menu bar #include #include #include @@ -524,7 +524,7 @@ void Fl_Mac_App_Menu::custom_application_menu_items(const Fl_Menu_Item *m) [item release]; } } -#endif /* __APPLE__ */ // PORTME: platform system menu bar +#endif /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform system menu bar // // End of "$Id$". diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 208b41bab..5298e796e 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -31,7 +31,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform editor feel +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform editor feel #elif defined(FL_PORTING) # pragma message "FL_PORTING: look out for some code that visualizes character composing" #else @@ -2144,7 +2144,7 @@ void Fl_Text_Display::draw_string(int style, if (style & PRIMARY_MASK) { if (Fl::focus() == (Fl_Widget*)this) { -#ifdef __APPLE__ // PORTME: platform compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose if (Fl::compose_state) background = color();// Mac OS: underline marked text else #endif @@ -2181,7 +2181,7 @@ void Fl_Text_Display::draw_string(int style, if (!(style & BG_ONLY_MASK)) { fl_color( foreground ); fl_font( font, fsize ); -#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT // PORTME: platform editor feel +#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT // PORTME: Fl_Graphics_Driver - platform editor feel (fix this: fonts should not leak!) // makes sure antialiased ÄÖÜ do not leak on line above fl_push_clip(X, Y, toX - X, mMaxsize); #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 ) return; -#ifdef __APPLE__ // PORTME: platform compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose Fl::insertion_point_location(X, bot, fontHeight); #endif /* 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); if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE) && ( -#ifdef __APPLE__ // PORTME: platform compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose Fl::compose_state || #endif !has_selection || mCursorPos < start || mCursorPos > end) && @@ -3881,7 +3881,7 @@ int Fl_Text_Display::handle(int event) { if (dragType==DRAG_START_DND) { if (!Fl::event_is_click() && Fl::dnd_text_ops()) { const char* copy = buffer()->selection_text(); -#ifdef __APPLE__ // PORTME: platform compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform behavior Fl_X::dnd(1); #else Fl::dnd(); diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx index 933421e1f..8ca2fd4b7 100644 --- a/src/Fl_Text_Editor.cxx +++ b/src/Fl_Text_Editor.cxx @@ -25,7 +25,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform editor +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform editor #elif defined(FL_PORTING) # pragma message "FL_PORTING: add common shortcut for your platform here" #else @@ -146,7 +146,7 @@ static struct { { FL_Insert, FL_SHIFT, Fl_Text_Editor::kf_paste }, { 'a', FL_CTRL, Fl_Text_Editor::kf_select_all }, -#ifdef __APPLE__ // PORTME: platform editor feel +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform editor feel // Define CMD+key accelerators... { 'z', FL_COMMAND, Fl_Text_Editor::kf_undo }, { '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_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 }, -#endif // __APPLE__ // PORTME: platform editor feel +#endif // __APPLE__ // PORTME: Fl_Screen_Driver - platform editor feel { 0, 0, 0 } }; @@ -543,11 +543,11 @@ int Fl_Text_Editor::handle_key() { if (insert_mode()) insert(Fl::event_text()); else overstrike(Fl::event_text()); } -#ifdef __APPLE__ // PORTME: platform compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose if (Fl::compose_state) { int pos = this->insert_position(); this->buffer()->select(pos - Fl::compose_state, pos); - } + } #endif show_insert_position(); set_changed(); @@ -586,7 +586,7 @@ int Fl_Text_Editor::handle(int event) { case FL_UNFOCUS: show_cursor(mCursorOn); // redraws the cursor -#ifdef __APPLE__ // PORTME: platform compose +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose if (buffer()->selected() && Fl::compose_state) { int pos = insert_position(); buffer()->select(pos, pos); diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx index da71dcb49..c8057d528 100644 --- a/src/Fl_Tooltip.cxx +++ b/src/Fl_Tooltip.cxx @@ -31,11 +31,9 @@ Fl_Color Fl_Tooltip::color_ = fl_color_cube(FL_NUM_RED - 1, Fl_Color Fl_Tooltip::textcolor_ = FL_BLACK; Fl_Font Fl_Tooltip::font_ = FL_HELVETICA; Fl_Fontsize Fl_Tooltip::size_ = -1; -#if FLTK_ABI_VERSION >= 10301 int Fl_Tooltip::margin_width_ = 3; int Fl_Tooltip::margin_height_ = 3; int Fl_Tooltip::wrap_width_ = 400; -#endif static const char* tip; @@ -75,13 +73,10 @@ Fl_Widget* Fl_Tooltip::widget_ = 0; static Fl_TooltipBox *window = 0; static int Y,H; -#ifdef __APPLE__ // PORTME: platform additonal function -// returns the unique tooltip window Fl_Window *Fl_Tooltip::current_window(void) { return (Fl_Window*)window; } -#endif void Fl_TooltipBox::layout() { fl_font(Fl_Tooltip::font(), Fl_Tooltip::size()); @@ -156,7 +151,7 @@ static void tooltip_timeout(void*) { if (window) window->hide(); } else { int condition = 1; -#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: platform ?? +#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: Fl_Screen_Driver - platform ?? condition = (Fl::grab() == NULL); #endif if ( condition ) { diff --git a/src/Fl_Tree_Item.cxx b/src/Fl_Tree_Item.cxx index 30cacd774..fa59faef6 100644 --- a/src/Fl_Tree_Item.cxx +++ b/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)); -#if defined(USE_X11) || defined(__APPLE_QUARTZ__) // PORTME: platform look and feel +#if defined(USE_X11) || defined(__APPLE_QUARTZ__) // PORTME: Fl_Graphics_Driver - platform look and feel fl_line_style(FL_DOT); fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B), W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1); diff --git a/src/Fl_Tree_Prefs.cxx b/src/Fl_Tree_Prefs.cxx index 1cf91bd06..1bc513d0e 100644 --- a/src/Fl_Tree_Prefs.cxx +++ b/src/Fl_Tree_Prefs.cxx @@ -28,7 +28,7 @@ // These can be replaced via prefs.openicon()/closeicon() // static const char * const L_open_xpm[] = { -#ifdef __APPLE__ // PORTME: platform look and feel +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform look and feel "11 11 2 1", ". c None", "@ c #000000", @@ -43,7 +43,7 @@ static const char * const L_open_xpm[] = { "...@@@.....", "...@@......", "...@......." -#else /* __APPLE__ */ // PORTME: platform look and feel +#else /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel "11 11 3 1", ". c #fefefe", "# c #444444", @@ -59,12 +59,12 @@ static const char * const L_open_xpm[] = { "#.........#", "#.........#", "###########" -#endif /* __APPLE__ */ // PORTME: platform look and feel +#endif /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel }; static Fl_Pixmap L_openpixmap(L_open_xpm); static const char * const L_close_xpm[] = { -#ifdef __APPLE__ // PORTME: platform look and feel +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform look and feel "11 11 2 1", ". c None", "@ c #000000", @@ -79,7 +79,7 @@ static const char * const L_close_xpm[] = { ".....@.....", "...........", "..........." -#else /* __APPLE__ */ // PORTME: platform look and feel +#else /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel "11 11 3 1", ". c #fefefe", "# c #444444", @@ -95,7 +95,7 @@ static const char * const L_close_xpm[] = { "#.........#", "#.........#", "###########" -#endif /* __APPLE__ */ // PORTME: platform look and feel +#endif /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel }; static Fl_Pixmap L_closepixmap(L_close_xpm); @@ -157,7 +157,7 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() { _labelfgcolor = FL_BLACK; _labelbgcolor = 0xffffffff; // we use this as 'transparent' _connectorcolor = Fl_Color(43); -#ifdef __APPLE__ // PORTME: platform look and feel +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform look and feel _connectorstyle = FL_TREE_CONNECTOR_NONE; #else /* __APPLE__ */ _connectorstyle = FL_TREE_CONNECTOR_DOTTED; diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index 12f3ef6dd..75f423490 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -90,7 +90,7 @@ Fl_Window::~Fl_Window() { delete icon_; if (shape_data_) { if (shape_data_->todelete_) delete shape_data_->todelete_; -#if defined(__APPLE__) // PORTME: platform window driver +#if defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver if (shape_data_->mask) { CGImageRelease(shape_data_->mask); } @@ -404,7 +404,7 @@ void Fl_Window::free_icons() { } -#ifndef __APPLE__ // PORTME: platform window driver +#ifndef __APPLE__ // PORTME: Fl_Window_Driver - platform window driver /** Waits for the window to be displayed after calling show(). @@ -482,7 +482,7 @@ void Fl_Window::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Im #endif -#endif // ! __APPLE__ // PORTME: platform window driver +#endif // ! __APPLE__ // PORTME: Fl_Window_Driver - platform window driver // // End of "$Id$". diff --git a/src/Fl_Window_fullscreen.cxx b/src/Fl_Window_fullscreen.cxx index c66bf6ea7..b96ac9369 100644 --- a/src/Fl_Window_fullscreen.cxx +++ b/src/Fl_Window_fullscreen.cxx @@ -45,7 +45,7 @@ void Fl_Window::border(int b) { #elif defined(WIN32) // not yet implemented, but it's possible // for full fullscreen we have to make the window topmost as well -#elif defined(__APPLE_QUARTZ__) // PORTME: platform window driver +#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window driver // warning: not implemented in Quartz/Carbon #elif defined(FL_PORTING) # pragma message "handle window border setting" diff --git a/src/Fl_Window_hotspot.cxx b/src/Fl_Window_hotspot.cxx index 6bbc92a74..41aeddde8 100644 --- a/src/Fl_Window_hotspot.cxx +++ b/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 += GetSystemMetrics(SM_CYCAPTION); -#elif defined(__APPLE__) // PORTME: platform window driver +#elif defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver top = 24; left = 2; right = 2; diff --git a/src/Fl_Window_iconize.cxx b/src/Fl_Window_iconize.cxx index 566c88a27..807c01d26 100644 --- a/src/Fl_Window_iconize.cxx +++ b/src/Fl_Window_iconize.cxx @@ -27,7 +27,7 @@ void Fl_Window::iconize() { } else { #ifdef WIN32 ShowWindow(i->xid, SW_SHOWMINNOACTIVE); -#elif defined(__APPLE__) // PORTME: platform window driver +#elif defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver i->collapse(); #elif defined(FL_PORTING) # pragma message "FL_PORTING: add code to iconify a window" diff --git a/src/Fl_Window_shape.cxx b/src/Fl_Window_shape.cxx index f4e72009a..4e71197f3 100644 --- a/src/Fl_Window_shape.cxx +++ b/src/Fl_Window_shape.cxx @@ -24,7 +24,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform window driver +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver #elif defined(FL_PORTING) # pragma message "FL_PORTING: add code to implement arbitrarily shaped windows" #else @@ -32,7 +32,7 @@ #ifdef WIN32 # include // needed for VisualC2010 -#elif !defined(__APPLE__) // PORTME: platform window driver +#elif !defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver #include #if HAVE_DLFCN_H #include @@ -42,7 +42,7 @@ #endif -#if defined(__APPLE__) // PORTME: platform window driver +#if defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver static void MyProviderReleaseData (void *info, const void *data, size_t size) { delete[] (uchar*)data; @@ -175,12 +175,12 @@ void Fl_Window::combine_mask() } #endif // !FL_DOXYGEN -#endif // __APPLE__ // PORTME: platform window driver +#endif // __APPLE__ // PORTME: Fl_Window_Driver - platform window driver void Fl_Window::shape_bitmap_(Fl_Image* b) { shape_data_->shape_ = b; -#if defined(__APPLE__) // PORTME: platform window driver +#if defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver if (b) { // complement mask bits and perform bitwise inversion of all bytes and also reverse top and bottom 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 // PORTME: platform window driver +#if defined(__APPLE__) // on the mac, use an 8-bit mask // PORTME: Fl_Window_Driver - platform window driver /* the image can be of any depth 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) { if (shape_data_) { if (shape_data_->todelete_) { delete shape_data_->todelete_; } -#if defined(__APPLE__) // PORTME: platform window driver +#if defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver if (shape_data_->mask) { CGImageRelease(shape_data_->mask); } #endif } @@ -391,7 +391,7 @@ void Fl_Window::draw() { } draw_children(); -#ifdef __APPLE_QUARTZ__ // PORTME: platform window driver +#ifdef __APPLE_QUARTZ__ // PORTME: Fl_Window_Driver - platform window driver // 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. if (fl_mac_os_version < 100700 && fl_gc && !parent() && resizable() && diff --git a/src/Fl_abort.cxx b/src/Fl_abort.cxx index 161c9da52..a54004155 100644 --- a/src/Fl_abort.cxx +++ b/src/Fl_abort.cxx @@ -26,7 +26,7 @@ #include #include "flstring.h" -#if defined(WIN32) || defined(__APPLE__) // PORTME: native message box +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - native message box #elif defined(FL_PORTING) # pragma message "FL_PORTING: use native message box below if one is available" #else diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx index 0bcd2eec2..02f3da1da 100644 --- a/src/Fl_arg.cxx +++ b/src/Fl_arg.cxx @@ -28,13 +28,13 @@ #include #include "flstring.h" -#if defined(WIN32) || defined(__APPLE__) // PORTME: command line arguments +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_System_Driver - command line arguments #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement special command line handling" #else #endif -#if defined(WIN32) || defined(__APPLE__) || defined(FL_PORTING) // PORTME: parse geometry +#if defined(WIN32) || defined(__APPLE__) || defined(FL_PORTING) // PORTME: Fl_System_Driver - parse geometry int XParseGeometry(const char*, int*, int*, unsigned int*, unsigned int*); # define NoValue 0x0000 # define XValue 0x0001 @@ -175,13 +175,13 @@ int Fl::arg(int argc, char **argv, int &i) { Fl_Tooltip::disable(); i++; return 1; -#ifdef __APPLE__ // PORTME: platform command line +#ifdef __APPLE__ // PORTME: Fl_System_Driver - platform command line // The Finder application in MacOS X passes the "-psn_N_NNNNN" option // to all apps... } else if (strncmp(s, "psn_", 4) == 0) { i++; return 1; -#endif // __APPLE__ // PORTME: platform command line +#endif // __APPLE__ // PORTME: Fl_System_Driver - platform command line } const char *v = argv[i+1]; @@ -195,16 +195,16 @@ int Fl::arg(int argc, char **argv, int &i) { if (!flags) return 0; geometry = v; -#if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform command line +#if !defined(WIN32) && !defined(__APPLE__) // PORTME: Fl_System_Driver - platform command line } else if (fl_match(s, "display", 2)) { Fl::display(v); #endif -#ifdef __APPLE__ // PORTME: platform command line +#ifdef __APPLE__ // PORTME: Fl_System_Driver - platform command line // Xcode in MacOS X may pass "-NSDocumentRevisionsDebugMode YES" } else if (strcmp(s, "NSDocumentRevisionsDebugMode") == 0) { // nothing to do -#endif // __APPLE__ // PORTME: platform command line +#endif // __APPLE__ // PORTME: Fl_System_Driver - platform command line } else if (fl_match(s, "title", 2)) { title = v; @@ -303,7 +303,7 @@ void Fl_Window::show(int argc, char **argv) { Fl::get_system_colors(); #if defined(WIN32) -#elif defined(__APPLE__) // PORTME: platform default parameters +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver- platform default parameters #elif defined(FL_PORTING) # pragma message "FL_PORTING: Parse additional default settings" #else // X11 @@ -367,7 +367,7 @@ void Fl_Window::show(int argc, char **argv) { show(); #if defined(WIN32) -#elif defined(__APPLE__) // PORTME: platform properties +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - platform properties #elif defined(FL_PORTING) # pragma message "FL_PORTING: Parse additional default settings" #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, (unsigned char *)buffer, p-buffer-1); delete[] buffer; -#endif // !WIN32 && !__APPLE__ // PORTME: platform properties +#endif // !WIN32 && !__APPLE__ // PORTME: Fl_System_Driver - platform properties } // 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); } -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform command line arguments +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_System_Driver - platform command line arguments /* the following function was stolen from the X sources as indicated. */ diff --git a/src/Fl_compose.cxx b/src/Fl_compose.cxx index 40c4b10cd..d32acd799 100644 --- a/src/Fl_compose.cxx +++ b/src/Fl_compose.cxx @@ -26,12 +26,12 @@ Utility functions to support text input. #ifndef FL_DOXYGEN int Fl::compose_state = 0; -#ifdef __APPLE__ // PORTME: platform character composition +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform character composition int Fl_X::next_marked_length = 0; #endif #endif -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform character composition +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform character composition #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement keyboard composing in the code below" #else // X11 @@ -80,23 +80,23 @@ extern XIC fl_xim_ic; */ int Fl::compose(int& del) { int condition; -#if defined(__APPLE__) // PORTME: platform character composition +#if defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform character composition 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); condition = Fl::e_state&(FL_META | FL_CTRL) || (Fl::e_keysym >= FL_Shift_L && Fl::e_keysym <= FL_Alt_R) || // called from flagsChanged !has_text_key ; #else -unsigned char ascii = (unsigned char)e_text[0]; + unsigned char ascii = (unsigned char)e_text[0]; #if defined(WIN32) condition = (e_state & (FL_ALT | FL_META)) && !(ascii & 128) ; #else condition = (e_state & (FL_ALT | FL_META | FL_CTRL)) && !(ascii & 128) ; #endif // WIN32 -#endif // __APPLE__ // PORTME: platform character composition +#endif // __APPLE__ // PORTME: Fl_Screen_Driver - platform character composition if (condition) { del = 0; return 0;} // this stuff is to be treated as a function key del = Fl::compose_state; -#ifdef __APPLE__ // PORTME: platform character composition +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform character composition Fl::compose_state = Fl_X::next_marked_length; #else Fl::compose_state = 0; @@ -106,7 +106,7 @@ unsigned char ascii = (unsigned char)e_text[0]; return 1; } -#ifdef __APPLE__ // PORTME: platform character composition +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform character composition static int insertion_point_x = 0; static int insertion_point_y = 0; static int insertion_point_height = 0; @@ -116,7 +116,8 @@ void Fl::reset_marked_text() { Fl::compose_state = 0; Fl_X::next_marked_length = 0; insertion_point_location_is_valid = false; - } +} + int Fl_X::insertion_point_location(int *px, int *py, int *pheight) // return true if the current coordinates of the insertion point are available { @@ -126,13 +127,14 @@ int Fl_X::insertion_point_location(int *px, int *py, int *pheight) *pheight = insertion_point_height; return true; } + void Fl::insertion_point_location(int x, int y, int height) { insertion_point_location_is_valid = true; insertion_point_x = x; insertion_point_y = y; insertion_point_height = height; } -#endif // __APPLE__ // PORTME: platform character composition +#endif // __APPLE__ // PORTME: Fl_Screen_Driver - platform character composition /** If the user moves the cursor, be sure to call Fl::compose_reset(). @@ -143,7 +145,7 @@ void Fl::insertion_point_location(int x, int y, int height) { void Fl::compose_reset() { Fl::compose_state = 0; -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform character composition +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform character composition #elif defined(FL_PORTING) # pragma message "FL_PORTING: compose reset extra functions" #else diff --git a/src/Fl_display.cxx b/src/Fl_display.cxx index f68b1fa15..50c9af808 100644 --- a/src/Fl_display.cxx +++ b/src/Fl_display.cxx @@ -20,32 +20,20 @@ // Using setenv makes programs that are exec'd use the same display. #include -#include -#include "flstring.h" +#include /** - Sets the X display to use for all windows. Actually this just sets - the environment variable $DISPLAY to the passed string, so this only - works before you show() the first window or otherwise open the display, - and does nothing useful under WIN32. + \brief Sets the X display to use for all windows. + + Actually this just sets the environment variable $DISPLAY to the passed string, + so this only works before you show() the first window or otherwise open the + display. + + This does nothing on other platforms. */ -void Fl::display(const char *d) { -#if defined(__APPLE__) || defined(WIN32) // PORTME: platform screen stuff - (void)d; -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: initiate a connection to the display" -#else - static char e[1024]; - strcpy(e,"DISPLAY="); - strlcat(e,d,sizeof(e)); - for (char *c = e+8; *c!=':'; c++) { - if (!*c) { - strlcat(e,":0.0",sizeof(e)); - break; - } - } - putenv(e); -#endif // __APPLE__ // PORTME: platform screen stuff +void Fl::display(const char *d) +{ + screen_driver()->display(d); } // diff --git a/src/Fl_get_key.cxx b/src/Fl_get_key.cxx index 79b924237..ac55ed95d 100644 --- a/src/Fl_get_key.cxx +++ b/src/Fl_get_key.cxx @@ -18,7 +18,7 @@ #ifdef WIN32 # include "Fl_get_key_win32.cxx" -#elif defined(__APPLE__) // PORTME: platform keyboard stuff +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform keyboard stuff # include "Fl_get_key_mac.cxx" #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement keyboard reading and interpretation in its own file" diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx index a7095408e..c00d46770 100644 --- a/src/Fl_get_system_colors.cxx +++ b/src/Fl_get_system_colors.cxx @@ -17,6 +17,7 @@ // #include +#include #include #include #include @@ -92,47 +93,10 @@ static void set_selection_color(uchar r, uchar g, uchar b) { Fl::set_color(FL_SELECTION_COLOR,r,g,b); } -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform system colors -# include -// simulation of XParseColor: int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) { - if (*p == '#') p++; - size_t n = strlen(p); - size_t m = n/3; - const char *pattern = 0; - switch(m) { - case 1: pattern = "%1x%1x%1x"; break; - case 2: pattern = "%2x%2x%2x"; break; - case 3: pattern = "%3x%3x%3x"; break; - case 4: pattern = "%4x%4x%4x"; break; - default: return 0; - } - int R,G,B; if (sscanf(p,pattern,&R,&G,&B) != 3) return 0; - switch(m) { - case 1: R *= 0x11; G *= 0x11; B *= 0x11; break; - case 3: R >>= 4; G >>= 4; B >>= 4; break; - case 4: R >>= 8; G >>= 8; B >>= 8; break; - } - r = (uchar)R; g = (uchar)G; b = (uchar)B; - return 1; + Fl::screen_driver()->parse_color(p, r, g, b); } -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: implement fl_parse_color" -int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) { return 0; } -#else -// Wrapper around XParseColor... -int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) { - XColor x; - if (!fl_display) fl_open_display(); - if (XParseColor(fl_display, fl_colormap, p, &x)) { - r = (uchar)(x.red>>8); - g = (uchar)(x.green>>8); - b = (uchar)(x.blue>>8); - return 1; - } else return 0; -} -#endif // WIN32 || __APPLE__ // PORTME: platform system colors /** \fn Fl::get_system_colors() @@ -172,7 +136,7 @@ void Fl::get_system_colors() { getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color); } -#elif defined(__APPLE__) // PORTME: platform system colors +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform system colors // MacOS X currently supports two color schemes - Blue and Graphite. // Since we aren't emulating the Aqua interface (even if Apple would @@ -300,7 +264,7 @@ static Fl_Pixmap tile(tile_xpm); int Fl::scheme(const char *s) { if (!s) { if ((s = getenv("FLTK_SCHEME")) == NULL) { -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform system scheme +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform system scheme #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement Fl::scheme" #else @@ -309,7 +273,7 @@ int Fl::scheme(const char *s) { if (!key) key = "fltk"; fl_open_display(); s = XGetDefault(fl_display, key, "scheme"); -#endif // !WIN32 && !__APPLE__ // PORTME: platform system scheme +#endif // !WIN32 && !__APPLE__ // PORTME: Fl_Screen_Driver - platform system scheme } } diff --git a/src/Fl_grab.cxx b/src/Fl_grab.cxx index 38e51d368..22d49bbbd 100644 --- a/src/Fl_grab.cxx +++ b/src/Fl_grab.cxx @@ -36,7 +36,7 @@ extern void fl_fix_focus(); // in Fl.cxx // see where and how this is used. extern HWND fl_capture; -#elif defined(__APPLE__) // PORTME: platform focus grabbing +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform focus grabbing extern void *fl_capture; #elif defined(FL_PORTING) @@ -61,7 +61,7 @@ void Fl::grab(Fl_Window* win) { #ifdef WIN32 SetActiveWindow(fl_capture = fl_xid(first_window())); SetCapture(fl_capture); -#elif defined(__APPLE__) // PORTME: platform focus grabbing +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform focus grabbing fl_capture = Fl_X::i(first_window())->xid; Fl_X::i(first_window())->set_key_window(); #elif defined(FL_PORTING) @@ -92,7 +92,7 @@ void Fl::grab(Fl_Window* win) { #ifdef WIN32 fl_capture = 0; ReleaseCapture(); -#elif defined(__APPLE__) // PORTME: platform focus grabbing +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform focus grabbing fl_capture = 0; #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement event grabbing" diff --git a/src/Fl_own_colormap.cxx b/src/Fl_own_colormap.cxx index b57ebf39b..ea04d30a4 100644 --- a/src/Fl_own_colormap.cxx +++ b/src/Fl_own_colormap.cxx @@ -41,7 +41,7 @@ void Fl::own_colormap() {} -#elif defined(__APPLE__) // PORTME: platform colormap +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform colormap // MacOS X always provides a TrueColor interface... void Fl::own_colormap() {} diff --git a/src/Fl_visual.cxx b/src/Fl_visual.cxx index 258c22e6b..65534e5a5 100644 --- a/src/Fl_visual.cxx +++ b/src/Fl_visual.cxx @@ -65,7 +65,7 @@ int Fl::visual(int flags) { if ((flags & FL_RGB8) && GetDeviceCaps(fl_gc,BITSPIXEL)<24) return 0; return 1; } -#elif defined(__APPLE__) // PORTME: platform visuals +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform visuals // \todo Mac : need to implement Visual flags int Fl::visual(int flags) { diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 8409b893d..16f3816b5 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -16,9 +16,14 @@ // http://www.fltk.org/str.php // +// make this available on all platforms to make code maintainability easier +class Fl_Widget *fl_selection_requestor; + #ifdef WIN32 //# include "Fl_win32.cxx" -#elif defined(__APPLE__) // PORTME: platform window driver +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - platform window driver + // PORTME: Fl_Screen_Driver + // PORTME: Fl_Window_Driver //# include "Fl_mac.cxx" // now Fl_cocoa.mm #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement the FLTK core in its own file" @@ -799,7 +804,6 @@ void Fl::get_mouse(int &xx, int &yy) { //////////////////////////////////////////////////////////////// // Code used for paste and DnD into the program: -Fl_Widget *fl_selection_requestor; char *fl_selection_buffer[2]; int fl_selection_length[2]; const char * fl_selection_type[2]; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 787a9967a..9c6ff5dfa 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -20,6 +20,7 @@ #include "../../config_lib.h" #include "Fl_Cocoa_Screen_Driver.h" #include +#include extern "C" void NSBeep(void); @@ -119,6 +120,31 @@ void Fl_Cocoa_Screen_Driver::flush() { } +// simulation of XParseColor: +int Fl_Cocoa_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b) +{ + if (*p == '#') p++; + size_t n = strlen(p); + size_t m = n/3; + const char *pattern = 0; + switch(m) { + case 1: pattern = "%1x%1x%1x"; break; + case 2: pattern = "%2x%2x%2x"; break; + case 3: pattern = "%3x%3x%3x"; break; + case 4: pattern = "%4x%4x%4x"; break; + default: return 0; + } + int R,G,B; if (sscanf(p,pattern,&R,&G,&B) != 3) return 0; + switch(m) { + case 1: R *= 0x11; G *= 0x11; B *= 0x11; break; + case 3: R >>= 4; G >>= 4; B >>= 4; break; + case 4: R >>= 8; G >>= 8; B >>= 8; break; + } + r = (uchar)R; g = (uchar)G; b = (uchar)B; + return 1; +} + + // // End of "$Id$". // diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h index 00ee70c18..02852c514 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h @@ -59,6 +59,8 @@ public: virtual void beep(int type); // --- global events virtual void flush(); + // --- global colors + virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b); }; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 0569caca2..f30bee01c 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -20,11 +20,12 @@ #include "../../config_lib.h" #include "Fl_WinAPI_Screen_Driver.h" #include +#include -# if !defined(HMONITOR_DECLARED) && (_WIN32_WINNT < 0x0500) -# define COMPILE_MULTIMON_STUBS -# include -# endif // !HMONITOR_DECLARED && _WIN32_WINNT < 0x0500 +#if !defined(HMONITOR_DECLARED) && (_WIN32_WINNT < 0x0500) +# define COMPILE_MULTIMON_STUBS +# include +#endif // !HMONITOR_DECLARED && _WIN32_WINNT < 0x0500 /** @@ -239,6 +240,30 @@ void Fl_WinAPI_Screen_Driver::flush() } +// simulation of XParseColor: +int Fl_WinAPI_Screen_Driverparse_color(const char* p, uchar& r, uchar& g, uchar& b) +{ + if (*p == '#') p++; + size_t n = strlen(p); + size_t m = n/3; + const char *pattern = 0; + switch(m) { + case 1: pattern = "%1x%1x%1x"; break; + case 2: pattern = "%2x%2x%2x"; break; + case 3: pattern = "%3x%3x%3x"; break; + case 4: pattern = "%4x%4x%4x"; break; + default: return 0; + } + int R,G,B; if (sscanf(p,pattern,&R,&G,&B) != 3) return 0; + switch(m) { + case 1: R *= 0x11; G *= 0x11; B *= 0x11; break; + case 3: R >>= 4; G >>= 4; B >>= 4; break; + case 4: R >>= 8; G >>= 8; B >>= 8; break; + } + r = (uchar)R; g = (uchar)G; b = (uchar)B; + return 1; +} + // // End of "$Id$". diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h index 14bd1ff2d..ac9849246 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h @@ -40,6 +40,7 @@ protected: BOOL screen_cb(HMONITOR mon, HDC, LPRECT r); public: + // --- screen configuration virtual void init(); virtual int x(); virtual int y(); @@ -52,6 +53,8 @@ public: virtual void beep(int type); // --- global events virtual void flush(); + // --- global colors + virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b); }; diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index e98dc3413..49fa840f5 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -42,8 +42,30 @@ Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() } +void Fl_X11_Screen_Driver::display(const char *d) +{ + if (!d) return; + + static const char *cmd = "DISPLAY="; + static const char *ext = ":0.0"; + int nc = strlen(cmd); + int ne = strlen(ext); + int nd = strlen(d); + + char *buf = malloc(nc+ne+nd+1); + strcpy(buf, cmd); + strcat(buf, d); + if (strchr(d, ':')) { + strcat(d, ext); + } + putenv(e); + free(buf); +} + + static int fl_workarea_xywh[4] = { -1, -1, -1, -1 }; + void Fl_X11_Screen_Driver::init_workarea() { fl_open_display(); @@ -210,6 +232,20 @@ void Fl_X11_Screen_Driver::flush() } +// Wrapper around XParseColor... +int Fl_X11_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b) +{ + XColor x; + if (!fl_display) fl_open_display(); + if (XParseColor(fl_display, fl_colormap, p, &x)) { + r = (uchar)(x.red>>8); + g = (uchar)(x.green>>8); + b = (uchar)(x.blue>>8); + return 1; + } else return 0; +} + + // // End of "$Id$". // diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.h b/src/drivers/X11/Fl_X11_Screen_Driver.h index 4a4667cf5..27ced8822 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.h +++ b/src/drivers/X11/Fl_X11_Screen_Driver.h @@ -41,6 +41,9 @@ protected: float dpi[MAX_SCREENS][2]; public: + // --- display management + virtual void display(const char *disp); + // --- screen configuration void init_workarea(); virtual void init(); virtual int x(); @@ -54,6 +57,8 @@ public: virtual void beep(int type); // --- global events virtual void flush(); + // --- global colors + virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b); }; diff --git a/src/filename_absolute.cxx b/src/filename_absolute.cxx index 785fcb396..867f2af04 100644 --- a/src/filename_absolute.cxx +++ b/src/filename_absolute.cxx @@ -219,11 +219,11 @@ fl_filename_relative(char *to, // O - Relative filename *slash != '\0' && *newslash != '\0'; slash ++, newslash ++) if (isdirsep(*slash) && isdirsep(*newslash)) continue; -#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__) // PORTME: filename stuff +#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__) // PORTME: Fl_System_Driver - filename stuff else if (tolower(*slash & 255) != tolower(*newslash & 255)) break; #else else if (*slash != *newslash) break; -#endif // WIN32 || __EMX__ || __APPLE__ // PORTME: filename stuff +#endif // WIN32 || __EMX__ || __APPLE__ // PORTME: Fl_System_Driver - filename stuff // skip over trailing slashes if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash) diff --git a/src/filename_ext.cxx b/src/filename_ext.cxx index 7f1aaf224..367d57145 100644 --- a/src/filename_ext.cxx +++ b/src/filename_ext.cxx @@ -21,7 +21,7 @@ #include #ifdef WIN32 -#elif defined(__APPLE__) // PORTME: filename stuff +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - filename stuff #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement directory and filename handling for your platform if needed" #else // X11 diff --git a/src/filename_isdir.cxx b/src/filename_isdir.cxx index 71efe3fc2..495f6a399 100644 --- a/src/filename_isdir.cxx +++ b/src/filename_isdir.cxx @@ -26,7 +26,7 @@ #include #ifdef WIN32 -#elif defined(__APPLE__) // PORTME: directory stuff +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - directory stuff #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement directory and filename handling for your platform if needed" #else // X11 diff --git a/src/filename_list.cxx b/src/filename_list.cxx index f27281a59..806df0671 100644 --- a/src/filename_list.cxx +++ b/src/filename_list.cxx @@ -22,12 +22,12 @@ #include #include "flstring.h" #include -#ifdef __APPLE__ // PORTME: directory stuff +#ifdef __APPLE__ // PORTME: Fl_System_Driver - directory stuff #include #endif #ifdef WIN32 -#elif defined(__APPLE__) // PORTME: directory stuff +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - directory stuff #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement directory and filename handling for your platform if needed" #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 dirlen = strlen(d); -#ifdef __APPLE__ // PORTME: directory stuff +#ifdef __APPLE__ // PORTME: Fl_System_Driver - directory stuff dirloc = (char *)d; #else dirloc = (char *)malloc(dirlen + 1); @@ -104,7 +104,7 @@ int fl_filename_list(const char *d, dirent ***list, #ifndef HAVE_SCANDIR // This version is when we define our own scandir int n = fl_scandir(dirloc, list, 0, sort); -#elif defined(HAVE_SCANDIR_POSIX) && !defined(__APPLE__) // PORTME: directory stuff +#elif defined(HAVE_SCANDIR_POSIX) && !defined(__APPLE__) // PORTME: Fl_System_Driver - directory stuff // POSIX (2008) defines the comparison function like this: int n = scandir(dirloc, list, 0, (int(*)(const dirent **, const dirent **))sort); #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); #elif defined(__sgi) int n = scandir(dirloc, list, 0, sort); -#elif defined(__APPLE__) // PORTME: directory stuff +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - directory stuff # 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); # 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); #endif -#ifndef __APPLE__ // PORTME: directory stuff +#ifndef __APPLE__ // PORTME: Fl_System_Driver - directory stuff free(dirloc); #endif @@ -150,7 +150,7 @@ int fl_filename_list(const char *d, dirent ***list, int newlen; dirent *de = (*list)[i]; int len = strlen(de->d_name); -#ifdef __APPLE__ // PORTME: directory stuff +#ifdef __APPLE__ // PORTME: Fl_System_Driver - directory stuff newlen = len; #else 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 memcpy(newde, de, de->d_name - (char*)de); -#ifdef __APPLE__ // PORTME: directory stuff +#ifdef __APPLE__ // PORTME: Fl_System_Driver - directory stuff strcpy(newde->d_name, de->d_name); #else fl_utf8from_mb(newde->d_name, newlen + 1, de->d_name, len); diff --git a/src/fl_call_main.c b/src/fl_call_main.c index 86326a46e..113aec17c 100644 --- a/src/fl_call_main.c +++ b/src/fl_call_main.c @@ -37,7 +37,7 @@ * Microsoft(r) Windows(r) that allows for it. */ -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform main() +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_System_Driver - platform main() #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement 'main()' here if your platform provides another app entry point" #else diff --git a/src/fl_dnd.cxx b/src/fl_dnd.cxx index ab2874609..eb8f1c496 100644 --- a/src/fl_dnd.cxx +++ b/src/fl_dnd.cxx @@ -18,7 +18,7 @@ #ifdef WIN32 # include "fl_dnd_win32.cxx" -#elif defined(__APPLE__) // PORTME: platform dnd +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform dnd //# include "fl_dnd_mac.cxx" #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement drag and drop in its own platform file" diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx index 0d2b35d1f..2c347115b 100644 --- a/src/fl_draw_pixmap.cxx +++ b/src/fl_draw_pixmap.cxx @@ -38,7 +38,7 @@ #include #include "flstring.h" -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform pixmap +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform pixmap #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement platform specific about pixmap drawing here" #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 -#ifdef __APPLE_QUARTZ__ // PORTME: platform pixmap +#ifdef __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform pixmap if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) { Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4); 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; return 1; } else { -#endif // __APPLE_QUARTZ__ // PORTME: platform pixmap +#endif // __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform pixmap // build the mask bitmap used by Fl_Pixmap: if (fl_mask_bitmap) { 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); -#ifdef __APPLE_QUARTZ__ // PORTME: platform pixmap +#ifdef __APPLE_QUARTZ__ // PORTME: Fl_Graphics_Driver - platform pixmap } #endif delete[] buffer; diff --git a/src/fl_encoding_latin1.cxx b/src/fl_encoding_latin1.cxx index e732d6418..f7adc3459 100644 --- a/src/fl_encoding_latin1.cxx +++ b/src/fl_encoding_latin1.cxx @@ -21,7 +21,7 @@ #include #include "flstring.h" -#ifdef __APPLE__ // PORTME: platform text encoding +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform text encoding // 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 diff --git a/src/fl_encoding_mac_roman.cxx b/src/fl_encoding_mac_roman.cxx index d29720818..ff4e6aecc 100644 --- a/src/fl_encoding_mac_roman.cxx +++ b/src/fl_encoding_mac_roman.cxx @@ -35,7 +35,7 @@ // lookup tables below will convert all common character codes and replace // unknown characters with an upsidedown question mark. -#ifdef __APPLE__ // PORTME: platform text encoding +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform text encoding const char *fl_mac_roman_to_local(const char *t, int) { diff --git a/src/fl_font.cxx b/src/fl_font.cxx index 7c9b82507..c2d8fe66f 100644 --- a/src/fl_font.cxx +++ b/src/fl_font.cxx @@ -31,7 +31,7 @@ // all driver code is now in drivers/XXX/Fl_XXX_Graphics_Driver_xyz.cxx // ----------------------------------------------------------------------------- -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform font stuff +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform font stuff #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you need the XFontStruct ?" #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) { -#ifdef __APPLE__ // PORTME: platform alternative API +#ifdef __APPLE__ // PORTME: Fl_Graphics_Driver - platform alternative API fl_graphics_driver->draw(str, l, x, y); #else fl_draw(str, l, (int)x, (int)y); diff --git a/src/fl_open_uri.cxx b/src/fl_open_uri.cxx index f67dd7e82..dfad504f1 100644 --- a/src/fl_open_uri.cxx +++ b/src/fl_open_uri.cxx @@ -45,9 +45,9 @@ // Local functions... // -#if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform open doc +#if !defined(WIN32) && !defined(__APPLE__) // PORTME: Fl_System_Driver - platform open doc static char *path_find(const char *program, char *filename, int filesize); -#endif // !WIN32 && !__APPLE__ // PORTME: platform open doc +#endif // !WIN32 && !__APPLE__ // PORTME: Fl_System_Driver - platform open doc #ifndef WIN32 static int run_program(const char *program, char **argv, char *msg, int msglen); #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); -#elif defined(__APPLE__) // PORTME: platform open doc +#elif defined(__APPLE__) // PORTME: Fl_System_Driver - platform open doc char *argv[3]; // Command-line arguments argv[0] = (char*)"open"; @@ -145,7 +145,7 @@ fl_open_uri(const char *uri, char *msg, int msglen) { #elif defined(FL_PORTING) # pragma message "FL_PORTING: add code to open any file type with an external app" -#else // !WIN32 && !__APPLE__ // PORTME: platform open doc +#else // !WIN32 && !__APPLE__ // PORTME: Fl_System_Driver - platform open doc // Run any of several well-known commands to open the URI. // // 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__) // PORTME: platform open doc +#if !defined(WIN32) && !defined(__APPLE__) // PORTME: Fl_System_Driver - platform open doc // Find a program in the path... static char *path_find(const char *program, char *filename, int filesize) { const char *path; // Search path @@ -302,7 +302,7 @@ static char *path_find(const char *program, char *filename, int filesize) { return 0; } -#endif // !WIN32 && !__APPLE__ // PORTME: platform open doc +#endif // !WIN32 && !__APPLE__ // PORTME: Fl_System_Driver - platform open doc #ifndef WIN32 diff --git a/src/fl_overlay.cxx b/src/fl_overlay.cxx index 5962bb1fe..41ac3b4a5 100644 --- a/src/fl_overlay.cxx +++ b/src/fl_overlay.cxx @@ -23,7 +23,7 @@ #include #include -#ifdef __APPLE__ // PORTME: platform overlay +#ifdef __APPLE__ // PORTME: Fl_Window_Driver - platform overlay #include #endif @@ -48,7 +48,7 @@ static void draw_current_rect() { int old = SetROP2(fl_gc, R2_NOT); fl_rect(px, py, pw, ph); SetROP2(fl_gc, old); -# elif defined(__APPLE_QUARTZ__) // PORTME: platform overlay +# elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform overlay // warning: Quartz does not support xor drawing // Use the Fl_Overlay_Window instead. fl_color(FL_WHITE); @@ -81,7 +81,7 @@ static void draw_current_rect() { static void erase_current_rect() { #ifdef USE_XOR -# ifdef __APPLE_QUARTZ__ // PORTME: platform overlay +# ifdef __APPLE_QUARTZ__ // PORTME: Fl_Window_Driver - platform overlay fl_rect(px, py, pw, ph); # else draw_current_rect(); diff --git a/src/fl_read_image.cxx b/src/fl_read_image.cxx index 9c2fb7d42..3a4d8ede3 100644 --- a/src/fl_read_image.cxx +++ b/src/fl_read_image.cxx @@ -25,14 +25,14 @@ # include #endif // DEBUG -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform screenshots +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform screenshots #elif defined(FL_PORTING) # 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) { } #else #endif -#if defined(__APPLE__) // PORTME: platform screenshots +#if defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform screenshots # include "fl_read_image_mac.cxx" #else # include @@ -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(); uchar *image_data; int alloc_img = (full_img != NULL || p == NULL); // false means use p, don't alloc new memory for image -#ifdef __APPLE_CC__ // PORTME: platform screenshots +#ifdef __APPLE_CC__ // PORTME: Fl_Screen_Driver - platform screenshots // 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); #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 // !__APPLE__ // PORTME: platform screenshots +#endif // !__APPLE__ // PORTME: Fl_Screen_Driver - platform screenshots // // End of "$Id$". diff --git a/src/fl_scroll_area.cxx b/src/fl_scroll_area.cxx index 061d5a202..1afd1496a 100644 --- a/src/fl_scroll_area.cxx +++ b/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 BitBlt(fl_gc, dest_x, dest_y, src_w, src_h, fl_gc, src_x, src_y,SRCCOPY); -#elif defined(__APPLE_QUARTZ__) // PORTME: platform scrolling +#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Graphics_Driver - platform scrolling CGImageRef img = Fl_X::CGImage_from_window_rect(Fl_Window::current(), src_x, src_y, src_w, src_h); if (img) { CGRect rect = CGRectMake(dest_x, dest_y, src_w, src_h); diff --git a/src/fl_set_font.cxx b/src/fl_set_font.cxx index 0dac8a674..0c53e75af 100644 --- a/src/fl_set_font.cxx +++ b/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. */ void Fl::set_font(Fl_Font fnum, const char* name) { -#ifdef __APPLE__ // PORTME: platform fonts +#ifdef __APPLE__ // PORTME: Fl_Graphics_Driver - platform fonts if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts(); #endif while (fnum >= table_size) { @@ -53,7 +53,7 @@ void Fl::set_font(Fl_Font fnum, const char* name) { #if defined(USE_X11) fl_fonts[i].xlist = 0; fl_fonts[i].n = 0; -#endif // !WIN32 && !__APPLE__ // PORTME: platform fonts +#endif // !WIN32 && !__APPLE__ // PORTME: Fl_Graphics_Driver - platform fonts } } Fl_Fontdesc* s = fl_fonts+fnum; @@ -85,7 +85,7 @@ void Fl::set_font(Fl_Font fnum, Fl_Font from) { of this face. */ const char* Fl::get_font(Fl_Font fnum) { -#ifdef __APPLE__ // PORTME: platform fonts +#ifdef __APPLE__ // PORTME: Fl_Graphics_Driver - platform fonts if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts(); #endif return fl_fonts[fnum].name; diff --git a/src/fl_shortcut.cxx b/src/fl_shortcut.cxx index eda96793c..e7937a8ab 100644 --- a/src/fl_shortcut.cxx +++ b/src/fl_shortcut.cxx @@ -38,11 +38,11 @@ #include #include #include "flstring.h" -#if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform keyboard feel +#if !defined(WIN32) && !defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform keyboard feel #include #endif -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform keyboard feel +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform keyboard feel #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement keyboard shortcut handling here" #else @@ -123,7 +123,7 @@ static Keyname table[] = { {FL_Alt_R, "Alt_R"}, {FL_Delete, "Delete"} }; -#elif defined(__APPLE__) // PORTME: platform keyboard feel +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform keyboard feel static Keyname table[] = { // v - this column contains UTF-8 characters {' ', "Space"}, @@ -194,7 +194,7 @@ const char* fl_shortcut_label(unsigned int shortcut, const char **eom) { if (((unsigned)fl_tolower(v))!=v) { shortcut |= FL_SHIFT; } -#ifdef __APPLE__ // PORTME: platform keyboard feel +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform keyboard feel // 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_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_SHIFT) {strcpy(p,"Shift+"); p += 6;} if (shortcut & FL_CTRL) {strcpy(p,"Ctrl+"); p += 5;} -#endif // __APPLE__ // PORTME: platform keyboard feel +#endif // __APPLE__ // PORTME: Fl_Screen_Driver - platform keyboard feel if (eom) *eom = p; unsigned int key = shortcut & FL_KEY_MASK; -#if defined(WIN32) || defined(__APPLE__) // if not X // PORTME: platform keyboard feel +#if defined(WIN32) || defined(__APPLE__) // if not X // PORTME: Fl_Screen_Driver - platform keyboard feel if (key >= FL_F && key <= FL_F_Last) { *p++ = 'F'; 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 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); -#ifdef __APPLE__ // PORTME: platform keyboard feel +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform keyboard feel // this line makes underline shortcuts work the same way they do on MSWindow // and Linux. 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); if (c == ls) return 1; -#ifdef __APPLE__ // PORTME: platform keyboard feel +#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform keyboard feel // 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) return 1; diff --git a/src/fl_utf.c b/src/fl_utf.c index c5f084c94..8cd0b6918 100644 --- a/src/fl_utf.c +++ b/src/fl_utf.c @@ -22,7 +22,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode #elif defined(FL_PORTING) # pragma message "FL_PORTING: look out for some unicode functions here. Default should be fine though." #else diff --git a/src/fl_utf8.cxx b/src/fl_utf8.cxx index 88a5578bf..0080cf2e0 100644 --- a/src/fl_utf8.cxx +++ b/src/fl_utf8.cxx @@ -21,7 +21,7 @@ #include #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode #elif defined(FL_PORTING) # pragma message "FL_PORTING: verify code for utf8 handling" #else diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index e4f99566a..48c7d732f 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -19,7 +19,7 @@ // Functions from // See also Fl_Gl_Window and gl_start.cxx -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform opengl +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform opengl #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement OpenGL text rendering here" #else @@ -38,7 +38,7 @@ #include "Fl_Font.H" #include -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform opengl +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform opengl #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you want to include Xutf8.h? It's written for X11." #else diff --git a/src/xutf8/is_right2left.c b/src/xutf8/is_right2left.c index 3d5b74006..d44f05937 100644 --- a/src/xutf8/is_right2left.c +++ b/src/xutf8/is_right2left.c @@ -14,7 +14,7 @@ * http://www.fltk.org/str.php */ -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode #elif defined(FL_PORTING) # pragma message "FL_PORTING: utf8 functionality" #else diff --git a/src/xutf8/keysym2Ucs.c b/src/xutf8/keysym2Ucs.c index cb45c52f8..b83b5ef8f 100644 --- a/src/xutf8/keysym2Ucs.c +++ b/src/xutf8/keysym2Ucs.c @@ -17,7 +17,7 @@ #define KEYSYM2UCS_INCLUDED #if defined(WIN32) -#elif defined(__APPLE__) // PORTME: platform unicode +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you want to include Xutf8.h?" #else diff --git a/src/xutf8/utf8Input.c b/src/xutf8/utf8Input.c index a1f6edcc8..2eef627aa 100644 --- a/src/xutf8/utf8Input.c +++ b/src/xutf8/utf8Input.c @@ -15,7 +15,7 @@ */ #if defined(WIN32) -#elif defined(__APPLE__) // PORTME: platform unicode +#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you want to include Xutf8.h?" #else diff --git a/src/xutf8/utf8Utils.c b/src/xutf8/utf8Utils.c index bb429f7a1..0af7bf48c 100644 --- a/src/xutf8/utf8Utils.c +++ b/src/xutf8/utf8Utils.c @@ -14,7 +14,7 @@ * http://www.fltk.org/str.php */ -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode #elif defined(FL_PORTING) # pragma message "FL_PORTING: utf8" #else diff --git a/src/xutf8/utf8Wrap.c b/src/xutf8/utf8Wrap.c index 8bc1d49bb..cbff3ecb4 100644 --- a/src/xutf8/utf8Wrap.c +++ b/src/xutf8/utf8Wrap.c @@ -14,7 +14,7 @@ * http://www.fltk.org/str.php */ -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform unicode +#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode #elif defined(FL_PORTING) # pragma message "FL_PORTING: utf8" #else