summaryrefslogtreecommitdiff
path: root/FL/Fl_Screen_Driver.H
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-05-17 11:54:18 +0000
committerManolo Gouy <Manolo>2017-05-17 11:54:18 +0000
commitf48750b0f482a2155ec5d66b19110d2ac22ce87c (patch)
tree7a8f942b83003ea0fd8f63bc351fedcb1c9b8a93 /FL/Fl_Screen_Driver.H
parent22a5dd4fcf88f1da5343fc31e6e453d986d224a0 (diff)
Introduce HiDPI + rescaling support for the X11 platform (+ partial support for WIN32)
Corresponds to STR #3320 1) HiDPI support consists in detecting the adequate scaling factor for the screen on which FLTK maps a window, and scaling all FLTK units by this factor. FLTK tries to detect the correct value of this factor at startup (see more details below). Environment variable FLTK_SCALING_FACTOR can also be used to set this value. 2) Rescaling support consists in changing the scaling factor of all FLTK windows in reply to ctrl/+/-/0/ keystrokes. More details for the various platforms : - X11: Support is very advanced. Some details need still to be improved. Automatic detection of the correct starting value of the scaling factor works well with the gnome desktop. The present code contains no support for this on other desktops. FLTK_SCALING_FACTOR provides a workaround. -WIN32: Support is incomplete at this point, although many test applications have partial or complete HiDPI and scaling support. The current value of the system's scaling factor is correctly detected at application startup. Apps respond to changes of this value in real time. Support needs to define the FLTK_HIDPI_SUPPORT preprocessor variable at compile time. This way, standard builds produce a code with the default WIN32 HiDPI support, that is, where all graphics goes to an internal buffer that gets enlarged by the system and then mapped to the HiDPI display. To experiment with (or develop) the new HiDPI support requires a modified build procedure in which FLTK_HIDPI_SUPPORT is defined at compile time. When the support will be complete, the requirement for the definition of this preprocessor variable will be removed. The present commit contains support for a single scaling factor. Eventually, per-screen scaling factors should be implemented, as done for X11. - MacOS: this commit does not give new HiDPI for this platform. Eventually, window rescaling in reply to command/+/-/0/ is desirable. Per-screen scaling factor makes no sense on this platform because the OS itself takes care of the difference between the resolutions of traditional and retina displays. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12239 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Screen_Driver.H')
-rw-r--r--FL/Fl_Screen_Driver.H21
1 files changed, 20 insertions, 1 deletions
diff --git a/FL/Fl_Screen_Driver.H b/FL/Fl_Screen_Driver.H
index 762358412..84f25d9fa 100644
--- a/FL/Fl_Screen_Driver.H
+++ b/FL/Fl_Screen_Driver.H
@@ -3,7 +3,7 @@
//
// All screen related calls in a driver style class.
//
-// Copyright 1998-2016 by Bill Spitzak and others.
+// Copyright 1998-2017 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
@@ -54,6 +54,8 @@ protected:
static const int MAX_SCREENS = 16;
int num_screens;
+ static float fl_intersection(int x1, int y1, int w1, int h1,
+ int x2, int y2, int w2, int h2);
public:
static char bg_set;
@@ -61,6 +63,8 @@ public:
static char fg_set;
public:
+ virtual float scale(int n) {return 1;}
+ virtual void scale(int n, float f) { }
static Fl_Screen_Driver *newScreenDriver();
// --- display management
virtual void display(const char *disp);
@@ -157,6 +161,21 @@ public:
virtual void close_display() {}
// compute dimensions of an Fl_Offscreen
virtual void offscreen_size(Fl_Offscreen off, int &width, int &height) {}
+
+ void rescale_all_windows_from_screen(int screen, float f);
+ static void transient_scale_display(float f, int nscreen);
+ static int scale_handler(int event);
+ virtual void init_workarea() {}
+ virtual float desktop_scale_factor() {return 1;}
+ float default_scale_factor();
+ enum APP_SCALING_CAPABILITY {
+ NO_APP_SCALING = 0, ///< The platform does not support rescaling.
+ SYSTEMWIDE_APP_SCALING, ///< The platform supports rescaling with the same factor for all screens.
+ PER_SCREEN_APP_SCALING ///< The platform supports rescaling with one factor for each screen.
+ };
+ /** Returns the platform's support for rescaling the application with ctrl-/+/-/0/ keys.
+ */
+ virtual APP_SCALING_CAPABILITY rescalable() { return NO_APP_SCALING; }
};