diff options
| author | Manolo Gouy <Manolo> | 2017-07-07 15:06:51 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-07-07 15:06:51 +0000 |
| commit | 9f69df923fa4a672274c013f8969416f19925be8 (patch) | |
| tree | 764c70b05fa00cd2d89a31b9597f48a628944567 | |
| parent | 7847c2d87ab85b54f846f8ab240b5e866e9a6593 (diff) | |
Define Fl_WinAPI_Screen_Driver::DWM_scaling_factor() only without FLTK_HIDPI_SUPPORT.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12298 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_win32.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H | 5 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 9 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 4 |
5 files changed, 11 insertions, 13 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index df43f59a5..f1ca65e61 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -813,7 +813,7 @@ void Fl_WinAPI_System_Driver::paste(Fl_Widget &receiver, int clipboard, const ch width = int(width / (scaling * factor)); // convert to screen pixel unit height = int(height / (scaling * factor)); #else - float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(0); + float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(); width = int(width * scaling / factor); // convert to screen pixel unit height = int(height * scaling / factor); scaling = 1; @@ -2547,7 +2547,7 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top #ifdef FLTK_HIDPI_SUPPORT float DWMscaling = scaling; #else - float DWMscaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(0); + float DWMscaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(); #endif // capture the 4 window sides from screen Fl_WinAPI_Screen_Driver *dr = (Fl_WinAPI_Screen_Driver*)Fl::screen_driver(); diff --git a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx index 3369545a4..131edcd7f 100644 --- a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx @@ -64,7 +64,7 @@ Fl_GDI_Copy_Surface_Driver::Fl_GDI_Copy_Surface_Driver(int w, int h) : Fl_Copy_S float scaling = Fl_Graphics_Driver::default_driver().scale(); driver()->scale(scaling); #else - float scaling = 1/((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(0); + float scaling = 1/((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(); #endif RECT rect; rect.left = 0; rect.top = 0; rect.right = (LONG)((w*scaling) * factorw); rect.bottom = (LONG)((h*scaling) * factorh); gc = CreateEnhMetaFile (NULL, NULL, &rect, NULL); diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H index 682afca25..628fc9511 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H @@ -61,7 +61,6 @@ public: virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n); virtual void screen_dpi(float &h, float &v, int n=0); int screen_num_unscaled(int x, int y); - float DWM_scaling_factor(int screen_num); virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n); // --- audible output virtual void beep(int type); @@ -92,14 +91,14 @@ public: virtual APP_SCALING_CAPABILITY rescalable() { return PER_SCREEN_APP_SCALING; } -#endif -#if defined(FLTK_HIDPI_SUPPORT) virtual float scale(int n) { return scale_of_screen[n]; } virtual void scale(int n, float f) { scale_of_screen[n] = f; } +#else + float DWM_scaling_factor(); #endif virtual float desktop_scale_factor(); }; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 5951ba193..0f0609bcc 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -630,12 +630,10 @@ Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(uchar *p, int return rgb; } +#ifndef FLTK_HIDPI_SUPPORT /* Returns the current desktop scaling factor for screen_num (1.75 for example) */ -float Fl_WinAPI_Screen_Driver::DWM_scaling_factor(int screen_num) { -#ifdef FLTK_HIDPI_SUPPORT - return scale(screen_num); -#else +float Fl_WinAPI_Screen_Driver::DWM_scaling_factor() { // Compute the global desktop scaling factor: 1, 1.25, 1.5, 1.75, etc... // This factor can be set in Windows 10 by // "Change the size of text, apps and other items" in display settings. @@ -655,9 +653,10 @@ float Fl_WinAPI_Screen_Driver::DWM_scaling_factor(int screen_num) { float scaling = dhr/float(hr); scaling = int(scaling * 100 + 0.5)/100.; // round to 2 digits after decimal point return scaling; -#endif // FLTK_HIDPI_SUPPORT } +#endif // ! FLTK_HIDPI_SUPPORT + void Fl_WinAPI_Screen_Driver::offscreen_size(Fl_Offscreen off, int &width, int &height) { BITMAP bitmap; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 20a84736a..383e85e4a 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -108,7 +108,7 @@ RECT // frame of the decorated window in screen coordinates width = rc.right; height = rc.bottom; #else - float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(0); + float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(); width = int(win->w() * scaling); height = int(win->h() * scaling); #endif @@ -141,7 +141,7 @@ int Fl_WinAPI_Window_Driver::decorated_h() int mini_by = by/s; if (mini_by < 1) mini_by = 1; return h() + (bt + by)/s + mini_by; #else - float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(0); + float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(); return h() + bt/scaling + 2 * by +1; #endif } |
