Skip to content

Commit

Permalink
HiDPI support under WIN32 platform: fix Fl_WinAPI_Window_Driver::capt…
Browse files Browse the repository at this point in the history
…ure_titlebar_and_borders() under XP.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12266 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Jun 19, 2017
1 parent 701fa00 commit 4e72aac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Fl_win32.cxx
Expand Up @@ -2498,7 +2498,7 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top
if (htop) {
r_top = dr->read_win_rectangle_unscaled(NULL, r.left, r.top, r.right - r.left, htop, 0);
top = Fl_Shared_Image::get(r_top);
if (DWMscaling >= 1.1) top->scale(ww, htop/DWMscaling, 0, 1);
if (DWMscaling != 1) top->scale(ww, htop/DWMscaling, 0, 1);
}
if (wsides) {
r_left = dr->read_win_rectangle_unscaled(NULL, r.left, r.top + htop, wsides, h()*scaling, 0);
Expand All @@ -2507,7 +2507,7 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top
right = Fl_Shared_Image::get(r_right);
r_bottom = dr->read_win_rectangle_unscaled(NULL, r.left, r.bottom-hbottom, ww, hbottom, 0);
bottom = Fl_Shared_Image::get(r_bottom);
if (scaling >= 1.1) {
if (scaling != 1) {
left->scale(wsides, h(), 0, 1);
right->scale(wsides, h(), 0, 1);
bottom->scale(ww, hbottom, 0, 1);
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
Expand Up @@ -75,12 +75,11 @@ 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 = 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 ) {
need_r = 0;
scaling = ((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(screen_num());
}
}
if (need_r) {
Expand Down

0 comments on commit 4e72aac

Please sign in to comment.