Don\'t pass spurious drag event data to the core treeview.

svn path=/trunk/netsurf/; revision=11090
This commit is contained in:
Steve Fryatt 2010-12-17 17:13:34 +00:00
parent d5b18c69fd
commit cef10de11b

View File

@ -791,6 +791,9 @@ void ro_treeview_mouse_at(wimp_w w, wimp_pointer *pointer)
int xpos, ypos;
browser_mouse_state mouse;
if (pointer->buttons & (wimp_CLICK_MENU))
return;
tv = (ro_treeview *) ro_gui_wimp_event_get_user_data(pointer->w);
if (tv == NULL) {
LOG(("NULL treeview block for window: 0x%x",
@ -798,6 +801,13 @@ void ro_treeview_mouse_at(wimp_w w, wimp_pointer *pointer)
return;
}
if (!tv->drag)
return;
/* We know now that it's not a Menu click and the treeview thinks
* that a drag is in progress.
*/
state.w = tv->w;
error = xwimp_get_window_state(&state);
if (error) {
@ -818,21 +828,15 @@ void ro_treeview_mouse_at(wimp_w w, wimp_pointer *pointer)
/* Start to process the mouse click. */
mouse = 0;
mouse = ro_gui_mouse_drag_state(pointer->buttons,
wimp_BUTTON_DOUBLE_CLICK_DRAG);
if (!(pointer->buttons & (wimp_CLICK_MENU))) {
mouse = ro_gui_mouse_drag_state(pointer->buttons,
wimp_BUTTON_DOUBLE_CLICK_DRAG);
if (mouse != 0)
tree_mouse_action(tv->tree, mouse, xpos, ypos);
/* Check if drag ended and tell core */
if (tv->drag && !(mouse & BROWSER_MOUSE_DRAG_ON)) {
tree_drag_end(tv->tree, mouse, tv->drag_start.x,
tv->drag_start.y, xpos, ypos);
tv->drag = false;
}
tree_mouse_action(tv->tree, mouse, xpos, ypos);
if (!(mouse & BROWSER_MOUSE_DRAG_ON)) {
tree_drag_end(tv->tree, mouse, tv->drag_start.x,
tv->drag_start.y, xpos, ypos);
tv->drag = false;
}
}