Windows redraw issue when resizing screen

James Woodcock james_woodcock at yahoo.co.uk
Thu Jul 27 22:00:01 BST 2017


I noticed that the redraw logic goes a bit funny when you maximise the browser window on Windows.  A race condition with WM_PAINT can cause win32_window_set_scroll() to use the old window size.  If this happens, the page data will not get drawn from the top left of the window but offset quite a large distance down and to the right.


To recreate:
1. start NetSurf and resize the browser window to be 1/2 size of the screen

2. load a page (any page will do)
3. click the maximise window button

It usually fails, but you might need to give it a few tries.
The following patch fixes it.

diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 976974c..0addc35 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -1366,7 +1366,7 @@ nsws_window_resize(struct gui_window *gw,
        }
        nsws_window_update_forward_back(gw);

-       win32_window_set_scroll(gw, &rect);
+       browser_window_update(gw->bw, false);

        if (gw->toolbar != NULL) {
                SendMessage(gw->toolbar, TB_SETSTATE,



More information about the netsurf-dev mailing list