summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-03-09 20:19:01 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-03-09 20:19:01 +0000
commita50bbcf0ee5b96e54cc956339a427bc3330df228 (patch)
treeecacf9e73822a8432a5d73af531a93d78f62aa06 /src
parentYet another round of translation update (diff)
downloadinkscape-a50bbcf0ee5b96e54cc956339a427bc3330df228.tar.gz
inkscape-a50bbcf0ee5b96e54cc956339a427bc3330df228.zip
Fix #338838, in which zooming and panning with the middle mouse button made Inkscape inrespronsive
(bzr r7461)
Diffstat (limited to 'src')
-rw-r--r--src/display/sp-canvas.cpp1
-rw-r--r--src/knot.cpp22
-rw-r--r--src/knotholder.cpp4
-rw-r--r--src/node-context.cpp17
-rw-r--r--src/nodepath.cpp4
5 files changed, 32 insertions, 16 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 75a1f4e63..0f9e883ed 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -1681,6 +1681,7 @@ gboolean sp_canvas_snap_watchdog_callback(gpointer data)
dt->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(false);
}
+ ((GdkEventMotion *)canvas->watchdog_event)->time = GDK_CURRENT_TIME;
emit_event(canvas, canvas->watchdog_event);
gdk_event_free(canvas->watchdog_event);
canvas->watchdog_event = NULL;
diff --git a/src/knot.cpp b/src/knot.cpp
index cf1a3e944..fab622bbd 100644
--- a/src/knot.cpp
+++ b/src/knot.cpp
@@ -285,7 +285,9 @@ void sp_knot_start_dragging(SPKnot *knot, Geom::Point const &p, gint x, gint y,
*/
static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot)
{
- g_assert(knot != NULL);
+ static bool snap_delay_temporarily_active = false;
+
+ g_assert(knot != NULL);
g_assert(SP_IS_KNOT(knot));
/* Run client universal event handler, if present */
@@ -316,6 +318,10 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
if (event->button.button == 1 && !knot->desktop->event_context->space_panning) {
Geom::Point const p = knot->desktop->w2d(Geom::Point(event->button.x, event->button.y));
sp_knot_start_dragging(knot, p, (gint) event->button.x, (gint) event->button.y, event->button.time);
+ if (knot->desktop->canvas->context_snap_delay_active == false) {
+ sp_canvas_set_snap_delay_active(knot->desktop->canvas, true);
+ snap_delay_temporarily_active = true;
+ }
consumed = TRUE;
}
break;
@@ -347,6 +353,13 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
grabbed = FALSE;
moved = FALSE;
consumed = TRUE;
+
+ if (snap_delay_temporarily_active) {
+ if (knot->desktop->canvas->context_snap_delay_active == true) {
+ sp_canvas_set_snap_delay_active(knot->desktop->canvas, false);
+ }
+ snap_delay_temporarily_active = false;
+ }
}
}
break;
@@ -411,7 +424,6 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
grabbed = FALSE;
moved = FALSE;
-
consumed = TRUE;
break;
case GDK_KEY_PRESS: // keybindings for knot
@@ -435,6 +447,10 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
}
grabbed = FALSE;
moved = FALSE;
+ if (snap_delay_temporarily_active) {
+ sp_canvas_set_snap_delay_active(knot->desktop->canvas, false);
+ snap_delay_temporarily_active = false;
+ }
break;
default:
consumed = FALSE;
@@ -568,7 +584,7 @@ void sp_knot_set_position(SPKnot *knot, Geom::Point const &p, guint state)
}
/**
- * Move knot to new position, without emitting a MOVED signal.
+ * Move knot to new position, without emitting a MOVED signal.
*/
void sp_knot_moveto(SPKnot *knot, Geom::Point const &p)
{
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index eaf5658f8..60c1f8084 100644
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
@@ -139,7 +139,7 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state)
{
if (this->dragging == false) {
this->dragging = true;
- sp_canvas_set_snap_delay_active(desktop->canvas, true);
+ //sp_canvas_set_snap_delay_active(desktop->canvas, true);
}
// this was a local change and the knotholder does not need to be recreated:
@@ -165,7 +165,7 @@ void
KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/)
{
this->dragging = false;
- sp_canvas_set_snap_delay_active(desktop->canvas, false);
+ //sp_canvas_set_snap_delay_active(desktop->canvas, false);
if (this->released) {
this->released(this->item);
diff --git a/src/node-context.cpp b/src/node-context.cpp
index 57af59bd4..f40d1b7fc 100644
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
@@ -116,8 +116,6 @@ sp_node_context_dispose(GObject *object)
SPNodeContext *nc = SP_NODE_CONTEXT(object);
SPEventContext *ec = SP_EVENT_CONTEXT(object);
- sp_canvas_set_snap_delay_active(ec->desktop->canvas, false);
-
ec->enableGrDrag(false);
nc->sel_changed_connection.disconnect();
@@ -175,8 +173,6 @@ sp_node_context_setup(SPEventContext *ec)
nc->_node_message_context = new Inkscape::MessageContext((ec->desktop)->messageStack());
ec->shape_editor->update_statusbar();
-
- sp_canvas_set_snap_delay_active(ec->desktop->canvas, true);
}
static void
@@ -298,7 +294,8 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (!(event->button.state & GDK_SHIFT_MASK)) {
if (!nc->drag) {
if (se->has_nodepath() && selection->single() /* && item_over */) {
- // save drag origin
+ sp_canvas_set_snap_delay_active(desktop->canvas, true);
+ // save drag origin
bool over_stroke = se->is_over_stroke(Geom::Point(event->button.x, event->button.y), true);
//only dragging curves
if (over_stroke) {
@@ -412,7 +409,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (over_stroke || nc->added_node) {
switch (event->type) {
case GDK_BUTTON_RELEASE:
- if (event->button.state & GDK_CONTROL_MASK && event->button.state & GDK_MOD1_MASK) {
+ if (event->button.state & GDK_CONTROL_MASK && event->button.state & GDK_MOD1_MASK) {
//add a node
se->add_node_near_point();
} else {
@@ -428,11 +425,13 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
}
desktop->updateNow();
}
+ sp_canvas_set_snap_delay_active(desktop->canvas, false);
break;
case GDK_2BUTTON_PRESS:
//add a node
se->add_node_near_point();
nc->added_node = true;
+ sp_canvas_set_snap_delay_active(desktop->canvas, false);
break;
default:
break;
@@ -450,16 +449,16 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
}
}
if (event->type == GDK_BUTTON_RELEASE) {
- event_context->xp = event_context->yp = 0;
+ event_context->xp = event_context->yp = 0;
if (event->button.button == 1) {
- Geom::OptRect b = Inkscape::Rubberband::get(desktop)->getRectangle();
+ Geom::OptRect b = Inkscape::Rubberband::get(desktop)->getRectangle();
if (se->hits_curve() && !event_context->within_tolerance) { //drag curve
se->finish_drag();
} else if (b && !event_context->within_tolerance) { // drag to select
se->select_rect(*b, event->button.state & GDK_SHIFT_MASK);
} else {
- if (!(nc->rb_escaped)) { // unless something was cancelled
+ if (!(nc->rb_escaped)) { // unless something was canceled
if (se->has_selection())
se->deselect();
else
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 318649e5f..51d4b9bef 100644
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -3587,7 +3587,7 @@ static void node_grabbed(SPKnot *knot, guint state, gpointer data)
}
n->is_dragging = true;
- sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, true);
+ //sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, true);
// Reconstruct and store the location of the mouse pointer at the time when we started dragging (needed for snapping)
n->subpath->nodepath->drag_origin_mouse = knot->grabbed_rel_pos + knot->drag_origin;
@@ -3605,7 +3605,7 @@ static void node_ungrabbed(SPKnot */*knot*/, guint /*state*/, gpointer data)
n->dragging_out = NULL;
n->is_dragging = false;
- sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, false);
+ //sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, false);
n->subpath->nodepath->drag_origin_mouse = Geom::Point(NR_HUGE, NR_HUGE);
sp_canvas_end_forced_full_redraws(n->subpath->nodepath->desktop->canvas);