summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-06-09 22:52:49 +0100
committerVincent Sanders <vince@kyllikki.org>2017-06-09 22:52:49 +0100
commit9bf5ecfa87d022645e986249270c5a89e27f46fe (patch)
tree1969e3fc5ab067034e46e23f5ca65ac6c768b0c2
parent2bec7f113c11329098a7a9d7dfa8766f82357cd2 (diff)
downloadnetsurf-9bf5ecfa87d022645e986249270c5a89e27f46fe.tar.gz
netsurf-9bf5ecfa87d022645e986249270c5a89e27f46fe.tar.bz2
Fix windows frontend click and invalidate region scroll offsets
-rw-r--r--frontends/windows/corewindow.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/frontends/windows/corewindow.c b/frontends/windows/corewindow.c
index d4ffc5ad0..9bed837b6 100644
--- a/frontends/windows/corewindow.c
+++ b/frontends/windows/corewindow.c
@@ -286,18 +286,40 @@ nsw32_corewindow_hscroll(struct nsw32_corewindow *nsw32_cw,
static LRESULT
nsw32_corewindow_mousedown(struct nsw32_corewindow *nsw32_cw,
+ HWND hwnd,
int x, int y,
browser_mouse_state button)
{
+ SCROLLINFO si; /* scroll information */
+
+ /* get scroll positions */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ x += si.nPos;
+ GetScrollInfo(hwnd, SB_VERT, &si);
+ y += si.nPos;
+
nsw32_cw->mouse(nsw32_cw, button, x, y);
return 0;
}
static LRESULT
nsw32_corewindow_mouseup(struct nsw32_corewindow *nsw32_cw,
+ HWND hwnd,
int x, int y,
browser_mouse_state button)
{
+ SCROLLINFO si; /* scroll information */
+
+ /* get scroll positions */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ x += si.nPos;
+ GetScrollInfo(hwnd, SB_VERT, &si);
+ y += si.nPos;
+
nsw32_cw->mouse(nsw32_cw, button, x, y);
return 0;
}
@@ -342,25 +364,25 @@ nsw32_window_corewindow_event_callback(HWND hwnd,
return nsw32_corewindow_hscroll(nsw32_cw, hwnd, wparam);
case WM_LBUTTONDOWN:
- return nsw32_corewindow_mousedown(nsw32_cw,
+ return nsw32_corewindow_mousedown(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_PRESS_1);
case WM_RBUTTONDOWN:
- return nsw32_corewindow_mousedown(nsw32_cw,
+ return nsw32_corewindow_mousedown(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_PRESS_2);
case WM_LBUTTONUP:
- return nsw32_corewindow_mouseup(nsw32_cw,
+ return nsw32_corewindow_mouseup(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_CLICK_1);
case WM_RBUTTONUP:
- return nsw32_corewindow_mouseup(nsw32_cw,
+ return nsw32_corewindow_mouseup(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_CLICK_2);
@@ -393,14 +415,22 @@ nsw32_cw_invalidate_area(struct core_window *cw, const struct rect *rect)
RECT redrawrect;
if (rect != NULL) {
- redrawrectp = &redrawrect;
+ SCROLLINFO si; /* scroll information */
+
+ /* get scroll positions */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(nsw32_cw->hWnd, SB_HORZ, &si);
+ redrawrect.left = (long)rect->x0 - si.nPos;
+ redrawrect.right = (long)rect->x1 - si.nPos;
- redrawrect.left = (long)rect->x0;
- redrawrect.top = (long)rect->y0;
- redrawrect.right =(long)rect->x1;
- redrawrect.bottom = (long)rect->y1;
+ GetScrollInfo(nsw32_cw->hWnd, SB_VERT, &si);
+ redrawrect.top = (long)rect->y0 - si.nPos;
+ redrawrect.bottom = (long)rect->y1 - si.nPos;
+ redrawrectp = &redrawrect;
}
+
RedrawWindow(nsw32_cw->hWnd,
redrawrectp,
NULL,