summaryrefslogtreecommitdiffstats
path: root/src/pen-context.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2008-06-30 04:56:49 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2008-06-30 04:56:49 +0000
commit14c88fedf61e182b2ae1b7a1a97e46f407db85ee (patch)
treea146ff1e8ee0dfab90ac3f471a2c8b690fbaf039 /src/pen-context.cpp
parenteven with zero opacity, paths must be selectable in outline mode (diff)
downloadinkscape-14c88fedf61e182b2ae1b7a1a97e46f407db85ee.tar.gz
inkscape-14c88fedf61e182b2ae1b7a1a97e46f407db85ee.zip
fix the snapindicator stealing release event by grabbing the acetate on click, not on motion
(bzr r6094)
Diffstat (limited to 'src/pen-context.cpp')
-rw-r--r--src/pen-context.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 53aff5295..f91db7018 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -310,6 +310,9 @@ sp_pen_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
case GDK_BUTTON_PRESS:
ret = pen_handle_button_press(pc, event->button);
break;
+ case GDK_BUTTON_RELEASE:
+ ret = pen_handle_button_release(pc, event->button);
+ break;
default:
break;
}
@@ -393,6 +396,15 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
return TRUE;
}
+ if (!pc->grab ) {
+ /* Grab mouse, so release will not pass unnoticed */
+ pc->grab = SP_CANVAS_ITEM(desktop->acetate);
+ sp_canvas_item_grab(pc->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_MASK ),
+ NULL, bevent.time);
+ }
+
pen_drag_origin_w = event_w;
pen_within_tolerance = true;
@@ -465,7 +477,6 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
pc->ea = anchor;
NR::Point p;
if (anchor) {
-
p = anchor->dp;
// we hit an anchor, will finish the curve (either with or without closing)
// in release handler
@@ -480,7 +491,6 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
break;
} else {
-
p = event_dt;
spdc_endpoint_snap(pc, p, bevent.state); /* Snap node only if not hitting anchor. */
spdc_pen_set_subsequent_point(pc, p, true);
@@ -488,8 +498,8 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
spdc_pen_finish_segment(pc, p, bevent.state);
}
}
-
}
+
pc->state = pc->polylines_only ? SP_PEN_CONTEXT_POINT : SP_PEN_CONTEXT_CONTROL;
ret = TRUE;
break;
@@ -538,12 +548,13 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
gint ret = FALSE;
SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+ SPDesktop * const dt = SP_EVENT_CONTEXT_DESKTOP(event_context);
if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
// allow scrolling
return FALSE;
}
-
+
if (pc->events_disabled) {
// skip motion events if pen events are disabled
return FALSE;
@@ -563,16 +574,6 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
// motion notify coordinates as given (no snapping back to origin)
pen_within_tolerance = false;
- SPDesktop *const dt = pc->desktop;
- if ( ( mevent.state & GDK_BUTTON1_MASK ) && !pc->grab ) {
- /* Grab mouse, so release will not pass unnoticed */
- pc->grab = SP_CANVAS_ITEM(dt->acetate);
- sp_canvas_item_grab(pc->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK ),
- NULL, mevent.time);
- }
-
/* Find desktop coordinates */
NR::Point p = dt->w2d(event_w);