From 1619e274a9d9193fbd6df1b7817beaa96d030e6a Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 1 Aug 2009 12:29:37 +0000 Subject: When switching context by pressing a key, while dragging to create a new shape, the original context should be finished properly and sp_canvas_item_ungrab should be called. set_event_context() was looking for e.g. sp_rect_context_finish, but this wasn't implemented for any of the shape tools. This closes bug #195101 (bzr r8375) --- src/star-context.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/star-context.cpp') diff --git a/src/star-context.cpp b/src/star-context.cpp index 80d378f27..3d6825e31 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -52,6 +52,7 @@ static void sp_star_context_init (SPStarContext * star_context); static void sp_star_context_dispose (GObject *object); static void sp_star_context_setup (SPEventContext *ec); +static void sp_star_context_finish(SPEventContext *ec); static void sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_star_context_root_handler (SPEventContext *ec, GdkEvent *event); @@ -92,6 +93,7 @@ sp_star_context_class_init (SPStarContextClass * klass) object_class->dispose = sp_star_context_dispose; event_context_class->setup = sp_star_context_setup; + event_context_class->finish = sp_star_context_finish; event_context_class->set = sp_star_context_set; event_context_class->root_handler = sp_star_context_root_handler; } @@ -119,6 +121,21 @@ sp_star_context_init (SPStarContext * star_context) new (&star_context->sel_changed_connection) sigc::connection(); } +static void sp_star_context_finish(SPEventContext *ec) +{ + SPStarContext *sc = SP_STAR_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_star_finish(sc); + sc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + + static void sp_star_context_dispose (GObject *object) { -- cgit v1.2.3