diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/Fl.cxx | 200 | ||||
| -rw-r--r-- | src/Fl_Cairo.cxx | 58 | ||||
| -rw-r--r-- | src/Fl_Private.H | 77 | ||||
| -rw-r--r-- | src/Fl_System_Driver.H | 2 | ||||
| -rw-r--r-- | src/Fl_System_Driver.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_Window.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_add_idle.cxx | 6 | ||||
| -rw-r--r-- | src/fl_boxtype.cxx | 45 |
9 files changed, 349 insertions, 61 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f8d5299bf..63445bf48 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -189,10 +189,17 @@ if(FLTK_HAVE_CAIRO) # FLTK_OPTION_CAIRO_WINDOW or FLTK_OPTION_CAIRO_EXT list(APPEND CPPFILES Fl_Cairo.cxx) endif() -# find all header files in source directory <FL/...> +# find all header files in includes directory <FL/...> file(GLOB HEADER_FILES "../FL/*.[hH]" + "../FL/core/*.[hH]" +) + +# find all private header files in source directory "src/..." +file(GLOB + PRIVATE_HEADER_FILES + "*.[hH]" ) # add generated header files in build directory @@ -409,6 +416,7 @@ else() endif(FLTK_USE_X11 AND NOT FLTK_USE_WAYLAND) source_group("Header Files" FILES ${HEADER_FILES}) +source_group("Private Header Files" FILES ${PRIVATE_HEADER_FILES}) source_group("Driver Source Files" FILES ${DRIVER_FILES}) source_group("Driver Header Files" FILES ${DRIVER_HEADER_FILES}) @@ -622,7 +630,7 @@ endif() # prepare source files for shared and static FLTK libraries set(SHARED_FILES ${CPPFILES} ${MMFILES} ${CFILES} ${PSFILES}) -list(APPEND SHARED_FILES ${HEADER_FILES} ${DRIVER_HEADER_FILES}) +list(APPEND SHARED_FILES ${HEADER_FILES} ${PRIVATE_HEADER_FILES} ${DRIVER_HEADER_FILES}) set(STATIC_FILES ${SHARED_FILES}) diff --git a/src/Fl.cxx b/src/Fl.cxx index ca0676f62..22ad0353a 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -18,7 +18,7 @@ Implementation of the member functions of class Fl. */ -#include <FL/Fl.H> +#include "Fl_Private.H" #include <FL/platform.H> #include "Fl_Screen_Driver.H" #include "Fl_Window_Driver.H" @@ -71,10 +71,10 @@ void *Fl::e_clipboard_data = NULL; Fl_Event_Dispatch Fl::e_dispatch = 0; Fl_Callback_Reason Fl::callback_reason_ = FL_REASON_UNKNOWN; -unsigned char Fl::options_[] = { 0, 0 }; -unsigned char Fl::options_read_ = 0; +unsigned char Fl::Private::options_[] = { 0, 0 }; +unsigned char Fl::Private::options_read_ = 0; -int Fl::selection_to_clipboard_ = 0; +int Fl::Private::selection_to_clipboard_ = 0; Fl_Window *fl_xfocus = NULL; // which window X thinks has focus Fl_Window *fl_xmousewin; // which window X thinks has FL_ENTER @@ -86,6 +86,45 @@ Fl_Window *Fl::modal_; // topmost modal() window char const * const Fl::clipboard_plain_text = "text/plain"; char const * const Fl::clipboard_image = "image"; +/** + Copies selections on X11 directly to the clipboard if enabled. + + This method can be called on all platforms. Other platforms than X11 are + not affected by this feature. + + If this is switched on (\p mode = 1), Fl::copy() copies all data to the + clipboard regardless of its \p destination argument. If the destination is 0 + (selection buffer) data is copied to both the selection buffer and the clipboard. + + Drag and drop is also affected since drag-and-drop data is copied to the selection + buffer. + + You can use this to make the experience of data selection and copying more like + that on other platforms (Windows, macOS, and even Wayland). + + The default operation mode is the standard X11 behavior (disabled). + + \note This feature is experimental and enabling it may have unexpected side effects. + It is your own responsibility if you enable it. + + \since 1.4.0 + + \param[in] mode 1 = enable selection_to_clipboard, 0 = disable selection_to_clipboard + + \see copy(const char *, int, int, const char *) +*/ +void Fl::selection_to_clipboard(int mode) { + Private::selection_to_clipboard_ = mode ? 1 : 0; +} + +/** + \brief Returns the current selection_to_clipboard mode. + + \see void selection_to_clipboard(int) +*/ +int Fl::selection_to_clipboard() { + return Private::selection_to_clipboard_; +} // // Drivers @@ -500,7 +539,7 @@ int Fl::has_check(Fl_Timeout_Handler cb, void *argp) { return 0; } -void Fl::run_checks() +void Fl::Private::run_checks() { // checks are a bit messy so that add/remove and wait may be called // from inside them without causing an infinite loop: @@ -580,7 +619,23 @@ void fl_trigger_clipboard_notify(int source) { //////////////////////////////////////////////////////////////// // idle/wait/run/check/ready: -void (*Fl::idle_)(); // see Fl::add_idle.cxx for the add/remove functions +void (*Fl::Private::idle_)(); // see Fl::add_idle.cxx for the add/remove functions + +/** + Returns whether at least one idle callback is currently set. + + \c true means that at least one callback is currently queued, but + not necessarily active. While a callback is being executed, it is + also counted as "set" unless (i.e. before) it removes itself from + the idle callback queue (ring). + + \return whether an idle callback is currently set + \retval true At least one idle callback is currently set. + \retval false No idle callback is currently set. + */ +bool Fl::idle() { + return (Private::idle_ != nullptr); +} /* Private, undocumented method to run idle callbacks. @@ -598,7 +653,7 @@ void (*Fl::idle_)(); // see Fl::add_idle.cxx for the add/remove functions the first idle callback and appends it to the end of the list of idle callbacks. For details see static function call_idle() in Fl_add_idle.cxx. - If it is NULL then no idle callbacks are active and Fl::run_idle() returns + If it is NULL then no idle callbacks are active and Fl::Private::run_idle() returns immediately. Note: idle callbacks can be queued in nested FLTK event loops like @@ -609,11 +664,11 @@ void (*Fl::idle_)(); // see Fl::add_idle.cxx for the add/remove functions if an event (timeout or button click etc.) handler calls Fl::add_idle() or even in Fl::flush() if a draw() method calls Fl::add_idle(). */ -void Fl::run_idle() { +void Fl::Private::run_idle() { static char in_idle; - if (Fl::idle_ && !in_idle) { + if (Fl::Private::idle_ && !in_idle) { in_idle = 1; - Fl::idle_(); // call the idle callback stored in Fl::idle_ == Fl::idle() + Fl::Private::idle_(); // call the idle callback stored in Fl::Private::idle_ == Fl::idle() in_idle = 0; } } @@ -733,7 +788,27 @@ void Fl::hide_all_windows() { } } -int Fl::program_should_quit_ = 0; +int Fl::Private::program_should_quit_ = 0; + +/** Returns non-zero when a request for program termination was received and accepted. + On the MacOS platform, the "Quit xxx" item of the application menu is such a request, + that is considered accepted when all windows are closed. On other platforms, this function + returns 0 until \p Fl::program_should_quit(1) is called. + \version 1.4.0 + */ +int Fl::program_should_quit() { + return Private::program_should_quit_; +} + +/** Indicate to the FLTK library whether a program termination request was received and accepted. + A program may set this to 1, for example, while performing a platform-independent command asking the program to cleanly + terminate, similarly to the "Quit xxx" item of the application menu under MacOS. + \version 1.4.0 + */ +void Fl::program_should_quit(int should_i) { + Private::program_should_quit_ = should_i; +} + //////////////////////////////////////////////////////////////// // Window list management: @@ -2046,74 +2121,74 @@ void Fl::clear_widget_pointer(Fl_Widget const *w) */ bool Fl::option(Fl_Option opt) { - if (!options_read_) { + if (!Private::options_read_) { int tmp; { // first, read the system wide preferences Fl_Preferences prefs(Fl_Preferences::CORE_SYSTEM, "fltk.org", "fltk"); Fl_Preferences opt_prefs(prefs, "options"); opt_prefs.get("ArrowFocus", tmp, 0); // default: off - options_[OPTION_ARROW_FOCUS] = tmp; + Private::options_[OPTION_ARROW_FOCUS] = tmp; //opt_prefs.get("NativeFilechooser", tmp, 1); // default: on - //options_[OPTION_NATIVE_FILECHOOSER] = tmp; + //Private::options_[OPTION_NATIVE_FILECHOOSER] = tmp; //opt_prefs.get("FilechooserPreview", tmp, 1); // default: on - //options_[OPTION_FILECHOOSER_PREVIEW] = tmp; + //Private::options_[OPTION_FILECHOOSER_PREVIEW] = tmp; opt_prefs.get("VisibleFocus", tmp, 1); // default: on - options_[OPTION_VISIBLE_FOCUS] = tmp; + Private::options_[OPTION_VISIBLE_FOCUS] = tmp; opt_prefs.get("DNDText", tmp, 1); // default: on - options_[OPTION_DND_TEXT] = tmp; + Private::options_[OPTION_DND_TEXT] = tmp; opt_prefs.get("ShowTooltips", tmp, 1); // default: on - options_[OPTION_SHOW_TOOLTIPS] = tmp; + Private::options_[OPTION_SHOW_TOOLTIPS] = tmp; opt_prefs.get("FNFCUsesGTK", tmp, 1); // default: on - options_[OPTION_FNFC_USES_GTK] = tmp; + Private::options_[OPTION_FNFC_USES_GTK] = tmp; opt_prefs.get("PrintUsesGTK", tmp, 1); // default: on - options_[OPTION_PRINTER_USES_GTK] = tmp; + Private::options_[OPTION_PRINTER_USES_GTK] = tmp; opt_prefs.get("ShowZoomFactor", tmp, 1); // default: on - options_[OPTION_SHOW_SCALING] = tmp; + Private::options_[OPTION_SHOW_SCALING] = tmp; opt_prefs.get("UseZenity", tmp, 0); // default: off - options_[OPTION_FNFC_USES_ZENITY] = tmp; + Private::options_[OPTION_FNFC_USES_ZENITY] = tmp; opt_prefs.get("UseKdialog", tmp, 0); // default: off - options_[OPTION_FNFC_USES_KDIALOG] = tmp; + Private::options_[OPTION_FNFC_USES_KDIALOG] = tmp; opt_prefs.get("SimpleZoomShortcut", tmp, 0); // default: off - options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp; + Private::options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp; } { // next, check the user preferences // override system options only, if the option is set ( >= 0 ) Fl_Preferences prefs(Fl_Preferences::CORE_USER, "fltk.org", "fltk"); Fl_Preferences opt_prefs(prefs, "options"); opt_prefs.get("ArrowFocus", tmp, -1); - if (tmp >= 0) options_[OPTION_ARROW_FOCUS] = tmp; + if (tmp >= 0) Private::options_[OPTION_ARROW_FOCUS] = tmp; //opt_prefs.get("NativeFilechooser", tmp, -1); - //if (tmp >= 0) options_[OPTION_NATIVE_FILECHOOSER] = tmp; + //if (tmp >= 0) Private::options_[OPTION_NATIVE_FILECHOOSER] = tmp; //opt_prefs.get("FilechooserPreview", tmp, -1); - //if (tmp >= 0) options_[OPTION_FILECHOOSER_PREVIEW] = tmp; + //if (tmp >= 0) Private::options_[OPTION_FILECHOOSER_PREVIEW] = tmp; opt_prefs.get("VisibleFocus", tmp, -1); - if (tmp >= 0) options_[OPTION_VISIBLE_FOCUS] = tmp; + if (tmp >= 0) Private::options_[OPTION_VISIBLE_FOCUS] = tmp; opt_prefs.get("DNDText", tmp, -1); - if (tmp >= 0) options_[OPTION_DND_TEXT] = tmp; + if (tmp >= 0) Private::options_[OPTION_DND_TEXT] = tmp; opt_prefs.get("ShowTooltips", tmp, -1); - if (tmp >= 0) options_[OPTION_SHOW_TOOLTIPS] = tmp; + if (tmp >= 0) Private::options_[OPTION_SHOW_TOOLTIPS] = tmp; opt_prefs.get("FNFCUsesGTK", tmp, -1); - if (tmp >= 0) options_[OPTION_FNFC_USES_GTK] = tmp; + if (tmp >= 0) Private::options_[OPTION_FNFC_USES_GTK] = tmp; opt_prefs.get("PrintUsesGTK", tmp, -1); - if (tmp >= 0) options_[OPTION_PRINTER_USES_GTK] = tmp; + if (tmp >= 0) Private::options_[OPTION_PRINTER_USES_GTK] = tmp; opt_prefs.get("ShowZoomFactor", tmp, -1); - if (tmp >= 0) options_[OPTION_SHOW_SCALING] = tmp; + if (tmp >= 0) Private::options_[OPTION_SHOW_SCALING] = tmp; opt_prefs.get("UseZenity", tmp, -1); - if (tmp >= 0) options_[OPTION_FNFC_USES_ZENITY] = tmp; + if (tmp >= 0) Private::options_[OPTION_FNFC_USES_ZENITY] = tmp; opt_prefs.get("UseKdialog", tmp, -1); - if (tmp >= 0) options_[OPTION_FNFC_USES_KDIALOG] = tmp; + if (tmp >= 0) Private::options_[OPTION_FNFC_USES_KDIALOG] = tmp; opt_prefs.get("SimpleZoomShortcut", tmp, -1); - if (tmp >= 0) options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp; + if (tmp >= 0) Private::options_[OPTION_SIMPLE_ZOOM_SHORTCUT] = tmp; } { // now, if the developer has registered this app, we could ask for per-application preferences } - options_read_ = 1; + Private::options_read_ = 1; } if (opt<0 || opt>=OPTION_LAST) return false; - return (bool)(options_[opt]!=0); + return (bool)(Private::options_[opt]!=0); } /** @@ -2142,11 +2217,11 @@ void Fl::option(Fl_Option opt, bool val) { if (opt<0 || opt>=OPTION_LAST) return; - if (!options_read_) { + if (!Private::options_read_) { // make sure that the options_ array is filled in option(opt); } - options_[opt] = val; + Private::options_[opt] = val; } @@ -2169,9 +2244,50 @@ Fl_Widget_Tracker::~Fl_Widget_Tracker() Fl::release_widget_pointer(wp_); // remove pointer from watch list } -int Fl::use_high_res_GL_ = 0; +int Fl::Private::use_high_res_GL_ = 0; -int Fl::draw_GL_text_with_textures_ = 1; +/** sets whether GL windows should be drawn at high resolution on Apple + computers with retina displays + \version 1.3.4 + */ +void Fl::use_high_res_GL(int val) { + Private::use_high_res_GL_ = val; +} + +/** returns whether GL windows should be drawn at high resolution on Apple + computers with retina displays. + Default is no. + \version 1.3.4 + */ +int Fl::use_high_res_GL() { + return Private::use_high_res_GL_; +} + +int Fl::Private::draw_GL_text_with_textures_ = 1; + +/** sets whether OpenGL uses textures to draw all text. + By default, FLTK draws OpenGL text using textures, if the necessary + hardware support is available. Call \p Fl::draw_GL_text_with_textures(0) + once in your program before the first call to gl_font() to have FLTK + draw instead OpenGL text using a legacy, platform-dependent procedure. + It's recommended not to deactivate textures under the MacOS platform + because the MacOS legacy procedure is extremely rudimentary. + \param val use 0 to prevent FLTK from drawing GL text with textures + \see gl_texture_pile_height(int max) + \version 1.4.0 + */ +void Fl::draw_GL_text_with_textures(int val) { + Private::draw_GL_text_with_textures_ = val; +} + +/** returns whether whether OpenGL uses textures to draw all text. + Default is yes. + \see draw_GL_text_with_textures(int val) + \version 1.4.0 + */ +int Fl::draw_GL_text_with_textures() { + return Private::draw_GL_text_with_textures_; +} int Fl::dnd() { diff --git a/src/Fl_Cairo.cxx b/src/Fl_Cairo.cxx index 5560833ff..85b19c343 100644 --- a/src/Fl_Cairo.cxx +++ b/src/Fl_Cairo.cxx @@ -23,7 +23,7 @@ // Preprocessor macro FLTK_HAVE_CAIRO_EXT is defined only for "CAIRO_EXT". // Both macros are defined in 'FL/fl_config.h'. -#include <FL/Fl.H> // includes <FL/fl_config.h> +#include "Fl_Private.H" // includes <FL/fl_config.h> #ifdef FLTK_HAVE_CAIRO @@ -61,7 +61,53 @@ // static initialization -Fl_Cairo_State Fl::cairo_state_; ///< current Cairo context information +Fl_Cairo_State Fl::Private::cairo_state_; ///< current Cairo context information + +/** When FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, + any current window dc is linked to a current Cairo context. + This is not the default, because it may not be necessary + to add Cairo support to all fltk supported windows. + When you wish to associate a Cairo context in this mode, + you need to call explicitly in your draw() overridden method, + Fl::cairo_make_current(Fl_Window*). This will create a Cairo context + only for this Window. + Still in custom Cairo application it is possible to handle + completely this process automatically by setting \p alink to true. + In this last case, you don't need anymore to call Fl::cairo_make_current(). + You can use Fl::cairo_cc() to get the current Cairo context anytime. + + \note Only available if built with CMake option FLTK_OPTION_CAIRO_WINDOW=ON. +*/ +void Fl::cairo_autolink_context(bool alink) { + Private::cairo_state_.autolink(alink); +} + +/** + Gets the current autolink mode for Cairo support. + \retval false if no Cairo context autolink is made for each window. + \retval true if any fltk window is attached a Cairo context when it + is current. \see void cairo_autolink_context(bool alink) + + \note Only available if built with CMake option FLTK_OPTION_CAIRO_EXT=ON. + */ +bool Fl::cairo_autolink_context() { + return Private::cairo_state_.autolink(); +} + +/** Gets the current Cairo context linked with a fltk window. */ +cairo_t *Fl::cairo_cc() { + return Private::cairo_state_.cc(); +} + +/** Sets the current Cairo context to \p c. + Set \p own to true if you want fltk to handle this cc deletion. + + \note Only available if built with CMake option FLTK_OPTION_CAIRO_WINDOW=ON. +*/ +void Fl::cairo_cc(cairo_t *c, bool own=false) { + Private::cairo_state_.cc(c, own); +} + // Fl_Cairo_State @@ -131,10 +177,10 @@ cairo_t *Fl::cairo_make_current(Fl_Window *wi) { #endif #if defined(FLTK_USE_X11) - cairo_ctxt = Fl::cairo_make_current(0, wi->w() * scale, wi->h() * scale); + cairo_ctxt = Fl::Private::cairo_make_current(0, wi->w() * scale, wi->h() * scale); #else // on macOS, scaling is done before by Fl_Window::make_current(), on Windows, the size is not used - cairo_ctxt = Fl::cairo_make_current(fl_gc, wi->w(), wi->h()); + cairo_ctxt = Fl::Private::cairo_make_current(fl_gc, wi->w(), wi->h()); #endif #if !defined(USE_MAC_OS) @@ -169,7 +215,7 @@ static cairo_surface_t *cairo_create_surface(void *gc, int W, int H) { \note Only available if CMake FLTK_OPTION_CAIRO_WINDOW is enabled. */ -cairo_t *Fl::cairo_make_current(void *gc) { +cairo_t *Fl::Private::cairo_make_current(void *gc) { int W = 0, H = 0; #if defined(FLTK_USE_X11) || defined(FLTK_USE_WAYLAND) // FIXME X11 get W,H @@ -211,7 +257,7 @@ cairo_t *Fl::cairo_make_current(void *gc) { \note Only available if CMake FLTK_OPTION_CAIRO_WINDOW is enabled. */ -cairo_t *Fl::cairo_make_current(void *gc, int W, int H) { +cairo_t *Fl::Private::cairo_make_current(void *gc, int W, int H) { if (gc == Fl::cairo_state_.gc() && fl_window == (Window)Fl::cairo_state_.window() && cairo_state_.cc() != 0) // no need to create a cc, just return that one diff --git a/src/Fl_Private.H b/src/Fl_Private.H new file mode 100644 index 000000000..becfbc17c --- /dev/null +++ b/src/Fl_Private.H @@ -0,0 +1,77 @@ +// +// Private header file for the Fast Light Tool Kit (FLTK). +// +// Copyright 2025 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: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +/** \file src/Fl_Private.H + \brief Fl::Private namespace. +*/ + +#ifndef Fl_Private_H +#define Fl_Private_H + +#include <FL/fl_config.h> // build configuration +#include <FL/Fl.H> + +/** + FLTK private global variables and functions. + */ +namespace Fl { +namespace Private { + +FL_EXPORT extern int use_high_res_GL_; +FL_EXPORT extern int draw_GL_text_with_textures_; +FL_EXPORT extern int box_shadow_width_; +FL_EXPORT extern int box_border_radius_max_; +FL_EXPORT extern int selection_to_clipboard_; + +FL_EXPORT extern unsigned char options_[OPTION_LAST]; +FL_EXPORT extern unsigned char options_read_; +FL_EXPORT extern int program_should_quit_; // non-zero means the program was asked to cleanly terminate + +/** + The currently executing idle callback function: DO NOT USE THIS DIRECTLY! + + This is now used as part of a higher level system allowing multiple + idle callback functions to be called. + \see add_idle(), remove_idle() +*/ +FL_EXPORT extern void (*idle_)(); + +FL_EXPORT extern void run_idle(); +FL_EXPORT extern void run_checks(); + +/** + Sets an idle callback (internal use only). + + This method is now private and is used to store the idle callback. + The old, public set_idle() method was deprecated since 1.3.x and + is no longer available in FLTK 1.5. + + See documentation: use Fl::add_idle() instead. +*/ +FL_EXPORT inline void set_idle_(Fl_Old_Idle_Handler cb) { idle_ = cb; } + +#ifdef FLTK_HAVE_CAIRO + +FL_EXPORT extern cairo_t *cairo_make_current(void *gc); +FL_EXPORT extern cairo_t *cairo_make_current(void *gc, int W, int H); +FL_EXPORT extern Fl_Cairo_State cairo_state_; + +#endif // FLTK_HAVE_CAIRO + +} // namespace Private +} // namespace Fl + +#endif // !Fl_Private_H diff --git a/src/Fl_System_Driver.H b/src/Fl_System_Driver.H index 2ec99745a..558f7d6e5 100644 --- a/src/Fl_System_Driver.H +++ b/src/Fl_System_Driver.H @@ -58,7 +58,7 @@ class Fl_Sys_Menu_Bar_Driver; Each supported platform implements several of the virtual methods of this class. */ class Fl_System_Driver { - friend class Fl; + friend Fl_System_Driver *Fl::system_driver(); protected: // implement once for each platform static Fl_System_Driver *newSystemDriver(); diff --git a/src/Fl_System_Driver.cxx b/src/Fl_System_Driver.cxx index 5a01d6534..a1ae24276 100644 --- a/src/Fl_System_Driver.cxx +++ b/src/Fl_System_Driver.cxx @@ -21,7 +21,7 @@ */ #include "Fl_System_Driver.H" -#include <FL/Fl.H> +#include "Fl_Private.H" #include "Fl_Timeout.h" #include <FL/Fl_File_Icon.H> #include <FL/fl_utf8.h> @@ -357,8 +357,8 @@ double Fl_System_Driver::wait(double time_to_wait) { Fl::do_widget_deletion(); Fl_Timeout::do_timeouts(); - Fl::run_checks(); - Fl::run_idle(); + Fl::Private::run_checks(); + Fl::Private::run_idle(); // The idle function may turn off idle() if *all* idle callbacks // are removed from the callback queue (ring), we can then wait. diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index d112b89f9..e60a68eaa 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -173,8 +173,10 @@ void Fl::default_atclose(Fl_Window* window, void* v) { window->hide(); Fl_Widget::default_callback(window, v); // put on Fl::read_queue() } + /** Back compatibility: default window callback handler \see Fl::set_atclose() */ -void (*Fl::atclose)(Fl_Window*, void*) = default_atclose; +void (*Fl::atclose)(Fl_Window*, void*) = Fl::default_atclose; + /** Back compatibility: Sets the default callback v for win to call on close event */ void Fl_Window::default_callback(Fl_Window* win, void* v) { Fl::atclose(win, v); diff --git a/src/Fl_add_idle.cxx b/src/Fl_add_idle.cxx index 1c3687173..fd2ab36a4 100644 --- a/src/Fl_add_idle.cxx +++ b/src/Fl_add_idle.cxx @@ -18,7 +18,7 @@ // Replaces the older set_idle() call which has been renamed to set_idle_(), // is now private in class Fl::, and is used to implement this. -#include <FL/Fl.H> +#include "Fl_Private.H" struct idle_cb { void (*cb)(void*); @@ -83,7 +83,7 @@ void Fl::add_idle(Fl_Idle_Handler cb, void* data) { } else { first = last = p; p->next = p; - set_idle_(call_idle); + Private::set_idle_(call_idle); } } @@ -161,7 +161,7 @@ void Fl::remove_idle(Fl_Idle_Handler cb, void* data) { } if (l == p) { // only one first = last = 0; - set_idle_(0); + Private::set_idle_(0); } else { last = l; first = l->next = p->next; diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx index a78c74b4a..1569e58bd 100644 --- a/src/fl_boxtype.cxx +++ b/src/fl_boxtype.cxx @@ -23,7 +23,7 @@ // boxtypes. Other box types are in separate files so they are not // linked in if not used. -#include <FL/Fl.H> +#include "src/Fl_Private.H" #include <FL/Fl_Widget.H> #include <FL/fl_draw.H> #include <config.h> @@ -46,8 +46,47 @@ static const uchar inactive_ramp[24] = { 51, 51, 52, 52}; static int draw_it_active = 1; -int Fl::box_border_radius_max_ = 15; -int Fl::box_shadow_width_ = 3; +int Fl::Private::box_border_radius_max_ = 15; + +/** Get the maximum border radius of all "rounded" boxtypes in pixels. + \since 1.4.0 +*/ +int Fl::box_border_radius_max() { + return Private::box_border_radius_max_; +} + +/** Set the maximum border radius of all "rounded" boxtypes in pixels. + Must be at least 5, default = 15. + + \note This does \b not apply to the "round" boxtypes which have really round sides + (i.e. composed of half circles) as opposed to "rounded" boxtypes that have only + rounded corners with a straight border between corners. + + The box border radius of "rounded" boxtypes is typically calculated as about 2/5 of + the box height or width, whichever is smaller. The upper limit can be set by this + method for all "rounded" boxtypes. + \since 1.4.0 +*/ +void Fl::box_border_radius_max(int R) { + Private::box_border_radius_max_ = R < 5 ? 5 : R; +} + +int Fl::Private::box_shadow_width_ = 3; + +/** Get the box shadow width of all "shadow" boxtypes in pixels. + \since 1.4.0 +*/ +int Fl::box_shadow_width() { + return Private::box_shadow_width_; +} + +/** Set the box shadow width of all "shadow" boxtypes in pixels. + Must be at least 1, default = 3. There is no upper limit. + \since 1.4.0 +*/ +void Fl::box_shadow_width(int W) { + Private::box_shadow_width_ = W < 1 ? 1 : W; +} /** Determines if the currently drawn box is active or inactive. |
