diff options
Diffstat (limited to 'frontends/windows/corewindow.c')
-rw-r--r-- | frontends/windows/corewindow.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/frontends/windows/corewindow.c b/frontends/windows/corewindow.c index adf1c6552..3c31c5e46 100644 --- a/frontends/windows/corewindow.c +++ b/frontends/windows/corewindow.c @@ -211,7 +211,7 @@ nsw32_corewindow_vscroll(struct nsw32_corewindow *nsw32_cw, NULL, NULL, NULL, - SW_ERASE | SW_INVALIDATE); + SW_INVALIDATE); /** * /todo win32 corewindow vertical scrolling needs us to @@ -278,7 +278,7 @@ nsw32_corewindow_hscroll(struct nsw32_corewindow *nsw32_cw, NULL, NULL, NULL, - SW_ERASE | SW_INVALIDATE); + SW_INVALIDATE); return 0; } @@ -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, @@ -456,7 +486,7 @@ static void nsw32_cw_drag_status(struct core_window *cw, core_window_drag_status ds) { struct nsw32_corewindow *nsw32_cw = (struct nsw32_corewindow *)cw; - nsw32_cw->drag_staus = ds; + nsw32_cw->drag_status = ds; } @@ -478,6 +508,7 @@ nsw32_corewindow_init(HINSTANCE hInstance, /* setup the core window callback table */ nsw32_cw->cb_table = &nsw32_cw_cb_table; + nsw32_cw->drag_status = CORE_WINDOW_DRAG_NONE; /* start with the content area being as small as possible */ nsw32_cw->content_width = -1; |