diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-02-03 07:03:26 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-02-03 07:03:44 +0100 |
| commit | 2e6e0b9c36fbf92d0d551aca077580e7a57c266a (patch) | |
| tree | 206ba84e89b8624f4377c4f9b90862ea892f9cc7 /src/drivers | |
| parent | d9451a86696a2aa58d46cb18180c9344a5e0c179 (diff) | |
Reorganize classes Fl_System_Driver and Fl_Screen_Driver
These virtual members are moved from Fl_Screen_Driver to Fl_System_Driver
- wait(double)
- ready()
These virtual members are moved from Fl_System_Driver to Fl_Screen_Driver
- copy(const char *stuff, int len, int clipboard, const char *type)
- void paste(Fl_Widget &widget, int clipboard, const char *type)
- clipboard_contains(const char *type)
- clipboard_notify_change()
These members are moved from Fl_X11_Screen_Driver to Fl_X11_System_Driver
- poll_or_select_with_delay(double time_to_wait)
- poll_or_select()
and are made virtual in preparation for the introduction of class
Fl_Unix_System_Driver.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 5 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 5 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H | 10 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_System_Driver.H | 10 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.H | 12 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.cxx | 28 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.H | 13 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 27 |
8 files changed, 55 insertions, 55 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 7dd6fc14a..74e1a8123 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -75,8 +75,6 @@ public: // --- audible output virtual void beep(int type); // --- global events - virtual double wait(double time_to_wait); - virtual int ready(); virtual void grab(Fl_Window* win); // --- global colors virtual void get_system_colors(); @@ -99,6 +97,9 @@ public: virtual void scale(int /*nscreen*/, float f) { scale_ = f;} virtual Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win, bool may_capture_subwins, bool *did_capture_subwins); virtual void default_icons(const Fl_RGB_Image *icons[], int count); + 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); private: float scale_; }; diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index 8a2e3b7f6..19b4dab2d 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -73,9 +73,6 @@ public: static const char * const tree_close_xpm_darwin[]; // used by tree_closepixmap() virtual int tree_connector_style(); virtual const char *filename_name(const char *buf); - 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); @@ -86,6 +83,8 @@ public: virtual const char *alt_name(); virtual const char *control_name(); virtual Fl_Sys_Menu_Bar_Driver *sys_menu_bar_driver(); + virtual double wait(double time_to_wait); + virtual int ready(); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H index c621f7e5e..6754396ff 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H @@ -61,8 +61,6 @@ public: virtual void beep(int type); // --- global events virtual void flush(); - virtual double wait(double time_to_wait); - virtual int ready(); virtual void grab(Fl_Window* win); // --- global colors virtual void get_system_colors(); @@ -86,6 +84,14 @@ public: } virtual void desktop_scale_factor(); virtual void default_icons(const Fl_RGB_Image *icons[], int count); + // this one is implemented in Fl_win32.cxx + virtual void copy(const char *stuff, int len, int clipboard, const char *type); + // this one is implemented in Fl_win32.cxx + virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); + // this one is implemented in Fl_win32.cxx + virtual int clipboard_contains(const char *type); + // this one is implemented in Fl_win32.cxx + virtual void clipboard_notify_change(); }; diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H index 60dca9d17..3e6a86648 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H @@ -107,14 +107,6 @@ public: virtual int case_insensitive_filenames() {return 1;} // this one is implemented in Fl_win32.cxx virtual const char *filename_name(const char *buf); - // this one is implemented in Fl_win32.cxx - virtual void copy(const char *stuff, int len, int clipboard, const char *type); - // this one is implemented in Fl_win32.cxx - virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); - // this one is implemented in Fl_win32.cxx - 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); @@ -123,6 +115,8 @@ public: virtual char* strdup(const char *s) { return ::_strdup(s); } virtual void lock_ring(); virtual void unlock_ring(); + virtual double wait(double time_to_wait); + virtual int ready(); }; #endif // FL_WINAPI_SYSTEM_DRIVER_H diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H index c8676f347..4b877c937 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.H +++ b/src/drivers/X11/Fl_X11_Screen_Driver.H @@ -45,8 +45,6 @@ protected: } FLScreenInfo; FLScreenInfo screens[MAX_SCREENS]; float dpi[MAX_SCREENS][2]; - int poll_or_select(); - int poll_or_select_with_delay(double time_to_wait); int get_mouse_unscaled(int &xx, int &yy); public: @@ -78,8 +76,6 @@ public: virtual void beep(int type); // --- global events virtual void flush(); - virtual double wait(double time_to_wait); - virtual int ready(); virtual void grab(Fl_Window* win); // --- global colors virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b); @@ -98,6 +94,14 @@ public: // --- compute dimensions of an Fl_Offscreen virtual void offscreen_size(Fl_Offscreen o, int &width, int &height); virtual void default_icons(const Fl_RGB_Image *icons[], int count); + // this one is in Fl_x.cxx + virtual void copy(const char *stuff, int len, int clipboard, const char *type); + // this one is in Fl_x.cxx + virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); + // this one is in Fl_x.cxx + virtual int clipboard_contains(const char *type); + // this one is in Fl_x.cxx + virtual void clipboard_notify_change(); }; diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index 3e7edf872..d033f4cb7 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -365,34 +365,6 @@ void Fl_X11_Screen_Driver::flush() } -double Fl_X11_Screen_Driver::wait(double time_to_wait) -{ - if (time_to_wait <= 0.0) { - // do flush second so that the results of events are visible: - int ret = this->poll_or_select_with_delay(0.0); - Fl::flush(); - return ret; - } else { - // do flush first so that user sees the display: - Fl::flush(); - if (Fl::idle) // 'idle' may have been set within flush() - time_to_wait = 0.0; - else { - Fl_Timeout::elapse_timeouts(); - time_to_wait = Fl_Timeout::time_to_wait(time_to_wait); - } - return this->poll_or_select_with_delay(time_to_wait); - } -} - - -int Fl_X11_Screen_Driver::ready() { - Fl_Timeout::elapse_timeouts(); - if (Fl_Timeout::time_to_wait(1.0) <= 0.0) return 1; - return this->poll_or_select(); -} - - extern void fl_fix_focus(); // in Fl.cxx diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H index 891c14d16..e39f40706 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.H +++ b/src/drivers/X11/Fl_X11_System_Driver.H @@ -54,18 +54,15 @@ public: virtual void own_colormap(); // this one is in Fl_x.cxx virtual const char *filename_name(const char *buf); - // this one is in Fl_x.cxx - virtual void copy(const char *stuff, int len, int clipboard, const char *type); - // this one is in Fl_x.cxx - virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); - // this one is in Fl_x.cxx - 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); + virtual double wait(double time_to_wait); + virtual int ready(); + // 2 additional virtual members + virtual int poll_or_select(); + virtual int poll_or_select_with_delay(double time_to_wait); }; #endif /* FL_X11_SYSTEM_DRIVER_H */ diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx index 71becad49..64cac3779 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.cxx +++ b/src/drivers/X11/Fl_X11_System_Driver.cxx @@ -20,6 +20,7 @@ #include <FL/fl_string_functions.h> // fl_strdup #include <FL/platform.H> #include "../../flstring.h" +#include "../../Fl_Timeout.h" #include <X11/Xlib.h> #include <locale.h> @@ -694,4 +695,30 @@ void Fl_X11_System_Driver::own_colormap() { #endif // USE_COLORMAP } +int Fl_X11_System_Driver::ready() { + Fl_Timeout::elapse_timeouts(); + if (Fl_Timeout::time_to_wait(1.0) <= 0.0) return 1; + return this->poll_or_select(); +} + +double Fl_X11_System_Driver::wait(double time_to_wait) +{ + if (time_to_wait <= 0.0) { + // do flush second so that the results of events are visible: + int ret = this->poll_or_select_with_delay(0.0); + Fl::flush(); + return ret; + } else { + // do flush first so that user sees the display: + Fl::flush(); + if (Fl::idle) // 'idle' may have been set within flush() + time_to_wait = 0.0; + else { + Fl_Timeout::elapse_timeouts(); + time_to_wait = Fl_Timeout::time_to_wait(time_to_wait); + } + return this->poll_or_select_with_delay(time_to_wait); + } +} + #endif // !defined(FL_DOXYGEN) |
