Code

fix crash when pressing space while drawing a shape
authorbuliabyak <buliabyak@users.sourceforge.net>
Wed, 18 Apr 2007 01:46:21 +0000 (01:46 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Wed, 18 Apr 2007 01:46:21 +0000 (01:46 +0000)
src/arc-context.cpp
src/rect-context.cpp
src/spiral-context.cpp
src/star-context.cpp

index db64d79511c95671037b286467fd697a41625182..4a8d6b9d1c55604b4844d7459c5b456d2a07faaf 100644 (file)
@@ -357,6 +357,21 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
                 case GDK_Escape:
                     sp_desktop_selection(desktop)->clear();
                     //TODO: make dragging escapable by Esc
+                    break;
+
+                case GDK_space:
+                    if (dragging) {
+                        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+                                              event->button.time);
+                        dragging = false;
+                        if (!event_context->within_tolerance) {
+                            // we've been dragging, finish the rect
+                            sp_arc_finish(ac);
+                        }
+                        // do not return true, so that space would work switching to selector
+                    }
+                    break;
+
                 default:
                     break;
             }
index b6c3315384918635cfac39ade944a4493d7b04c6..c8f9bf0f101d0b1e2cc9e3b50a79bf49b5f3dc13 100644 (file)
@@ -400,6 +400,21 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
         case GDK_Escape:
             sp_desktop_selection(desktop)->clear();
             //TODO: make dragging escapable by Esc
+            break;
+
+        case GDK_space:
+            if (dragging) {
+                sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+                                      event->button.time);
+                dragging = false;
+                if (!event_context->within_tolerance) {
+                    // we've been dragging, finish the rect
+                    sp_rect_finish(rc);
+                }
+                // do not return true, so that space would work switching to selector
+            }
+            break;
+
         default:
             break;
         }
index bdc7c65c70bb5c2532127f1c0b1f9a2b796c8ef0..1fcbc29a9eb9927aa10b110c16613ce3dc5c1b41 100644 (file)
@@ -354,6 +354,21 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 case GDK_Escape:
                     sp_desktop_selection(desktop)->clear();
                     //TODO: make dragging escapable by Esc
+                    break;
+
+                case GDK_space:
+                    if (dragging) {
+                        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+                                              event->button.time);
+                        dragging = false;
+                        if (!event_context->within_tolerance) {
+                            // we've been dragging, finish the rect
+                            sp_spiral_finish(sc);
+                        }
+                        // do not return true, so that space would work switching to selector
+                    }
+                    break;
+
                 default:
                     break;
             }
index d6e9f85837cdb08590db09e35d3491f7afdc59f5..bb002ec893215ff57d463aa650336be6ab7f4d36 100644 (file)
@@ -364,6 +364,21 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
         case GDK_Escape:
             sp_desktop_selection(desktop)->clear();
             //TODO: make dragging escapable by Esc
+            break;
+
+        case GDK_space:
+            if (dragging) {
+                sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+                                      event->button.time);
+                dragging = false;
+                if (!event_context->within_tolerance) {
+                    // we've been dragging, finish the rect
+                    sp_star_finish(sc);
+                }
+                // do not return true, so that space would work switching to selector
+            }
+            break;
+
         default:
             break;
         }