summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4758744)
raw | patch | inline | side by side (parent: 4758744)
author | johncoswell <johncoswell@users.sourceforge.net> | |
Sun, 3 Sep 2006 13:26:57 +0000 (13:26 +0000) | ||
committer | johncoswell <johncoswell@users.sourceforge.net> | |
Sun, 3 Sep 2006 13:26:57 +0000 (13:26 +0000) |
src/pen-context.cpp | patch | blob | history | |
src/pen-context.h | patch | blob | history |
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index c1d7af150f53aed7d56b9e3a19a48134a148aae7..1136efb3462903347bf4c114a9631c73f2a07bc2 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
static gint pen_handle_key_press(SPPenContext *const pc, GdkEvent *event);
static void spdc_reset_colors(SPPenContext *pc);
+static void pen_disable_events(SPPenContext *const pc);
+static void pen_enable_events(SPPenContext *const pc);
static NR::Point pen_drag_origin_w(0, 0);
static bool pen_within_tolerance = false;
pc->c1 = NULL;
pc->cl0 = NULL;
pc->cl1 = NULL;
+
+ pc->events_disabled = 0;
}
/**
*/
static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const &bevent)
{
+ if (pc->events_disabled) {
+ // skip event processing if events are disabled
+ return FALSE;
+ }
+
gint ret = FALSE;
if (bevent.button == 1) {
// allow middle-button scrolling
return FALSE;
}
+
+ if (pc->events_disabled) {
+ // skip motion events if pen events are disabled
+ return FALSE;
+ }
NR::Point const event_w(mevent.x,
mevent.y);
static gint
pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
{
+ if (pc->events_disabled) {
+ // skip event processing if events are disabled
+ return FALSE;
+ }
+
gint ret = FALSE;
if ( revent.button == 1 ) {
case GDK_Return:
case GDK_KP_Enter:
if (pc->npoints != 0) {
+ pen_disable_events(pc);
spdc_pen_finish(pc, FALSE);
+ pen_enable_events(pc);
ret = TRUE;
}
break;
}
}
+static void
+pen_disable_events(SPPenContext *const pc) {
+ pc->events_disabled++;
+}
+
+static void
+pen_enable_events(SPPenContext *const pc) {
+ g_return_if_fail(pc->events_disabled != 0);
+
+ pc->events_disabled--;
+}
/*
Local Variables:
diff --git a/src/pen-context.h b/src/pen-context.h
index d0392134b0cd78a0b40360c83e5ab834022c6b33..e149391a9b02da04c2e36463ba1a522fdefbe4f0 100644 (file)
--- a/src/pen-context.h
+++ b/src/pen-context.h
unsigned int onlycurves : 1;
SPCanvasItem *c0, *c1, *cl0, *cl1;
+
+ unsigned int events_disabled : 1;
};
/// The SPPenContext vtable (empty).