mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-11 13:29:21 +03:00
Improve browser window drag tracking, so that drags in internal browser windows (iframes) carry on if pointer goes outside the bw that owns the drag.
svn path=/trunk/netsurf/; revision=12663
This commit is contained in:
parent
24110be310
commit
a47dff15dd
@ -324,6 +324,13 @@ void browser_window_set_position(struct browser_window *bw, int x, int y)
|
||||
void browser_window_set_drag_type(struct browser_window *bw,
|
||||
browser_drag_type type)
|
||||
{
|
||||
struct browser_window *top_bw = browser_window_get_root(bw);
|
||||
|
||||
if (type == DRAGGING_NONE)
|
||||
top_bw->drag_window = NULL;
|
||||
else
|
||||
top_bw->drag_window = bw;
|
||||
|
||||
bw->drag_type = type;
|
||||
}
|
||||
|
||||
@ -1857,6 +1864,24 @@ void browser_window_mouse_track(struct browser_window *bw,
|
||||
const char *status = NULL;
|
||||
gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
|
||||
|
||||
if (bw->window != NULL) {
|
||||
/* root browser window */
|
||||
if (bw->drag_window) {
|
||||
/* There's an active drag in a sub window.
|
||||
* Pass the mouse action straight on to that bw. */
|
||||
int off_x = 0;
|
||||
int off_y = 0;
|
||||
|
||||
browser_window_get_position(bw->drag_window, true,
|
||||
&off_x, &off_y);
|
||||
|
||||
browser_window_mouse_track(bw->drag_window, mouse,
|
||||
x - off_x / bw->scale,
|
||||
y - off_y / bw->scale);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == NULL && bw->drag_type != DRAGGING_FRAME)
|
||||
return;
|
||||
|
||||
|
@ -104,6 +104,9 @@ struct browser_window {
|
||||
/** Current drag status. */
|
||||
browser_drag_type drag_type;
|
||||
|
||||
/** Current drag's browser window, when not in root bw. */
|
||||
struct browser_window *drag_window;
|
||||
|
||||
/** Mouse position at start of current scroll drag. */
|
||||
int drag_start_x;
|
||||
int drag_start_y;
|
||||
|
Loading…
Reference in New Issue
Block a user