From: c vw <dl1ycf@darc.de>
Date: Fri, 5 Mar 2021 21:20:34 +0000 (+0100)
Subject: again: press/move/relase problem.
X-Git-Url: https://git.rkrishnan.org/components/frontends/$sch_link?a=commitdiff_plain;h=f63e084556a04d4e8c3d968a376e275aee644e67;p=pihpsdr.git

again: press/move/relase problem.
---

diff --git a/receiver.c b/receiver.c
index ef880a8..d83198d 100644
--- a/receiver.c
+++ b/receiver.c
@@ -152,12 +152,14 @@ gboolean receiver_motion_notify_event(GtkWidget *widget, GdkEventMotion *event,
                                 &state);
     //
     // It turns out to be difficult sometimes to "jump" to a
-    // frequency by just clicking in the panadaper, since the
-    // operating system may report a very small move between
-    // pressing and releasing. Then x and last_x is the same.
+    // frequency by just clicking in the panadaper, since there
+    // might be a move of zero or one pixel between pressing
+    // and releasing the mouse button.
+    // Treat this is a "press/release" event that sets the VFO
+    // frequency to where we have clicked.
     //
     int moved=x-last_x;
-    if (moved != 0) {
+    if (moved > 1 || moved < -1) {
       vfo_move((long long)((float)moved*rx->hz_per_pixel),FALSE);
       last_x=x;
       has_moved=TRUE;