summaryrefslogtreecommitdiff
path: root/frontends/windows/drawable.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/windows/drawable.c')
-rw-r--r--frontends/windows/drawable.c71
1 files changed, 47 insertions, 24 deletions
diff --git a/frontends/windows/drawable.c b/frontends/windows/drawable.c
index cb9429139..f491e0a2a 100644
--- a/frontends/windows/drawable.c
+++ b/frontends/windows/drawable.c
@@ -16,6 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * win32 implementation of drawable window showing browser context
+ */
+
#include <stdbool.h>
#include <stdint.h>
@@ -33,11 +38,12 @@
#include "windows/windbg.h"
#include "windows/plot.h"
#include "windows/window.h"
-#include "windows/localhistory.h"
+#include "windows/local_history.h"
#include "windows/drawable.h"
static const char windowclassname_drawable[] = "nswsdrawablewindow";
+
/**
* Handle wheel scroll messages.
*/
@@ -66,6 +72,7 @@ nsws_drawable_wheel(struct gui_window *gw, HWND hwnd, WPARAM wparam)
return 0;
}
+
/**
* Handle vertical scroll messages.
*/
@@ -76,7 +83,7 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
SCROLLINFO si;
int mem;
- LOG("VSCROLL %d", gw->requestscrolly);
+ NSLOG(netsurf, INFO, "VSCROLL %d", gw->requestscrolly);
if (gw->requestscrolly != 0)
return 0;
@@ -121,8 +128,8 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
si.fMask = SIF_POS;
if ((gw->bw != NULL) &&
- (browser_window_get_extents(gw->bw, true,
- &width, &height) == NSERROR_OK)) {
+ (browser_window_get_extents(gw->bw, true,
+ &width, &height) == NSERROR_OK)) {
si.nPos = min(si.nPos, height - gw->height);
}
@@ -130,8 +137,10 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
GetScrollInfo(hwnd, SB_VERT, &si);
if (si.nPos != mem) {
- win32_window_set_scroll(gw, gw->scrollx, gw->scrolly +
- gw->requestscrolly + si.nPos - mem);
+ struct rect rect;
+ rect.x0 = rect.x1 = gw->scrollx;
+ rect.y0 = rect.y1 = gw->scrolly + gw->requestscrolly + si.nPos - mem;
+ win32_window_set_scroll(gw, &rect);
}
return 0;
@@ -148,7 +157,7 @@ nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
SCROLLINFO si;
int mem;
- LOG("HSCROLL %d", gw->requestscrollx);
+ NSLOG(netsurf, INFO, "HSCROLL %d", gw->requestscrollx);
if (gw->requestscrollx != 0)
return 0;
@@ -186,22 +195,24 @@ nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
si.fMask = SIF_POS;
if ((gw->bw != NULL) &&
- (browser_window_get_extents(gw->bw, true,
- &width, &height) == NSERROR_OK)) {
+ (browser_window_get_extents(gw->bw, true,
+ &width, &height) == NSERROR_OK)) {
si.nPos = min(si.nPos, width - gw->width);
}
si.nPos = max(si.nPos, 0);
SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
GetScrollInfo(hwnd, SB_HORZ, &si);
if (si.nPos != mem) {
- win32_window_set_scroll(gw,
- gw->scrollx + gw->requestscrollx + si.nPos - mem,
- gw->scrolly);
+ struct rect rect;
+ rect.x0 = rect.x1 = gw->scrollx + gw->requestscrollx + si.nPos - mem;
+ rect.y0 = rect.y1 = gw->scrolly;
+ win32_window_set_scroll(gw, &rect);
}
return 0;
}
+
/**
* Handle resize events.
*/
@@ -212,6 +223,7 @@ nsws_drawable_resize(struct gui_window *gw)
return 0;
}
+
/**
* Handle key press messages.
*/
@@ -289,7 +301,7 @@ nsws_drawable_key(struct gui_window *gw, HWND hwnd, WPARAM wparam)
break;
}
- if ((i >= 'A') &&
+ if ((i >= 'A') &&
(i <= 'Z') &&
(((!capslock) && (!shift)) || ((capslock) && (shift)))) {
i += 'a' - 'A';
@@ -357,7 +369,8 @@ nsws_drawable_mouseup(struct gui_window *gw,
(gw->bw == NULL))
return 0;
- LOG("state 0x%x, press 0x%x", gw->mouse->state, press);
+ NSLOG(netsurf, INFO, "state 0x%x, press 0x%x", gw->mouse->state,
+ press);
if ((gw->mouse->state & press) != 0) {
gw->mouse->state &= ~press;
gw->mouse->state |= click;
@@ -371,7 +384,10 @@ nsws_drawable_mouseup(struct gui_window *gw,
gw->mouse->state &= ~BROWSER_MOUSE_MOD_3;
if ((gw->mouse->state & click) != 0) {
- LOG("mouse click bw %p, state 0x%x, x %f, y %f", gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, (y + gw->scrolly) / gw->scale);
+ NSLOG(netsurf, INFO,
+ "mouse click bw %p, state 0x%x, x %f, y %f", gw->bw,
+ gw->mouse->state, (x + gw->scrollx) / gw->scale,
+ (y + gw->scrolly) / gw->scale);
browser_window_mouse_click(gw->bw,
gw->mouse->state,
@@ -400,7 +416,7 @@ nsws_drawable_mousedown(struct gui_window *gw,
if ((gw == NULL) ||
(gw->mouse == NULL) ||
(gw->bw == NULL)) {
- nsws_localhistory_close(gw);
+ nsw32_local_history_hide();
return 0;
}
@@ -415,7 +431,9 @@ nsws_drawable_mousedown(struct gui_window *gw,
gw->mouse->pressed_x = (x + gw->scrollx) / gw->scale;
gw->mouse->pressed_y = (y + gw->scrolly) / gw->scale;
- LOG("mouse click bw %p, state %x, x %f, y %f", gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, (y + gw->scrolly) / gw->scale);
+ NSLOG(netsurf, INFO, "mouse click bw %p, state %x, x %f, y %f",
+ gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale,
+ (y + gw->scrolly) / gw->scale);
browser_window_mouse_click(gw->bw, gw->mouse->state,
(x + gw->scrollx) / gw->scale,
@@ -424,6 +442,7 @@ nsws_drawable_mousedown(struct gui_window *gw,
return 0;
}
+
/**
* Handle mouse movement messages.
*/
@@ -447,7 +466,8 @@ nsws_drawable_mousemove(struct gui_window *gw, int x, int y)
(abs(x - gw->mouse->pressed_x) >= 5) &&
(abs(y - gw->mouse->pressed_y) >= 5)) {
- LOG("Drag start state 0x%x", gw->mouse->state);
+ NSLOG(netsurf, INFO, "Drag start state 0x%x",
+ gw->mouse->state);
if ((gw->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) {
browser_window_mouse_click(gw->bw, BROWSER_MOUSE_DRAG_1,
@@ -480,6 +500,7 @@ nsws_drawable_mousemove(struct gui_window *gw, int x, int y)
return 0;
}
+
/**
* Called when activity occours within the drawable window.
*/
@@ -495,7 +516,8 @@ nsws_window_drawable_event_callback(HWND hwnd,
gw = nsws_get_gui_window(hwnd);
if (gw == NULL) {
- LOG("Unable to find gui window structure for hwnd %p", hwnd);
+ NSLOG(netsurf, INFO,
+ "Unable to find gui window structure for hwnd %p", hwnd);
return DefWindowProc(hwnd, msg, wparam, lparam);
}
@@ -512,9 +534,8 @@ nsws_window_drawable_event_callback(HWND hwnd,
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_PRESS_1);
SetFocus(hwnd);
- nsws_localhistory_close(gw);
+ nsw32_local_history_hide();
return 0;
- break;
case WM_RBUTTONDOWN:
nsws_drawable_mousedown(gw,
@@ -564,12 +585,13 @@ nsws_window_drawable_event_callback(HWND hwnd,
return DefWindowProc(hwnd, msg, wparam, lparam);
}
+
/**
* Create a drawable window.
*/
HWND
-nsws_window_create_drawable(HINSTANCE hinstance,
- HWND hparent,
+nsws_window_create_drawable(HINSTANCE hinstance,
+ HWND hparent,
struct gui_window *gw)
{
HWND hwnd;
@@ -584,7 +606,7 @@ nsws_window_create_drawable(HINSTANCE hinstance,
if (hwnd == NULL) {
win_perror("WindowCreateDrawable");
- LOG("Window creation failed");
+ NSLOG(netsurf, INFO, "Window creation failed");
return NULL;
}
@@ -594,6 +616,7 @@ nsws_window_create_drawable(HINSTANCE hinstance,
return hwnd;
}
+
/**
* Create the drawable window class.
*/