diff --git a/FL/Fl.H b/FL/Fl.H index 9c472a29b..b8f606d15 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -25,7 +25,7 @@ #include -#include // for FL_SOCKET +#include // for FL_SOCKET #ifdef FLTK_HAVE_CAIRO # include #endif @@ -50,6 +50,7 @@ class Fl_Window; class Fl_Image; struct Fl_Label; class Fl_Screen_Driver; +class Fl_System_Driver; // Pointers you can use to change FLTK to a foreign language. // Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H index 32796b386..4a6b4e2fc 100644 --- a/FL/Fl_System_Driver.H +++ b/FL/Fl_System_Driver.H @@ -24,8 +24,8 @@ #ifndef FL_SYSTEM_DRIVER_H #define FL_SYSTEM_DRIVER_H +#include #include -#include #include #include #include @@ -202,6 +202,10 @@ public: virtual int clipboard_contains(const char *type) {return 0;} // implement to support paste-from-clipboard virtual void clipboard_notify_change() {} + virtual void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); + virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0); + virtual void remove_fd(int, int when); + virtual void remove_fd(int); }; #endif // FL_SYSTEM_DRIVER_H diff --git a/FL/porting.H b/FL/porting.H index 8bc02ad48..26504b77c 100644 --- a/FL/porting.H +++ b/FL/porting.H @@ -43,19 +43,6 @@ typedef void *Fl_Offscreen; struct XPoint { int x, y; }; struct XRectangle {int x, y, width, height;}; -//typedef float CGFloat; - -inline Fl_Region XRectangleRegion(int x, int y, int w, int h) { - // write code here - return 0L; -} - -inline void XDestroyRegion(Fl_Region r) { - // write code here -} - -extern void *fl_default_cursor; - inline void fl_open_callback(void (*)(const char *)) {} // This object contains all platform-specific stuff about a window: diff --git a/src/Fl.cxx b/src/Fl.cxx index 534a7d8e0..b964614a0 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1939,6 +1939,27 @@ int Fl::clipboard_contains(const char *type) return Fl::system_driver()->clipboard_contains(type); } + +void Fl::add_fd(int fd, int when, Fl_FD_Handler cb, void *d) +{ + Fl::system_driver()->add_fd(fd, when, cb, d); +} + +void Fl::add_fd(int fd, Fl_FD_Handler cb, void *d) +{ + Fl::system_driver()->add_fd(fd, cb, d); +} + +void Fl::remove_fd(int fd, int when) +{ + Fl::system_driver()->remove_fd(fd, when); +} + +void Fl::remove_fd(int fd) +{ + Fl::system_driver()->remove_fd(fd); +} + /** Enables the system input methods facilities. This is the default. \see disable_im() diff --git a/src/Fl_System_Driver.cxx b/src/Fl_System_Driver.cxx index 9c34194fe..ca94789f6 100644 --- a/src/Fl_System_Driver.cxx +++ b/src/Fl_System_Driver.cxx @@ -411,6 +411,27 @@ int Fl_System_Driver::file_type(const char *filename) return Fl_File_Icon::ANY; } +void Fl_System_Driver::add_fd(int fd, int when, Fl_FD_Handler cb, void *d) +{ + // nothing to do, reimplement in driver if needed +} + +void Fl_System_Driver::add_fd(int fd, Fl_FD_Handler cb, void *d) +{ + // nothing to do, reimplement in driver if needed +} + +void Fl_System_Driver::remove_fd(int fd, int when) +{ + // nothing to do, reimplement in driver if needed +} + +void Fl_System_Driver::remove_fd(int fd) +{ + // nothing to do, reimplement in driver if needed +} + + // // End of "$Id$". // diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index e2c4046da..54c78c24a 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -426,22 +426,22 @@ void DataReady::CancelThread(const char *reason) DataUnlock(); } -void Fl::add_fd( int n, int events, void (*cb)(int, void*), void *v ) +void Fl_Darwin_System_Driver::add_fd( int n, int events, void (*cb)(int, void*), void *v ) { dataready.AddFD(n, events, cb, v); } -void Fl::add_fd(int fd, void (*cb)(int, void*), void* v) +void Fl_Darwin_System_Driver::add_fd(int fd, void (*cb)(int, void*), void* v) { dataready.AddFD(fd, POLLIN, cb, v); } -void Fl::remove_fd(int n, int events) +void Fl_Darwin_System_Driver::remove_fd(int n, int events) { dataready.RemoveFD(n, events); } -void Fl::remove_fd(int n) +void Fl_Darwin_System_Driver::remove_fd(int n) { dataready.RemoveFD(n, -1); } diff --git a/src/Fl_lock.cxx b/src/Fl_lock.cxx index da30a61e6..fe651804b 100644 --- a/src/Fl_lock.cxx +++ b/src/Fl_lock.cxx @@ -18,15 +18,18 @@ #include "config_lib.h" #include +#include #include +// FIXME: why do we need the lines below? #if defined(FL_CFG_SYS_POSIX) #include "drivers/Posix/Fl_Posix_System_Driver.H" #elif defined(FL_CFG_SYS_WIN32) #include "drivers/WinAPI/Fl_WinAPI_System_Driver.H" #endif + /* From Bill: diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 4e9030cd3..c96da78db 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -294,7 +294,7 @@ void fl_set_status(int x, int y, int w, int h) { } -void Fl::add_fd(int n, int events, void (*cb)(FL_SOCKET, void*), void *v) { +void Fl_WinAPI_System_Driver::add_fd(int n, int events, void (*cb)(FL_SOCKET, void*), void *v) { remove_fd(n,events); int i = nfds++; if (i >= fd_array_size) { @@ -312,11 +312,11 @@ void Fl::add_fd(int n, int events, void (*cb)(FL_SOCKET, void*), void *v) { if (n > maxfd) maxfd = n; } -void Fl::add_fd(int fd, void (*cb)(FL_SOCKET, void*), void* v) { +void Fl_WinAPI_System_Driver::add_fd(int fd, void (*cb)(FL_SOCKET, void*), void* v) { Fl::add_fd(fd, FL_READ, cb, v); } -void Fl::remove_fd(int n, int events) { +void Fl_WinAPI_System_Driver::remove_fd(int n, int events) { int i,j; for (i=j=0; i= fd_array_size) { @@ -151,11 +151,11 @@ void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) { # endif } -void Fl::add_fd(int n, void (*cb)(int, void*), void* v) { +void Fl_X11_System_Driver::add_fd(int n, void (*cb)(int, void*), void* v) { Fl::add_fd(n, POLLIN, cb, v); } -void Fl::remove_fd(int n, int events) { +void Fl_X11_System_Driver::remove_fd(int n, int events) { int i,j; # if !USE_POLL maxfd = -1; // recalculate maxfd on the fly @@ -192,7 +192,7 @@ void Fl::remove_fd(int n, int events) { # endif } -void Fl::remove_fd(int n) { +void Fl_X11_System_Driver::remove_fd(int n) { remove_fd(n, -1); } diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index b7971453d..951ceba1c 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -72,6 +72,10 @@ public: virtual void copy(const char *stuff, int len, int clipboard, const char *type); virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); virtual int clipboard_contains(const char *type); + virtual void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); + virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0); + virtual void remove_fd(int, int when); + virtual void remove_fd(int); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/Pico/Fl_Pico_System_Driver.H b/src/drivers/Pico/Fl_Pico_System_Driver.H index 8b1378917..aae71e0d0 100644 --- a/src/drivers/Pico/Fl_Pico_System_Driver.H +++ b/src/drivers/Pico/Fl_Pico_System_Driver.H @@ -1 +1,38 @@ +// +// "$Id: Fl_Pico_System_Driver.H 11017 2016-01-20 21:40:12Z matt $" +// +// Definition of Pico system driver +// for the Fast Light Tool Kit (FLTK). +// +// Copyright 2010-2016 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// http://www.fltk.org/COPYING.php +// +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php +// +#ifndef FL_PICO_SYSTEM_DRIVER_H +#define FL_PICO_SYSTEM_DRIVER_H + +#include + +class Fl_Pico_System_Driver : public Fl_System_Driver { +public: + Fl_Pico_System_Driver() : Fl_System_Driver() {} + virtual void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); + virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0); + virtual void remove_fd(int, int when); + virtual void remove_fd(int); +}; + +#endif /* FL_PICO_SYSTEM_DRIVER_H */ + +// +// End of "$Id: Fl_Pico_System_Driver.H 11017 2016-01-20 21:40:12Z matt $". +// diff --git a/src/drivers/Pico/Fl_Pico_System_Driver.cxx b/src/drivers/Pico/Fl_Pico_System_Driver.cxx index 8b1378917..16f0a27e5 100644 --- a/src/drivers/Pico/Fl_Pico_System_Driver.cxx +++ b/src/drivers/Pico/Fl_Pico_System_Driver.cxx @@ -1 +1,26 @@ +// +// "$Id: Fl_Pico_System_Driver.cxx 11017 2016-01-20 21:40:12Z matt $" +// +// Definition of Pico system driver +// for the Fast Light Tool Kit (FLTK). +// +// Copyright 2010-2016 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// http://www.fltk.org/COPYING.php +// +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php +// +#include "Fl_Pico_System_Driver.H" +#include "../../flstring.h" + + +// +// End of "$Id: Fl_Pico_System_Driver.H 11017 2016-01-20 21:40:12Z matt $". +// diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx index ef42bacbe..0560d8e7c 100644 --- a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx +++ b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx @@ -63,7 +63,7 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait) Fl_X *i = Fl_X::i(Fl::first_window()); wd->wait_for_expose_value = 0; if ( i->region ) { - XDestroyRegion(i->region); + fl_graphics_driver->XDestroyRegion(i->region); i->region = 0; } window->clear_damage(FL_DAMAGE_ALL); @@ -155,16 +155,8 @@ Fl_X* Fl_X::make(Fl_Window *w) return w->driver()->makeWindow(); } -char fl_show_iconic; Window fl_window; -void Fl::add_fd(int, Fl_FD_Handler, void*) -{ -} - -void Fl::remove_fd(int) -{ -} // // End of "$Id: Fl_PicoSDL_Screen_Driver.cxx 11253 2016-03-01 00:54:21Z matt $". diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H index ce6a9d5c0..c5b65bbbf 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H @@ -112,6 +112,10 @@ public: virtual int clipboard_contains(const char *type); // this one is implemented in Fl_win32.cxx virtual void clipboard_notify_change(); + virtual void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); + virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0); + virtual void remove_fd(int, int when); + virtual void remove_fd(int); }; #endif // FL_WINAPI_SYSTEM_DRIVER_H diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H index 085dc1790..d11732cab 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.H +++ b/src/drivers/X11/Fl_X11_System_Driver.H @@ -55,6 +55,10 @@ public: virtual int clipboard_contains(const char *type); // this one is in Fl_x.cxx virtual void clipboard_notify_change(); + virtual void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); + virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0); + virtual void remove_fd(int, int when); + virtual void remove_fd(int); }; #endif /* FL_X11_SYSTEM_DRIVER_H */ diff --git a/src/filename_list.cxx b/src/filename_list.cxx index 461d4314f..cd1f1d4df 100644 --- a/src/filename_list.cxx +++ b/src/filename_list.cxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include "flstring.h" #include diff --git a/src/fl_open_uri.cxx b/src/fl_open_uri.cxx index d2a4d9f34..24b2e3abf 100644 --- a/src/fl_open_uri.cxx +++ b/src/fl_open_uri.cxx @@ -27,6 +27,7 @@ #include "config_lib.h" #include #include +#include #include #include #include "flstring.h"