Stop treeview items moving when they've been dragged outside the treeview window.

This commit is contained in:
Chris Young 2014-05-24 11:46:14 +01:00
parent 15d95ddcf8
commit 92d29c26d4

View File

@ -304,18 +304,19 @@ void ami_tree_drag_end(struct treeview_window *twin, int x, int y)
BOOL drag;
nsurl *url = NULL;
const char *title = NULL;
bool ok = false;
if(drag = ami_drag_in_progress()) ami_drag_icon_close(twin->win);
if(drag && (twin != ami_window_at_pointer(AMINS_TVWINDOW)))
{
if((twin->type == AMI_TREE_HOTLIST) && (hotlist_has_selection())) {
hotlist_get_selection(&url, &title);
ok = hotlist_get_selection(&url, &title);
} else if((twin->type == AMI_TREE_HISTORY) && (global_history_has_selection())) {
global_history_get_selection(&url, &title);
ok = global_history_get_selection(&url, &title);
}
if((title == NULL) || (title && (url == NULL))) {
if((ok == false) || (url == NULL)) {
DisplayBeep(scrn);
} else if(url) {
if(gwin = ami_window_at_pointer(AMINS_WINDOW)) {
@ -331,9 +332,11 @@ void ami_tree_drag_end(struct treeview_window *twin, int x, int y)
hotlist_add_entry(url, title, true, y);
}
}
tree_mouse_action(twin->tree, twin->mouse_state | twin->key_state,
twin->drag_x, twin->drag_y); /* Keep the tree happy */
tree_drag_end(twin->tree, twin->mouse_state,
twin->drag_x, twin->drag_y,
twin->drag_x, twin->drag_y); /* Keep the tree happy */
twin->drag_x, twin->drag_y); /* Keep the tree happier */
} else {
if(tree_drag_status(twin->tree) == TREE_UNKNOWN_DRAG)
DisplayBeep(scrn);