summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-06-11 18:51:10 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-06-11 18:51:10 +0200
commitb238ec26e54d0f062629044c1842191200cdda3c (patch)
tree930861160c0bbdb2814ba71ea91495143d1e2402 /src
parentfe08c686be10cc2aca97279f162eff52e6265f7d (diff)
Fix Fl_WinAPI_Window_Driver::capture_titlebar_and_borders() when window titlebar is partially out of screen
Diffstat (limited to 'src')
-rw-r--r--src/Fl_win32.cxx17
1 files changed, 9 insertions, 8 deletions
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());