From 22d90078bd81c94cc3b7dce4fd7ca000eed03087 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 7 Jul 2017 14:16:35 +0000 Subject: [PATCH] Fix Fl_WinAPI_Window_Driver::border_width_title_bar_height() when built without FLTK_HIDPI_SUPPORT git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12296 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 0e8e9b3d3..20a84736a 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -92,7 +92,6 @@ RECT // frame of the decorated window in screen coordinates static DwmGetWindowAttribute_type DwmGetWindowAttribute = dwmapi_dll ? (DwmGetWindowAttribute_type)GetProcAddress(dwmapi_dll, "DwmGetWindowAttribute") : NULL; int need_r = 1; - float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(screen_num()); if (DwmGetWindowAttribute) { const DWORD DWMWA_EXTENDED_FRAME_BOUNDS = 9; if ( DwmGetWindowAttribute(fl_xid(win), DWMWA_EXTENDED_FRAME_BOUNDS, &r, sizeof(RECT)) == S_OK ) { @@ -102,12 +101,21 @@ RECT // frame of the decorated window in screen coordinates if (need_r) { GetWindowRect(fl_xid(win), &r); } + int width, height; +#ifdef FLTK_HIDPI_SUPPORT RECT rc; GetClientRect(fl_xid(win), &rc); - bx = (r.right - r.left - rc.right)/2; + width = rc.right; + height = rc.bottom; +#else + float scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(0); + width = int(win->w() * scaling); + height = int(win->h() * scaling); +#endif + bx = (r.right - r.left - width)/2; if (bx < 1) bx = 1; by = bx; - bt = r.bottom - r.top - rc.bottom - 2 * by; + bt = r.bottom - r.top - height - 2 * by; } return r; }