summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
Diffstat (limited to 'FL')
-rw-r--r--FL/Enumerations.H5
-rw-r--r--FL/Fl.H17
-rw-r--r--FL/Fl_Graphics_Driver.H4
-rw-r--r--FL/names.h2
4 files changed, 22 insertions, 6 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H
index 2a1908f8e..68b38f242 100644
--- a/FL/Enumerations.H
+++ b/FL/Enumerations.H
@@ -403,8 +403,9 @@ enum Fl_Event { // events
The Fl::event_dy() method can be used to find magnification amount,
Fl::event_x() and Fl::event_y() are set as well.
*/
- FL_ZOOM_GESTURE = 26
-
+ FL_ZOOM_GESTURE = 26,
+ /** A zoom event (crtl-/+/-/0/) was processed */
+ FL_ZOOM_EVENT = 27
// DEV NOTE: Keep this list in sync with FL/names.h
};
diff --git a/FL/Fl.H b/FL/Fl.H
index 6bb1f7447..1075c3831 100644
--- a/FL/Fl.H
+++ b/FL/Fl.H
@@ -252,6 +252,10 @@ public:
/// if the GTK library is available on the platform (linux/unix only).
/// When switched off, GTK file dialogs aren't used even if the GTK library is available.
OPTION_FNFC_USES_GTK,
+ /// When switched on (default), the library shows in a transient yellow window the zoom factor
+ /// value.
+ /// When switched off, no such window gets displayed.
+ OPTION_SHOW_SCALING,
// don't change this, leave it always as the last element
/// For internal use only.
OPTION_LAST
@@ -989,7 +993,15 @@ int main() {
/** \defgroup fl_screen Screen functions
- fl global screen functions declared in <FL/Fl.H>
+ fl global screen functions declared in <FL/Fl.H>.
+ FLTK supports high-DPI screens using a screen scaling factor.
+ The scaling factor value can be changed by typing ctrl-/+/-/0/
+ (cmd-/+/-/0/ under MacOS). FLTK sends the FL_ZOOM_EVENT when the
+ factor value is changed, to which a callback can be associated with Fl::add_handler().
+ By default, FLTK also displays the new scaling factor value in a yellow, transient window.
+ This can be changed with Fl::option(OPTION_SHOW_SCALING, 0).
+ The scaling factor value is programmatically get and set with the Fl::screen_scale() functions.
+
@{ */
static int x(); // via screen driver
static int y(); // via screen driver
@@ -1009,6 +1021,9 @@ int main() {
static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // via screen driver
static void screen_work_area(int &X, int &Y, int &W, int &H); // via screen driver
static float screen_scale(int n); // via screen driver
+ static void screen_scale(int n, float factor); // via screen driver
+ static int screen_scaling_supported();
+
/** @} */
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H
index 3057d127e..d21576a6a 100644
--- a/FL/Fl_Graphics_Driver.H
+++ b/FL/Fl_Graphics_Driver.H
@@ -158,8 +158,6 @@ public:
} driver_feature;
protected:
- /** Sets the current value of the scaling factor */
- virtual void scale(float f) { scale_ = f; }
int fl_clip_state_number; ///< For internal use by FLTK
static const matrix m0; ///< For internal use by FLTK
Fl_Font font_; ///< current font
@@ -256,6 +254,8 @@ public:
static Fl_Graphics_Driver &default_driver();
/** Current scale factor between FLTK and drawing units: drawing = FLTK * scale() */
float scale() { return scale_; }
+ /** Sets the current value of the scaling factor */
+ virtual void scale(float f) { scale_ = f; }
/** Return whether the graphics driver can do alpha blending */
virtual char can_do_alpha_blending() { return 0; }
// --- implementation is in src/fl_rect.cxx which includes src/drivers/xxx/Fl_xxx_Graphics_Driver_rect.cxx
diff --git a/FL/names.h b/FL/names.h
index 46525d600..7b4700fbe 100644
--- a/FL/names.h
+++ b/FL/names.h
@@ -69,7 +69,7 @@ const char * const fl_eventnames[] =
"FL_SCREEN_CONFIGURATION_CHANGED",
"FL_FULLSCREEN",
"FL_ZOOM_GESTURE",
- "FL_EVENT_27", // not yet defined, just in case it /will/ be defined ...
+ "FL_ZOOM_EVENT",
"FL_EVENT_28", // not yet defined, just in case it /will/ be defined ...
"FL_EVENT_29", // not yet defined, just in case it /will/ be defined ...
"FL_EVENT_30" // not yet defined, just in case it /will/ be defined ...