diff --git a/src/knot.cpp b/src/knot.cpp
index 40246ce01efc2a1accf544a7a06d8216dc445f46..cbb923d41a877d9b0d140687e1196758c0c85769 100644 (file)
--- a/src/knot.cpp
+++ b/src/knot.cpp
#define KNOT_EVENT_MASK (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | \
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | \
+ GDK_POINTER_MOTION_MASK | \
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK)
static bool nograb = false;
knot->mode = SP_KNOT_MODE_XOR;
knot->tip = NULL;
knot->_event_handler_id = 0;
+ knot->pressure = 0;
knot->fill[SP_KNOT_STATE_NORMAL] = 0xffffff00;
knot->fill[SP_KNOT_STATE_MOUSEOVER] = 0xff0000ff;
@@ -281,24 +282,24 @@ void sp_knot_start_dragging(SPKnot *knot, NR::Point p, gint x, gint y, guint32 e
/**
* Called to handle events on knots.
*/
-static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot)
+static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot)
{
g_assert(knot != NULL);
g_assert(SP_IS_KNOT(knot));
- g_object_ref(knot);
- tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
+ /* Run client universal event handler, if present */
gboolean consumed = FALSE;
- /* Run client universal event handler, if present */
-
g_signal_emit(knot, knot_signals[EVENT], 0, event, &consumed);
if (consumed) {
return TRUE;
}
+ g_object_ref(knot);
+ tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
+
switch (event->type) {
case GDK_2BUTTON_PRESS:
if (event->button.button == 1) {
}
break;
case GDK_BUTTON_PRESS:
- if (event->button.button == 1) {
+ if (event->button.button == 1 && !knot->desktop->event_context->space_panning) {
NR::Point const p = knot->desktop->w2d(NR::Point(event->button.x, event->button.y));
sp_knot_start_dragging(knot, p, (gint) event->button.x, (gint) event->button.y, event->button.time);
consumed = TRUE;
}
break;
case GDK_BUTTON_RELEASE:
- if (event->button.button == 1) {
+ if (event->button.button == 1 && !knot->desktop->event_context->space_panning) {
+ knot->pressure = 0;
if (transform_escaped) {
transform_escaped = false;
consumed = TRUE;
}
break;
case GDK_MOTION_NOTIFY:
- if (grabbed) {
+ if (grabbed && !knot->desktop->event_context->space_panning) {
consumed = TRUE;
if ( within_tolerance
// motion notify coordinates as given (no snapping back to origin)
within_tolerance = false;
+ if (gdk_event_get_axis (event, GDK_AXIS_PRESSURE, &knot->pressure))
+ knot->pressure = CLAMP (knot->pressure, 0, 1);
+ else
+ knot->pressure = 0.5;
+
if (!moved) {
g_signal_emit(knot,
knot_signals[GRABBED], 0,
NR::Point p = motion_dt - knot->grabbed_rel_pos;
sp_knot_request_position (knot, &p, event->motion.state);
knot->desktop->scroll_to_point (&motion_dt);
+ knot->desktop->set_coordinate_status(knot->pos); // display the coordinate of knot, not cursor - they may be different!
+ if (event->motion.state & GDK_BUTTON1_MASK)
+ gobble_motion_events(GDK_BUTTON1_MASK);
moved = TRUE;
}
break;