From: dvlierop2 Date: Tue, 31 Mar 2009 19:53:28 +0000 (+0000) Subject: Some minor snap-delay modifications X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=10850f5b20a7a7818087e474a8915f521aafe5dd;p=inkscape.git Some minor snap-delay modifications --- diff --git a/src/event-context.cpp b/src/event-context.cpp index 5b845388b..e22849798 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -902,7 +902,10 @@ sp_event_context_root_handler(SPEventContext * event_context, GdkEvent * event) sp_event_context_snap_delay_handler(event_context, NULL, NULL, (GdkEventMotion *)event, DelayedSnapEvent::EVENTCONTEXT_ROOT_HANDLER); break; case GDK_BUTTON_RELEASE: - sp_event_context_snap_watchdog_callback(event_context->_delayed_snap_event); // If we have any pending snapping action, then invoke it now + if (event_context->_delayed_snap_event) { + // If we have any pending snapping action, then invoke it now + sp_event_context_snap_watchdog_callback(event_context->_delayed_snap_event); + } break; case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: @@ -940,7 +943,10 @@ sp_event_context_item_handler(SPEventContext * event_context, SPItem * item, Gdk sp_event_context_snap_delay_handler(event_context, item, NULL, (GdkEventMotion *)event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER); break; case GDK_BUTTON_RELEASE: - sp_event_context_snap_watchdog_callback(event_context->_delayed_snap_event); // If we have any pending snapping action, then invoke it now + if (event_context->_delayed_snap_event) { + // If we have any pending snapping action, then invoke it now + sp_event_context_snap_watchdog_callback(event_context->_delayed_snap_event); + } break; /*case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: diff --git a/src/knot.cpp b/src/knot.cpp index ae8a7f7c5..5c821f909 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -332,7 +332,10 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot } snap_delay_temporarily_active = false; } - sp_event_context_snap_watchdog_callback(knot->desktop->event_context->_delayed_snap_event); + + if (knot->desktop->event_context->_delayed_snap_event) { + sp_event_context_snap_watchdog_callback(knot->desktop->event_context->_delayed_snap_event); + } knot->pressure = 0; if (transform_escaped) { diff --git a/src/node-context.cpp b/src/node-context.cpp index 44dbabcb0..a28e0d6bc 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -281,6 +281,8 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) nc->remove_flash_counter--; } + sp_event_context_snap_window_open(event_context, false); // Just put the snap window open, bluntly. Will be closed when we have left the context + gint ret = FALSE; switch (event->type) { case GDK_BUTTON_PRESS: @@ -294,7 +296,6 @@ 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 */) { - sp_event_context_snap_window_open(event_context); // save drag origin bool over_stroke = se->is_over_stroke(Geom::Point(event->button.x, event->button.y), true); //only dragging curves @@ -425,13 +426,11 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) } desktop->updateNow(); } - sp_event_context_snap_window_closed(event_context); - break; + break; case GDK_2BUTTON_PRESS: //add a node se->add_node_near_point(); nc->added_node = true; - sp_event_context_snap_window_closed(event_context); break; default: break;