changeset 19567:3492b771c2e6 stable

__fltk_ginput__.m: Fix freeze upon double-click (Bug #43664)
author Andreas Weber <andy.weber.aw@gmail.com>
date Tue, 02 Dec 2014 11:31:02 +0100
parents 29228fa3edba
children 7759e4d62f04
files scripts/plot/util/private/__fltk_ginput__.m
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__fltk_ginput__.m
+++ b/scripts/plot/util/private/__fltk_ginput__.m
@@ -47,7 +47,14 @@
       sleep (0.01);
 
       [x, y, n0, button] = ginput_accumulator (-1, 0, 0, 0);
-    until (n0 == n || n0 < 0)
+    until ((n > -1 && n0 >= n) || n0 < 0)
+
+    if (n0 > n)
+      ## More clicks than requested due to double-click or too fast clicking
+      x = x(1:n);
+      y = y(1:n);
+      button = button(1:n);
+    endif
 
   unwind_protect_cleanup
     set (f, "windowbuttondownfcn", orig_windowbuttondownfcn);