From b238ec26e54d0f062629044c1842191200cdda3c Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 11 Jun 2019 18:51:10 +0200 Subject: Fix Fl_WinAPI_Window_Driver::capture_titlebar_and_borders() when window titlebar is partially out of screen --- src/Fl_win32.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index d056d71d6..915a18b52 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -2717,20 +2717,21 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image *&top, F if (wsides <= 1) ww = w() + 2 * wsides; // capture the 4 window sides from screen + int offset = r.left < 0 ? -r.left : 0; Fl_WinAPI_Screen_Driver *dr = (Fl_WinAPI_Screen_Driver *)Fl::screen_driver(); - if (htop) { - top = dr->read_win_rectangle_unscaled(r.left, r.top, r.right - r.left, htop, 0); - if (scaling != 1) + if (htop && r.right - r.left > offset) { + top = dr->read_win_rectangle_unscaled(r.left+offset, r.top, r.right - r.left-offset, htop, 0); + if (scaling != 1 && top) top->scale(ww, htop / scaling, 0, 1); } if (wsides) { - left = dr->read_win_rectangle_unscaled(r.left, r.top + htop, wsides, h() * scaling, 0); + left = dr->read_win_rectangle_unscaled(r.left + offset, r.top + htop, wsides, h() * scaling, 0); right = dr->read_win_rectangle_unscaled(r.right - wsides, r.top + htop, wsides, h() * scaling, 0); - bottom = dr->read_win_rectangle_unscaled(r.left, r.bottom - hbottom, ww, hbottom, 0); + bottom = dr->read_win_rectangle_unscaled(r.left+offset, r.bottom - hbottom, ww, hbottom, 0); if (scaling != 1) { - left->scale(wsides, h(), 0, 1); - right->scale(wsides, h(), 0, 1); - bottom->scale(ww, hbottom, 0, 1); + if (left) left->scale(wsides, h(), 0, 1); + if (right) right->scale(wsides, h(), 0, 1); + if (bottom) bottom->scale(ww, hbottom, 0, 1); } } ReleaseDC(NULL, (HDC)fl_graphics_driver->gc()); -- cgit v1.2.3