Frame drag start function can take child bw. Don't need to get root bw in html handler. Avoids bw dereferences.

This commit is contained in:
Michael Drake 2012-08-16 16:14:15 +01:00
parent 195a77a4cd
commit 6daf6c178d
2 changed files with 13 additions and 13 deletions

View File

@ -933,5 +933,11 @@ bool browser_window_frame_resize_start(struct browser_window *bw,
browser_mouse_state mouse, int x, int y,
gui_pointer_shape *pointer)
{
return browser_window_resize_frames(bw, mouse, x, y, pointer);
struct browser_window *root = browser_window_get_root(bw);
int offx, offy;
browser_window_get_position(bw, true, &offx, &offy);
return browser_window_resize_frames(root, mouse,
x + offx, y + offy, pointer);
}

View File

@ -581,19 +581,13 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
bool done = false;
/* frame resizing */
if (bw->parent) {
struct browser_window *parent;
for (parent = bw->parent; parent->parent;
parent = parent->parent);
if (browser_window_frame_resize_start(parent, mouse,
x + bw->x, y + bw->y,
&pointer)) {
if (mouse & (BROWSER_MOUSE_DRAG_1 |
BROWSER_MOUSE_DRAG_2)) {
status = messages_get("FrameDrag");
}
done = true;
if (browser_window_frame_resize_start(bw, mouse, x, y,
&pointer)) {
if (mouse & (BROWSER_MOUSE_DRAG_1 |
BROWSER_MOUSE_DRAG_2)) {
status = messages_get("FrameDrag");
}
done = true;
}
/* if clicking in the main page, remove the selection from any