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
This commit is contained in:
Manolo Gouy 2017-07-07 14:16:35 +00:00
parent 23e3535257
commit 22d90078bd

View File

@ -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;
}