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

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

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11155 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2016-02-11 12:02:36 +00:00
parent a3c0dac034
commit 50ee3bcd66
94 changed files with 323 additions and 435 deletions

View File

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

View File

@ -54,7 +54,7 @@ struct Fl_Label;
# else
# define FL_SOCKET int
# endif
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__)
#if defined(__APPLE__) // PORTME: additional functions
// not needed
#elif defined(WIN32)
// not needed

View File

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

View File

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

View File

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

View File

@ -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__)
#elif defined(__APPLE__) // PORTME: platform specific types
typedef float COORD_T;
typedef struct { float x; float y; } QPoint;
# define XPOINT QPoint

View File

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

View File

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

View File

@ -40,7 +40,7 @@ typedef void fl_BROWSEINFOW;
# include <FL/filename.H> // FL_EXPORT
// Use Apple's chooser
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: native file chooser support
# define MAXFILTERS 80
# include <FL/filename.H> // FL_EXPORT
@ -192,7 +192,7 @@ private:
void clear_filters();
void add_filter(const char *, const char *);
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: 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)
#if !defined(__APPLE__) && !defined(WIN32) && !defined(FL_PORTING) // PORTME: 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)
#endif // !defined(__APPLE__) && !defined(WIN32) // PORTME: native file chooser option
#endif /*FL_NATIVE_FILE_CHOOSER_H*/

View File

@ -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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: platform specifics for PostScript
void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); }
#elif defined(WIN32)
// not needed

View File

@ -32,7 +32,7 @@
#include <stdio.h>
#ifdef WIN32
#include <commdlg.h>
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: platform printer driver
// not needed
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: include files needed for printing support"
@ -40,7 +40,7 @@
#include <FL/Fl_PostScript.H>
#endif
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: platform printer driver
/**
Print support under MSWindows and Mac OS.
@ -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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: platform printer driver
void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y);
#endif
/** \brief The destructor */
@ -235,7 +235,7 @@ public:
~Fl_Printer(void);
private:
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: system printer driver
Fl_System_Printer *printer;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate your own Fl_xxx_Printer here"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

2
FL/x.H
View File

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

View File

