From e1f5bd884e13b05ad6cde144c285f5325ba172d3 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Wed, 18 Apr 2007 01:46:21 +0000 Subject: [PATCH] fix crash when pressing space while drawing a shape --- src/arc-context.cpp | 15 +++++++++++++++ src/rect-context.cpp | 15 +++++++++++++++ src/spiral-context.cpp | 15 +++++++++++++++ src/star-context.cpp | 15 +++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/src/arc-context.cpp b/src/arc-context.cpp index db64d7951..4a8d6b9d1 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -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; } diff --git a/src/rect-context.cpp b/src/rect-context.cpp index b6c331538..c8f9bf0f1 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -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; } diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index bdc7c65c7..1fcbc29a9 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -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; } diff --git a/src/star-context.cpp b/src/star-context.cpp index d6e9f8583..bb002ec89 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -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; } -- 2.30.2