diff --git a/src/stage/interact/cmd-context.cpp b/src/stage/interact/cmd-context.cpp index adf3d2069..082b47ab2 100644 --- a/src/stage/interact/cmd-context.cpp +++ b/src/stage/interact/cmd-context.cpp @@ -36,7 +36,6 @@ //#include "lib/util.hpp" //#include "lib/symbol.hpp" -#include "stage/gtk-base.hpp" #include "lib/depend.hpp" //#include "include/logging.h" #include "include/ui-protocol.hpp" diff --git a/src/stage/interact/cmd-context.hpp b/src/stage/interact/cmd-context.hpp index 1e3260520..a8b720b7a 100644 --- a/src/stage/interact/cmd-context.hpp +++ b/src/stage/interact/cmd-context.hpp @@ -94,9 +94,9 @@ namespace interact { virtual ~Subject(); ///< this is an interface public: - virtual Gtk::Widget& exposeWidget() =0; - virtual void fireGesture (Symbol cmdID) =0; - virtual void gestureOffset (Symbol cmdID, gdouble deltaX, gdouble deltaY) =0; + virtual Gtk::Widget& exposeWidget() =0; + virtual void fireGesture (Symbol cmdID) =0; + virtual void gestureOffset (Symbol cmdID, double deltaX, double deltaY) =0; }; diff --git a/src/stage/interact/drag-relocate-controller.hpp b/src/stage/interact/drag-relocate-controller.hpp index b1c20c9e2..0d686e0f3 100644 --- a/src/stage/interact/drag-relocate-controller.hpp +++ b/src/stage/interact/drag-relocate-controller.hpp @@ -69,6 +69,9 @@ namespace interact { using util::isnil; using util::_Fmt;//////////////////////////////////TODO + namespace { + const gdouble DISTANCE_THRESHOLD = 5.0; + } /** @@ -82,8 +85,13 @@ namespace interact { * controller. * * @todo write type comment... - * @remarks tracking of signal connections _is not relevant here,_ since this controller - * is managed by the UI backbone and thus ensured to outlive any event processing. + * @remarks + * - tracking of signal connections _is not relevant here,_ since this controller + * is managed by the UI backbone and thus ensured to outlive any event processing. + * - this concrete controller handles _all_ drag-relocate gestures for all widgets + * - the actual Subject (widget) and command are bound into the signal wiring + * - whenever a new gesture possibly starts, we pick up these arguments and + * store them into the current gesture state within this object's fields. * @todo WIP-WIP as of /3/2021 * ///////////////////////////////////TODO do we need a translation unit interaction-state.cpp (otherwise delete it!) */ @@ -119,11 +127,17 @@ namespace interact { watchButton (GdkEventButton* button_event) noexcept { REQUIRE (button_event); - if (button_event->type & GDK_BUTTON_PRESS) + if (GDK_BUTTON_PRESS == button_event->type) buttonPressed_ = true; else - if (button_event->type & GDK_BUTTON_RELEASE) - buttonPressed_ = false; + if (GDK_BUTTON_RELEASE == button_event->type) + { + buttonPressed_ = false; + if (isActive()) + doCompleteGesture(); + resetState(); + } + std::cerr << _Fmt{"BUTT %s flag=%d"} % buttonPressed_ % button_event->type << std::endl; return false; } @@ -132,11 +146,7 @@ namespace interact { maybeActivate (Symbol cmdID, Subject& subject, GdkEventMotion* motion_event) { if (not buttonPressed_) - { - if (isActive()) - doCompleteGesture(); return false; // Event not handled by this controller - } REQUIRE (motion_event); std::cerr << _Fmt{"MOVE x=%3.1f y=%3.1f subject=%s"} % motion_event->x @@ -146,9 +156,15 @@ namespace interact { if (not isAnchored()) anchor (cmdID, subject, motion_event); if (not isActive()) - return false; - doTrackGesture(motion_event); - return true; // Event handled + { + probeActivation (motion_event); + return false; + } + else + { + doTrackGesture (motion_event); + return true; // Event handled + } } @@ -174,6 +190,18 @@ namespace interact { this->subject_ = & subject; this->anchorX_ = motion_event->x; this->anchorY_ = motion_event->y; + std::cerr << _Fmt{"ANCHOR at x=%3.1f y=%3.1f ('%s')"} + % anchorX_ + % anchorY_ + % cmdID_ + << std::endl; + } + + void + probeActivation (GdkEventMotion* motion_event) + { + isInFormation_ = DISTANCE_THRESHOLD < abs (motion_event->x - anchorX_) + or DISTANCE_THRESHOLD < abs (motion_event->y - anchorY_); } void @@ -190,10 +218,15 @@ namespace interact { doCompleteGesture() { subject_->fireGesture (cmdID_); - // return to inactive state + } + + void + resetState() + { + isInFormation_ = false; cmdID_ = Symbol::BOTTOM; - subject_ = nullptr; anchorX_ = anchorY_ = 0.0; + subject_ = nullptr; } diff --git a/src/stage/timeline/clip-presenter.hpp b/src/stage/timeline/clip-presenter.hpp index 335ef345e..a88b28deb 100644 --- a/src/stage/timeline/clip-presenter.hpp +++ b/src/stage/timeline/clip-presenter.hpp @@ -236,7 +236,7 @@ namespace timeline { } void - gestureOffset (Symbol cmdID, gdouble deltaX, gdouble deltaY) override + gestureOffset (Symbol cmdID, double deltaX, double deltaY) override { std::cerr << _Fmt{"Gesture(%s) --> Δ := (%3.1f,%3.1f)"} % cmdID diff --git a/tests/stage/interact/cmd-context-test.cpp b/tests/stage/interact/cmd-context-test.cpp index 577043aa3..d538d4e5a 100644 --- a/tests/stage/interact/cmd-context-test.cpp +++ b/tests/stage/interact/cmd-context-test.cpp @@ -29,7 +29,6 @@ #include "lib/test/run.hpp" //#include "lib/test/test-helper.hpp" -typedef double gdouble; ////////////////////TODO this is a code smell. Test Code should not depend on GTK. Problem is the usage of gdouble for Screen coordinates in cmdt-context.hpp #include "stage/interact/cmd-context.hpp" //#include "lib/idi/entry-id.hpp" //#include "lib/diff/gen-node.hpp" diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 9b3af7ad7..301aa3185 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -32802,8 +32802,8 @@ - - + + @@ -32826,21 +32826,22 @@ - - + + - - + + + - - + + @@ -32876,7 +32877,7 @@ - + @@ -32932,10 +32933,16 @@ - + + + + + + + @@ -32948,7 +32955,7 @@ - + @@ -32957,10 +32964,37 @@

sehe nur die MOVE-Meldungen.
eigentlich sollte das Subject ebenfalls Meldungen ausspucken

+

+ +

+

+ ⟹ mehrere Gründe...
+

+
    +
  • + bekomme überhaupt kein motion_event, wenn kein Button gedrückt ist. Liegt das daran, daß ich ein Button-Widget zum Testen verwende?? +
  • +
  • + unabhängig davon war die Logik auch sonst kaputt. Die Flag isInFormation_ wurde nicht gesetetzt +
  • +
+ + + + + + + + + + + + +
@@ -33271,8 +33305,8 @@ - +