diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-12-03 15:08:44 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-12-03 15:08:59 +0100 |
| commit | 4f29313a80169d28ac1f898bb2089faa9de3f7e4 (patch) | |
| tree | 88a44ba2ff90a3113c2615bb3e335afbdc506040 | |
| parent | f787a1b4e4ef3c4ebf3b46fd55ef72b0dedc3520 (diff) | |
Windows scaling: fix redraw after partial expose events.
Under XP (at least), WM_PAINT events occur where information of where to redraw
is mostly given by the system, in the window's update region. When the GUI is scaled,
that information must be un-scaled and then added to Fl_X::i(window)->region, for the
adequate part of the window to be painted.
| -rw-r--r-- | src/Fl_win32.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 0a9f7094a..555abd10e 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1252,6 +1252,20 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar // convert i->region in FLTK units to R2 in drawing units R2 = Fl_GDI_Graphics_Driver::scale_region(i->region, scale, NULL); + RECT r_box; + if (scale != 1 && GetRgnBox(R, &r_box) != NULLREGION) { + // add de-scaled update region to i->region in FLTK units + r_box.left /= scale; + r_box.right /= scale; + r_box.top /= scale; + r_box.bottom /= scale; + Fl_Region R3 = CreateRectRgn(r_box.left, r_box.top, r_box.right + 1, r_box.bottom + 1); + if (!i->region) i->region = R3; + else { + CombineRgn(i->region, i->region, R3, RGN_OR); + DeleteObject(R3); + } + } if (R2) { // Also tell Windows that we are drawing someplace else as well... CombineRgn(R2, R2, R, RGN_OR); |
