diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-04-19 22:45:22 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-04-19 22:45:22 +0000 |
| commit | 769d151a121ac849a365a509d644c3328738970a (patch) | |
| tree | 65aab2b83a8ca4b678088b06e8771053c10943d7 /src | |
| parent | cd4498021e9623da828b3fb8344bc4db35675efe (diff) | |
Virtualized add_fd and remove_fd into System Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11668 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl.cxx | 21 | ||||
| -rw-r--r-- | src/Fl_System_Driver.cxx | 21 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 8 | ||||
| -rw-r--r-- | src/Fl_lock.cxx | 3 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/Pico/Fl_Pico_System_Driver.H | 37 | ||||
| -rw-r--r-- | src/drivers/Pico/Fl_Pico_System_Driver.cxx | 25 | ||||
| -rw-r--r-- | src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx | 10 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_System_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.H | 4 | ||||
| -rw-r--r-- | src/filename_list.cxx | 2 | ||||
| -rw-r--r-- | src/fl_open_uri.cxx | 1 |
14 files changed, 134 insertions, 22 deletions
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 <FL/Fl.H> +#include <FL/Fl_System_Driver.H> #include <stdlib.h> +// 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<nfds; i++) { if (fd[i].fd == n) { @@ -337,7 +337,7 @@ void Fl::remove_fd(int n, int events) { if (events & FL_EXCEPT) FD_CLR(unsigned(n), &fdsets[2]); } -void Fl::remove_fd(int n) { +void Fl_WinAPI_System_Driver::remove_fd(int n) { remove_fd(n, -1); } diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index e18157a45..48062b32f 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -113,7 +113,7 @@ struct FD { static FD *fd = 0; -void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) { +void Fl_X11_System_Driver::add_fd(int n, int events, void (*cb)(int, void*), void *v) { remove_fd(n,events); int i = nfds++; if (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 <FL/Fl_System_Driver.H> + +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 <FL/filename.H> #include <FL/Fl.H> -#include <FL/platform_types.h> +#include <FL/Fl_System_Driver.H> #include <FL/fl_utf8.h> #include "flstring.h" #include <stdlib.h> 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 <FL/filename.H> #include <FL/Fl.H> +#include <FL/Fl_System_Driver.H> #include <stdio.h> #include <stdlib.h> #include "flstring.h" |
