Code

Some minor snap-delay modifications
authordvlierop2 <dvlierop2@users.sourceforge.net>
Tue, 31 Mar 2009 19:53:28 +0000 (19:53 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Tue, 31 Mar 2009 19:53:28 +0000 (19:53 +0000)
src/event-context.cpp
src/knot.cpp
src/node-context.cpp

index 5b845388bce1c8bdd44fd7a226d237fdf5850463..e228497985db5fb1259178c0853bf1f37fa1548f 100644 (file)
@@ -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:
index ae8a7f7c500c32aeb8516d99efa74fe0acda6c2b..5c821f9092e55611c2da307ed24d0bd941a6d976 100644 (file)
@@ -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) {
index 44dbabcb0dbf059310b0002621f10148d8464c95..a28e0d6bcf4d4ee6591950d3a544cd6c0ce5bbef 100644 (file)
@@ -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;