@ -60,7 +60,7 @@
#endif // DEBUG || DEBUG_WATCH
#ifdef WIN32
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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)
#if defined(__APPLE__) || defined(FL_DOXYGEN) // PORTME: 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__
#endif // __APPLE__ // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: core stuff from screen, platform, and window driver
// implementation in Fl_cocoa.mm (was Fl_mac.cxx)
@ -557,7 +557,7 @@ static void run_checks()
}
}
#if !defined(WIN32) && !defined(__APPLE__)
#if !defined(WIN32) && !defined(__APPLE__) // PORTME: ??
static char in_idle;
#endif
@ -644,7 +644,7 @@ double Fl::wait(double time_to_wait) {
return fl_wait(time_to_wait);
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: 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__)
#if defined( WIN32 ) || defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE__ // PORTME: platform window focus
if (fl_xfocus != win) {
Fl_X *x = Fl_X::i(win);
if (x) x->set_key_window();
@ -1210,7 +1210,7 @@ void fl_fix_focus() {
}
}
#if !(defined(WIN32) || defined(__APPLE__))
#if !(defined(WIN32) || defined(__APPLE__)) // PORTME: platform selection
extern Fl_Widget *fl_selection_requestor; // from Fl_x.cxx
#endif
@ -1230,7 +1230,7 @@ void fl_throw_focus(Fl_Widget *o) {
if (o->contains(Fl::pushed())) Fl::pushed_ = 0;
#ifdef WIN32
// not used
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: platform selection
// not used
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: platform specific code when deleting a window"
@ -1457,7 +1457,7 @@ int Fl::handle_(int e, Fl_Window* window)
if (grab()) wi = grab();
{ int ret;
Fl_Widget* pbm = belowmouse();
#ifdef __APPLE__
#ifdef __APPLE__ // bug fix
if (fl_mac_os_version < 100500) {
// before 10.5, mouse moved events aren't sent to borderless windows such as tooltips
Fl_Window *tooltip = Fl_Tooltip::current_window();
@ -1659,7 +1659,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__
#ifdef __APPLE__ // PORTME: platform pointer handling
// 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 +1708,7 @@ void Fl_Window::hide() {
if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0);
# endif
}
#elif defined(__APPLE_QUARTZ__)
#elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping
Fl_X::q_release_context(ip);
if ( ip->xid == fl_window )
fl_window = 0;
@ -1740,7 +1740,7 @@ void Fl_Window::hide() {
}
delete[] doit;
}
#elif defined(__APPLE_QUARTZ__)
#elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping
ip->destroy();
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: code to destroy a window on screen"
@ -1774,13 +1774,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__)
#elif defined(__APPLE_QUARTZ__) // PORTME: 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__
#endif // __APPLE__ // PORTME: platform window mapping
}
break;
case FL_HIDE:
@ -1798,7 +1798,7 @@ int Fl_Window::handle(int ev)
}
#if defined(USE_X11) || defined(WIN32)
XUnmapWindow(fl_display, fl_xid(this));
#elif defined(__APPLE_QUARTZ__)
#elif defined(__APPLE_QUARTZ__) // PORTME: platform window unmapping, again
i->unmap();
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: code to hide a window from screen"
@ -1966,7 +1966,7 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
Fl_Region R = XRectangleRegion(X, Y, W, H);
CombineRgn(i->region, i->region, R, RGN_OR);
XDestroyRegion(R);
#elif defined(__APPLE_QUARTZ__)
#elif defined(__APPLE_QUARTZ__) // PORTME: 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++) {
@ -2001,7 +2001,7 @@ void Fl_Window::flush() {
#ifdef WIN32
# include "Fl_win32.cxx"
//#elif defined(__APPLE__)
//#elif defined(__APPLE__) // nothing here to see
#endif

View File

@ -21,7 +21,7 @@
#include <FL/Fl.H>
#if defined(__APPLE__)
#if defined(__APPLE__) // PORTME: platform copy surface
#include <ApplicationServices/ApplicationServices.h>
Fl_Quartz_Surface_::Fl_Quartz_Surface_(int w, int h) : Fl_System_Printer(), width(w), height(h) {
@ -75,7 +75,7 @@ Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) : Fl_Surface_Device(NULL)
{
width = w;
height = h;
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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)
#if defined(__APPLE__) || defined(WIN32) // PORTME: 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__)
#if defined(__APPLE__) // PORTME: 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__
#endif // __APPLE__ // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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)

View File

@ -137,7 +137,7 @@ void Fl_Double_Window::flush(int eraseoverlay) {
#if defined(USE_X11) || defined(WIN32)
myi->other_xid = fl_create_offscreen(w(), h());
clear_damage(FL_DAMAGE_ALL);
#elif defined(__APPLE_QUARTZ__)
#elif defined(__APPLE_QUARTZ__) // PORTME: platform double buffering
if (force_doublebuffering_) {
myi->other_xid = fl_create_offscreen(w(), h());
clear_damage(FL_DAMAGE_ALL);
@ -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__)
#elif defined(__APPLE__) // PORTME: platform double buffering
if ( myi->other_xid ) {
fl_begin_offscreen( myi->other_xid );
fl_clip_region( 0 );

View File

@ -26,7 +26,7 @@
// Fl_File_Browser::filter() - Set the filename filter.
//
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: platform file browser
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the internals of your file browser here"
#else
@ -62,11 +62,11 @@
# include <os2.h>
#endif // __EMX__
#if defined(__APPLE__)
#if defined(__APPLE__) // PORTME: platform file browser
# include <sys/param.h>
# include <sys/ucred.h>
# include <sys/mount.h>
#endif // __APPLE__
#endif // __APPLE__ // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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 || ...
#endif // WIN32 || __EMX__ || __APPLE__ || _AIX || ... // PORTME: platform file browser
}
else
{

View File

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

View File

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

View File

@ -26,7 +26,7 @@
#include <config.h>
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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__)
# elif defined(__APPLE_QUARTZ__) // PORTME: 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__
#ifndef __APPLE_QUARTZ__ // PORTME: platform font stuff
char glok[64];
#endif // __APPLE_QUARTZ__
#endif // __APPLE_QUARTZ__ // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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);

View File

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

View File

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

View File

@ -24,14 +24,14 @@
#include <FL/Fl_RGB_Image.H>
#include "FL/Fl.H"
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__)
#if defined(__APPLE__) // PORTME: 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__)
#if defined(__APPLE__) // PORTME: 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__)
#if defined(__APPLE__) // PORTME: 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__)
#if defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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();

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@
#include <stdlib.h>
#include <ctype.h>
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // platform editor look and feel
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: manage character composing here"
#else
@ -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__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
#ifdef __APPLE__ // PORTME: Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
if (Fl::compose_state) {
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__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
#ifdef __APPLE__ // PORTME: Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
if (Fl::compose_state) {
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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: compose
Fl::insertion_point_location(xpos+curx, Y+ypos+height, height);
#endif
}

View File

@ -122,7 +122,7 @@ class menuwindow : public Fl_Menu_Window {
public:
menutitle* title;
int handle(int);
#if defined (__APPLE__) || defined (USE_X11)
#if defined (__APPLE__) || defined (USE_X11) // PORTME: 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)
#if defined (__APPLE__) || defined (USE_X11) // PORTME: 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__))
#if ! (defined(WIN32) || defined(__APPLE__)) // PORTME: menubar
if (pp.state == DONE_STATE) {
return 1; // Fix for STR #2619
}

View File

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

View File

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

View File

@ -61,7 +61,7 @@ Fl_PostScript_Graphics_Driver::~Fl_PostScript_Graphics_Driver() {
*/
Fl_PostScript_File_Device::Fl_PostScript_File_Device(void)
{
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: platform PostScript
gc = fl_gc; // the display context is used by fl_text_extents()
#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) )
#if ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: 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__)
#if defined(__APPLE__) // PORTME: 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) )
#endif // ! (defined(__APPLE__) || defined(WIN32) ) // PORTME: platform PostScript
//

View File

@ -29,7 +29,7 @@
#include <sys/stat.h>
#include <time.h>
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__)
#elif defined (__APPLE__) // PORTME: platform Preferences
# include <ApplicationServices/ApplicationServices.h>
# include <unistd.h>
# include <config.h>
@ -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__
#ifdef __APPLE__ // PORTME: 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__ )
#elif defined ( __APPLE__ ) // PORTME: 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))
#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: 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))
#if !(defined(__APPLE__) || defined(WIN32)) // PORTME: 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

View File

@ -66,7 +66,7 @@ const char *Fl_Printer::property_cancel = NULL;
#else
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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)
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) // PORTME: 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)
#if defined(__APPLE__) || defined(WIN32) // PORTME: platform printing
void Fl_System_Printer::set_current(void)
{
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: 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__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: platform printing
printer = new Fl_System_Printer();
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the printer device specifics"

View File

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

View File

@ -31,7 +31,7 @@
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Window.H>
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE__ // PORTME: platform compose
if (Fl::compose_state) background = color();// Mac OS: underline marked text
else
#endif
@ -2181,18 +2181,18 @@ 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
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT // PORTME: platform editor feel
// makes sure antialiased ÄÖÜ do not leak on line above
fl_push_clip(X, Y, toX - X, mMaxsize);
#endif
fl_draw( string, nChars, X, Y + mMaxsize - fl_descent());
#ifdef __APPLE__ // Mac OS: underline marked (= selected + Fl::compose_state != 0) text
#ifdef __APPLE__ // Mac OS: underline marked (= selected + Fl::compose_state != 0) text // PORTME: platform editor feel
if (Fl::compose_state && (style & PRIMARY_MASK)) {
fl_color( fl_color_average(foreground, background, 0.6) );
fl_line(X, Y + mMaxsize - 1, X + fl_width(string, nChars), Y + mMaxsize - 1);
}
#endif
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT // PORTME: platform editor feel
fl_pop_clip();
#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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: platform compose
Fl_X::dnd(1);
#else
Fl::dnd();

View File

@ -25,7 +25,7 @@
#include <FL/Fl_Text_Editor.H>
#include <FL/fl_ask.H>
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__
#endif // __APPLE__ // PORTME: platform editor feel
{ 0, 0, 0 }
};
@ -543,7 +543,7 @@ int Fl_Text_Editor::handle_key() {
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
}
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: platform compose
if (Fl::compose_state) {
int pos = this->insert_position();
this->buffer()->select(pos - Fl::compose_state, pos);
@ -586,7 +586,7 @@ int Fl_Text_Editor::handle(int event) {
case FL_UNFOCUS:
show_cursor(mCursorOn); // redraws the cursor
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: platform compose
if (buffer()->selected() && Fl::compose_state) {
int pos = insert_position();
buffer()->select(pos, pos);

View File

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

View File

@ -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__)
#if defined(USE_X11) || defined(__APPLE_QUARTZ__) // PORTME: 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);

View File

@ -28,7 +28,7 @@
// These can be replaced via prefs.openicon()/closeicon()
//
static const char * const L_open_xpm[] = {
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: 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__ */
#else /* __APPLE__ */ // PORTME: 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__ */
#endif /* __APPLE__ */ // PORTME: platform look and feel
};
static Fl_Pixmap L_openpixmap(L_open_xpm);
static const char * const L_close_xpm[] = {
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: 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__ */
#else /* __APPLE__ */ // PORTME: 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__ */
#endif /* __APPLE__ */ // PORTME: 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__
#ifdef __APPLE__ // PORTME: platform look and feel
_connectorstyle = FL_TREE_CONNECTOR_NONE;
#else /* __APPLE__ */
_connectorstyle = FL_TREE_CONNECTOR_DOTTED;

View File

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

View File

@ -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__)
#elif defined(__APPLE_QUARTZ__) // PORTME: platform window driver
// warning: not implemented in Quartz/Carbon
#elif defined(FL_PORTING)
# pragma message "handle window border setting"

View File

@ -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__)
#elif defined(__APPLE__) // PORTME: platform window driver
top = 24;
left = 2;
right = 2;

View File

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

View File

@ -24,7 +24,7 @@
#include <FL/Fl_Pixmap.H>
#include <string.h>
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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 <malloc.h> // needed for VisualC2010
#elif !defined(__APPLE__)
#elif !defined(__APPLE__) // PORTME: platform window driver
#include <config.h>
#if HAVE_DLFCN_H
#include <dlfcn.h>
@ -42,7 +42,7 @@
#endif
#if defined(__APPLE__)
#if defined(__APPLE__) // PORTME: 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__
#endif // __APPLE__ // PORTME: platform window driver
void Fl_Window::shape_bitmap_(Fl_Image* b) {
shape_data_->shape_ = b;
#if defined(__APPLE__)
#if defined(__APPLE__) // PORTME: 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
#if defined(__APPLE__) // on the mac, use an 8-bit mask // PORTME: 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__)
#if defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE_QUARTZ__ // PORTME: platform window driver
// on OS X, windows have no frame. Before OS X 10.7, to resize a window, we drag the lower right
// corner. This code draws a little ribbed triangle for dragging.
if (fl_mac_os_version < 100700 && fl_gc && !parent() && resizable() &&

View File

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

View File

@ -28,13 +28,13 @@
#include <ctype.h>
#include "flstring.h"
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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)
#if defined(WIN32) || defined(__APPLE__) || defined(FL_PORTING) // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__
#endif // __APPLE__ // PORTME: 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__)
#if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform command line
} else if (fl_match(s, "display", 2)) {
Fl::display(v);
#endif
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: platform command line
// Xcode in MacOS X may pass "-NSDocumentRevisionsDebugMode YES"
} else if (strcmp(s, "NSDocumentRevisionsDebugMode") == 0) {
// nothing to do
#endif // __APPLE__
#endif // __APPLE__ // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: platform default parameters
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: Parse additional default settings"
#else // X11
@ -327,7 +327,7 @@ void Fl_Window::show(int argc, char **argv) {
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
strcasecmp(val, "on") == 0 ||
strcasecmp(val, "yes") == 0);
#endif // !WIN32 && !__APPLE__
#endif // !WIN32 && !__APPLE__ // PORTME: platform defaults
// set colors first, so background_pixel is correct:
static char beenhere;
@ -367,7 +367,7 @@ void Fl_Window::show(int argc, char **argv) {
show();
#if defined(WIN32)
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: 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__
#endif // !WIN32 && !__APPLE__ // PORTME: 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__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: platform command line arguments
/* the following function was stolen from the X sources as indicated. */

View File

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

View File

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

View File

@ -30,7 +30,7 @@
and does nothing useful under WIN32.
*/
void Fl::display(const char *d) {
#if defined(__APPLE__) || defined(WIN32)
#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"
@ -45,7 +45,7 @@ void Fl::display(const char *d) {
}
}
putenv(e);
#endif // __APPLE__
#endif // __APPLE__ // PORTME: platform screen stuff
}
//

View File

@ -18,7 +18,7 @@
#ifdef WIN32
# include "Fl_get_key_win32.cxx"
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: 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"

View File

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

View File

@ -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__)
#elif defined(__APPLE__) // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: platform focus grabbing
fl_capture = 0;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement event grabbing"

View File

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

View File

@ -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__)
#elif defined(__APPLE__) // PORTME: platform visuals
// \todo Mac : need to implement Visual flags
int Fl::visual(int flags) {

View File

@ -18,7 +18,7 @@
#ifdef WIN32
//# include "Fl_win32.cxx"
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: platform 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"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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__)
#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__) // PORTME: filename stuff
else if (tolower(*slash & 255) != tolower(*newslash & 255)) break;
#else
else if (*slash != *newslash) break;
#endif // WIN32 || __EMX__ || __APPLE__
#endif // WIN32 || __EMX__ || __APPLE__ // PORTME: filename stuff
// skip over trailing slashes
if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash)

View File

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

View File

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

View File

@ -22,12 +22,12 @@
#include <FL/fl_utf8.h>
#include "flstring.h"
#include <stdlib.h>
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: directory stuff
#include <FL/x.H>
#endif
#ifdef WIN32
#elif defined(__APPLE__)
#elif defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__)
#elif defined(HAVE_SCANDIR_POSIX) && !defined(__APPLE__) // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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__
#ifndef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: directory stuff
strcpy(newde->d_name, de->d_name);
#else
fl_utf8from_mb(newde->d_name, newlen + 1, de->d_name, len);

View File

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

View File

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

View File

@ -38,7 +38,7 @@
#include <stdio.h>
#include "flstring.h"
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE_QUARTZ__ // PORTME: 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__
#endif // __APPLE_QUARTZ__ // PORTME: 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__
#ifdef __APPLE_QUARTZ__ // PORTME: platform pixmap
}
#endif
delete[] buffer;

View File

@ -21,7 +21,7 @@
#include <stdlib.h>
#include "flstring.h"
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: 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

View File

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

View File

@ -31,7 +31,7 @@
// all driver code is now in drivers/XXX/Fl_XXX_Graphics_Driver_xyz.cxx
// -----------------------------------------------------------------------------
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: platform font stuff
#elif defined(FL_PORTING)
# 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__
#ifdef __APPLE__ // PORTME: platform alternative API
fl_graphics_driver->draw(str, l, x, y);
#else
fl_draw(str, l, (int)x, (int)y);

View File

@ -45,9 +45,9 @@
// Local functions...
//
#if !defined(WIN32) && !defined(__APPLE__)
#if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform open doc
static char *path_find(const char *program, char *filename, int filesize);
#endif // !WIN32 && !__APPLE__
#endif // !WIN32 && !__APPLE__ // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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__
#else // !WIN32 && !__APPLE__ // PORTME: 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__)
#if !defined(WIN32) && !defined(__APPLE__) // PORTME: 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__
#endif // !WIN32 && !__APPLE__ // PORTME: platform open doc
#ifndef WIN32

View File

@ -23,7 +23,7 @@
#include <FL/x.H>
#include <FL/fl_draw.H>
#ifdef __APPLE__
#ifdef __APPLE__ // PORTME: platform overlay
#include <config.h>
#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__)
# elif defined(__APPLE_QUARTZ__) // PORTME: 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__
# ifdef __APPLE_QUARTZ__ // PORTME: platform overlay
fl_rect(px, py, pw, ph);
# else
draw_current_rect();

View File

@ -25,14 +25,14 @@
# include <stdio.h>
#endif // DEBUG
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__)
#if defined(__APPLE__) // PORTME: platform screenshots
# include "fl_read_image_mac.cxx"
#else
# include <FL/Fl_RGB_Image.H>
@ -108,7 +108,7 @@ static Fl_RGB_Image *traverse_to_gl_subwindows(Fl_Group *g, uchar *p, int x, int
if (full_img) g->as_window()->make_current();
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__
#ifdef __APPLE_CC__ // PORTME: 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__
#endif // !__APPLE__ // PORTME: platform screenshots
//
// End of "$Id$".

View File

@ -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__)
#elif defined(__APPLE_QUARTZ__) // PORTME: platform scrolling
CGImageRef img = Fl_X::CGImage_from_window_rect(Fl_Window::current(), src_x, src_y, src_w, src_h);
if (img) {
CGRect rect = CGRectMake(dest_x, dest_y, src_w, src_h);

View File

@ -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__
#ifdef __APPLE__ // PORTME: 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__
#endif // !WIN32 && !__APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: platform fonts
if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts();
#endif
return fl_fonts[fnum].name;

View File

@ -38,11 +38,11 @@
#include <FL/fl_draw.H>
#include <ctype.h>
#include "flstring.h"
#if !defined(WIN32) && !defined(__APPLE__)
#if !defined(WIN32) && !defined(__APPLE__) // PORTME: platform keyboard feel
#include <FL/x.H>
#endif
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) // PORTME: 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__)
#elif defined(__APPLE__) // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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__
#endif // __APPLE__ // PORTME: platform keyboard feel
if (eom) *eom = p;
unsigned int key = shortcut & FL_KEY_MASK;
#if defined(WIN32) || defined(__APPLE__) // if not X
#if defined(WIN32) || defined(__APPLE__) // if not X // PORTME: platform keyboard feel
if (key >= FL_F && key <= FL_F_Last) {
*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__
#ifdef __APPLE__ // PORTME: 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__
#ifdef __APPLE__ // PORTME: 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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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