Code

trying to nail the elusive disabled-mouse bug: if you're going to grab something...
authorbuliabyak <buliabyak@users.sourceforge.net>
Wed, 22 Nov 2006 01:35:24 +0000 (01:35 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Wed, 22 Nov 2006 01:35:24 +0000 (01:35 +0000)
src/select-context.cpp

index d883483b379d096ba9e4603601d9bebb00729ff5..5d8babe57313862d82c2a7e96130a75abb10cb6f 100644 (file)
@@ -328,6 +328,10 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
 
                     rb_escaped = drag_escaped = 0;
 
+                    if (sc->grabbed) {
+                        sp_canvas_item_ungrab(sc->grabbed, event->button.time);
+                        sc->grabbed = NULL;
+                    }
                     sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->drawing),
                                         GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK |
                                         GDK_POINTER_MOTION_MASK,
@@ -430,6 +434,10 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 NR::Point const button_pt(event->button.x, event->button.y);
                 NR::Point const p(desktop->w2d(button_pt));
                 Inkscape::Rubberband::get()->start(desktop, p);
+                if (sc->grabbed) {
+                    sp_canvas_item_ungrab(sc->grabbed, event->button.time);
+                    sc->grabbed = NULL;
+                }
                 sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
                                     GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK,
                                     NULL, event->button.time);