From: johncoswell Date: Mon, 4 Sep 2006 15:51:48 +0000 (+0000) Subject: Fix race condition where node dragging is not ended after mouse button is released X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6c2f88ab09e534e564966d6bbd6ff5dd198fff34;p=inkscape.git Fix race condition where node dragging is not ended after mouse button is released --- diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 3398ac1a1..067cf5435 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -992,7 +992,7 @@ static void sp_nodepath_selected_nodes_move(Inkscape::NodePath::Path *nodepath, } for (GList *l = nodepath->selected; l != NULL; l = l->next) { - Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data; + Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data; sp_node_moveto(n, n->pos + best_pt); } @@ -2985,6 +2985,8 @@ static void node_grabbed(SPKnot *knot, guint state, gpointer data) sp_nodepath_node_select(n, (state & GDK_SHIFT_MASK), FALSE); } + n->is_dragging = true; + sp_nodepath_remember_origins (n->subpath->nodepath); } @@ -2996,6 +2998,7 @@ static void node_ungrabbed(SPKnot *knot, guint state, gpointer data) Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) data; n->dragging_out = NULL; + n->is_dragging = false; sp_nodepath_update_repr(n->subpath->nodepath, _("Move nodes")); } @@ -3198,14 +3201,16 @@ node_request(SPKnot *knot, NR::Point *p, guint state, gpointer data) } } } else { // move freely - if (state & GDK_MOD1_MASK) { // sculpt - sp_nodepath_selected_nodes_sculpt(n->subpath->nodepath, n, (*p) - n->origin); - } else { - sp_nodepath_selected_nodes_move(n->subpath->nodepath, - (*p)[NR::X] - n->pos[NR::X], - (*p)[NR::Y] - n->pos[NR::Y], - (state & GDK_SHIFT_MASK) == 0); - } + if (n->is_dragging) { + if (state & GDK_MOD1_MASK) { // sculpt + sp_nodepath_selected_nodes_sculpt(n->subpath->nodepath, n, (*p) - n->origin); + } else { + sp_nodepath_selected_nodes_move(n->subpath->nodepath, + (*p)[NR::X] - n->pos[NR::X], + (*p)[NR::Y] - n->pos[NR::Y], + (state & GDK_SHIFT_MASK) == 0); + } + } } n->subpath->nodepath->desktop->scroll_to_point(p); diff --git a/src/nodepath.h b/src/nodepath.h index 21c2957aa..856740038 100644 --- a/src/nodepath.h +++ b/src/nodepath.h @@ -228,6 +228,9 @@ class Node { /** The pointer to the nodeside which we are dragging out with Shift */ NodeSide *dragging_out; + + /** Boolean. Am I being dragged? */ + guint is_dragging : 1; }; } // namespace NodePath