diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-01-17 15:07:06 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-01-17 15:07:06 +0100 |
| commit | 0a7b5b19bf652653159a4256a77dc5e9a2306686 (patch) | |
| tree | 94fefcea3e7b483210ba9a64d587e27b54b1c8c8 /src | |
| parent | 3e4baae6fcb40c3a377c170af2f7698e18dc03e4 (diff) | |
Make Fl::screen_scale(int, float) functional also after initial window display.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 13bd308f1..2652ad9ff 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -2126,16 +2126,21 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) { /** Current value of the GUI scaling factor for screen number \p n */ float Fl::screen_scale(int n) { + if (!Fl::screen_scaling_supported() || n < 0 || n >= Fl::screen_count()) return 1.; return Fl::screen_driver()->scale(n); } /** Set the value of the GUI scaling factor for screen number \p n. -Call this function before the first window is show()'n to set the - application's initial scaling factor value. */ +When this function is called before the first window is show()'n it sets the + application's initial scaling factor value. Otherwise, it sets the scale factor value of all windows mapped to screen number \p n */ void Fl::screen_scale(int n, float factor) { - fl_open_display(); - Fl::screen_driver()->scale(n, factor); - Fl_Graphics_Driver::default_driver().scale(factor); + if (!Fl::screen_scaling_supported() || n < 0 || n >= Fl::screen_count()) return; + if (Fl::first_window()) { + Fl::screen_driver()->rescale_all_windows_from_screen(n, factor); + } else { + Fl::screen_driver()->scale(n, factor); + Fl_Graphics_Driver::default_driver().scale(factor); + } } /** |
