diff options
Diffstat (limited to 'src/drivers/WinAPI')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H | 7 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 8 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H index 5c016ce73..ff2688bcf 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H @@ -78,6 +78,13 @@ public: virtual void disable_im(); virtual void open_display(); virtual void offscreen_size(Fl_Offscreen off, int &width, int &height); + + virtual APP_SCALING_CAPABILITY rescalable() { return SYSTEMWIDE_APP_SCALING; } + virtual float scale(int n) {return scale_;} + virtual void scale(int n, float f) { scale_ = f;} + virtual float desktop_scale_factor(); +private: + float scale_; }; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 219c1d1d6..e9ca9d2fb 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -617,6 +617,9 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle(uchar *p, // I - Pixel buffer or NU /** Returns the current desktop scaling factor (1.75 for example) */ float Fl_WinAPI_Screen_Driver::desktop_scaling_factor() { +#ifdef FLTK_HIDPI_SUPPORT + return 1;// this becomes useless if FLTK app are made DPI-aware by calling SetProcessDpiAwareness() +#else // 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. @@ -636,6 +639,7 @@ float Fl_WinAPI_Screen_Driver::desktop_scaling_factor() { 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 } void Fl_WinAPI_Screen_Driver::offscreen_size(Fl_Offscreen off, int &width, int &height) diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index eb8e13b33..1d496edff 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -261,10 +261,11 @@ static HRGN bitmap2region(Fl_Image* image) { void Fl_WinAPI_Window_Driver::draw_begin() { if (shape_data_) { - if ((shape_data_->lw_ != w() || shape_data_->lh_ != h()) && shape_data_->shape_) { + float s = Fl::screen_driver()->scale(screen_num()); + if ((shape_data_->lw_ != s*w() || shape_data_->lh_ != s*h()) && shape_data_->shape_) { // size of window has changed since last time - shape_data_->lw_ = w(); - shape_data_->lh_ = h(); + shape_data_->lw_ = s*w(); + shape_data_->lh_ = s*h(); Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_); HRGN region = bitmap2region(temp); SetWindowRgn(fl_xid(pWindow), region, TRUE); // the system deletes the region when it's no longer needed @@ -385,6 +386,7 @@ void Fl_WinAPI_Window_Driver::make_current() { #endif // USE_COLORMAP fl_graphics_driver->clip_region(0); +fl_graphics_driver->scale(Fl::screen_driver()->scale(0)); } void Fl_WinAPI_Window_Driver::label(const char *name,const char *iname) { |
