From: buliabyak Date: Tue, 11 Aug 2009 01:40:49 +0000 (+0000) Subject: patch 168780 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9080fdeafac01d6276ebf19c07ca5805c6730d98;p=inkscape.git patch 168780 --- diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp index 985e3ac51..aa17ea859 100644 --- a/src/dropper-context.cpp +++ b/src/dropper-context.cpp @@ -129,6 +129,11 @@ static void sp_dropper_context_finish(SPEventContext *ec) SPDropperContext *dc = SP_DROPPER_CONTEXT(ec); ec->enableGrDrag(false); + + if (dc->grabbed) { + sp_canvas_item_ungrab(dc->grabbed, GDK_CURRENT_TIME); + dc->grabbed = NULL; + } if (dc->area) { gtk_object_destroy(GTK_OBJECT(dc->area)); @@ -171,6 +176,12 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv dc->dragging = TRUE; ret = TRUE; } + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + dc->grabbed = SP_CANVAS_ITEM(desktop->acetate); + break; case GDK_MOTION_NOTIFY: if (event->motion.state & GDK_BUTTON2_MASK) { @@ -311,6 +322,11 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv { sp_canvas_item_hide(dc->area); dc->dragging = FALSE; + + if (dc->grabbed) { + sp_canvas_item_ungrab(dc->grabbed, event->button.time); + dc->grabbed = NULL; + } double alpha_to_set = setalpha? dc->alpha : 1.0; diff --git a/src/dropper-context.h b/src/dropper-context.h index 678ab6b47..64181e3c8 100644 --- a/src/dropper-context.h +++ b/src/dropper-context.h @@ -32,6 +32,7 @@ struct SPDropperContext { unsigned int dragging : 1; + SPCanvasItem *grabbed; SPCanvasItem *area; Geom::Point centre; diff --git a/src/node-context.cpp b/src/node-context.cpp index a0fb78ba1..3535ae9e0 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -117,6 +117,11 @@ sp_node_context_dispose(GObject *object) SPEventContext *ec = SP_EVENT_CONTEXT(object); ec->enableGrDrag(false); + + if (nc->grabbed) { + sp_canvas_item_ungrab(nc->grabbed, GDK_CURRENT_TIME); + nc->grabbed = NULL; + } nc->sel_changed_connection.disconnect(); nc->sel_changed_connection.~connection(); @@ -327,6 +332,12 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) event->button.y); Geom::Point const button_dt(desktop->w2d(button_w)); Inkscape::Rubberband::get(desktop)->start(desktop, button_dt); + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + nc->grabbed = SP_CANVAS_ITEM(desktop->acetate); + nc->current_state = SP_NODE_CONTEXT_INACTIVE; desktop->updateNow(); ret = TRUE; @@ -483,6 +494,12 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) } ret = TRUE; Inkscape::Rubberband::get(desktop)->stop(); + + if (nc->grabbed) { + sp_canvas_item_ungrab(nc->grabbed, event->button.time); + nc->grabbed = NULL; + } + desktop->updateNow(); nc->rb_escaped = false; nc->drag = FALSE; diff --git a/src/node-context.h b/src/node-context.h index 0e141274f..2345ffc7e 100644 --- a/src/node-context.h +++ b/src/node-context.h @@ -57,6 +57,7 @@ struct SPNodeContext { unsigned int current_state; SPItem * flashed_item; + SPCanvasItem *grabbed; Inkscape::Display::TemporaryItem * flash_tempitem; int remove_flash_counter; }; diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp index 2f0185731..f8212069e 100644 --- a/src/zoom-context.cpp +++ b/src/zoom-context.cpp @@ -18,6 +18,7 @@ #include "macros.h" #include "rubberband.h" +#include "display/sp-canvas-util.h" #include "desktop.h" #include "pixmaps/cursor-zoom.xpm" #include "pixmaps/cursor-zoom-out.xpm" @@ -86,7 +87,14 @@ static void sp_zoom_context_init (SPZoomContext *zoom_context) static void sp_zoom_context_finish (SPEventContext *ec) { + SPZoomContext *zc = SP_ZOOM_CONTEXT(ec); + ec->enableGrDrag(false); + + if (zc->grabbed) { + sp_canvas_item_ungrab(zc->grabbed, GDK_CURRENT_TIME); + zc->grabbed = NULL; + } } static void sp_zoom_context_setup(SPEventContext *ec) @@ -119,6 +127,8 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent { SPDesktop *desktop = event_context->desktop; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + SPZoomContext *zc = SP_ZOOM_CONTEXT(event_context); tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); double const zoom_inc = prefs->getDoubleLimited("/options/zoomincrement/value", M_SQRT2, 1.01, 10); @@ -147,6 +157,12 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent desktop->zoom_relative_keep_point(button_dt, zoom_rel); ret = TRUE; } + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + zc->grabbed = SP_CANVAS_ITEM(desktop->acetate); + break; } @@ -188,6 +204,12 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent ret = TRUE; } Inkscape::Rubberband::get(desktop)->stop(); + + if (zc->grabbed) { + sp_canvas_item_ungrab(zc->grabbed, event->button.time); + zc->grabbed = NULL; + } + xp = yp = 0; escaped = false; break; diff --git a/src/zoom-context.h b/src/zoom-context.h index aadba9551..133267135 100644 --- a/src/zoom-context.h +++ b/src/zoom-context.h @@ -24,6 +24,7 @@ class SPZoomContextClass; struct SPZoomContext { SPEventContext event_context; + SPCanvasItem *grabbed; }; struct SPZoomContextClass {