diff options
| author | Manolo Gouy <Manolo> | 2018-08-08 20:08:10 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-08-08 20:08:10 +0000 |
| commit | cd399d989897e650cc7928c4ebd9bf89892d7995 (patch) | |
| tree | d0e6d7f02a53a9ead62c88c34cb84580a24a3fc2 /src/Fl.cxx | |
| parent | fb0f940c517d4f0f0f2f22f92acc54c9f5b37242 (diff) | |
Support for GUI scaling: add API to get/set the scaling factor value.
Also, define an FLTK event triggered when the scaling is changed and an option
to disable the transient window showing the new scaling factor.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13011 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl.cxx')
| -rw-r--r-- | src/Fl.cxx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 3a682c039..8d99d679e 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -16,6 +16,10 @@ // http://www.fltk.org/str.php // +/** \file + Implementation of the member functions of class Fl. + */ + #include "config_lib.h" #include <FL/Fl.H> @@ -1860,8 +1864,11 @@ bool Fl::option(Fl_Option opt) options_[OPTION_DND_TEXT] = tmp; opt_prefs.get("ShowTooltips", tmp, 1); // default: on options_[OPTION_SHOW_TOOLTIPS] = tmp; - opt_prefs.get("FNFCUsesGTK", tmp, 1); // default: on + opt_prefs.get("FNFCUsesGTK", tmp, 1); // default: on options_[OPTION_FNFC_USES_GTK] = tmp; + + opt_prefs.get("ShowZoomFactor", tmp, 1); // default: on + options_[OPTION_SHOW_SCALING] = tmp; } { // next, check the user preferences // override system options only, if the option is set ( >= 0 ) @@ -1881,6 +1888,9 @@ bool Fl::option(Fl_Option opt) if (tmp >= 0) options_[OPTION_SHOW_TOOLTIPS] = tmp; opt_prefs.get("FNFCUsesGTK", tmp, -1); if (tmp >= 0) options_[OPTION_FNFC_USES_GTK] = tmp; + + opt_prefs.get("ShowZoomFactor", tmp, -1); + if (tmp >= 0) options_[OPTION_SHOW_SCALING] = tmp; } { // now, if the developer has registered this app, we could as for per-application preferences } @@ -2058,6 +2068,11 @@ void Fl::disable_im() Fl::screen_driver()->disable_im(); } +/** + Opens the display. + Automatically called by the library when the first window is show()'n. + Does nothing if the display is already open. + */ void fl_open_display() { Fl::screen_driver()->open_display(); @@ -2110,6 +2125,24 @@ float Fl::screen_scale(int n) { return Fl::screen_driver()->scale(n); } +/** Set the value of the GUI scaling factor for screen number \p n. +Call this function before the fist window is show()'n and after +a call to fl_open_display() to set the application's initial scaling factor value. */ +void Fl::screen_scale(int n, float factor) { + Fl::screen_driver()->scale(n, factor); + Fl_Graphics_Driver::default_driver().scale(factor); +} + +/** + See if scaling factors are supported by this platform. + \return 0 if scaling factors are not supported by this platform, + 1 if a single scaling factor value is shared by all screens, 2 if each screen + can have its own scaling factor value. + \see Fl::screen_scale(int) + */ +int Fl::screen_scaling_supported() { + return Fl::screen_driver()->rescalable(); +} // Pointers you can use to change FLTK to another language. // Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx |
