changeset 20155:4910b70d7328

Ensure correct coordinates are available in windowbuttondownfcn callback * __init_fltk__.cc (plot_window::handle): Ensure the "windowbuttondownfcn" callback is called after the axes property "currentpoint" is updated.
author Mike Miller <mtmiller@octave.org>
date Sun, 15 Mar 2015 12:34:39 -0400
parents f7a805f02723
children 6e5365ee200a
files libinterp/dldfcn/__init_fltk__.cc
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__init_fltk__.cc
+++ b/libinterp/dldfcn/__init_fltk__.cc
@@ -1466,16 +1466,21 @@
               else
                 fp.set_selectiontype ("normal");
 
-              if (fp.get_windowbuttondownfcn ().is_defined ())
-                fp.execute_windowbuttondownfcn (Fl::event_button ());
-
               gh = pixel2axes_or_ca (pos_x, pos_y);
 
               if (gh.ok ())
                 {
                   ax_obj = gh_manager::get_object (gh);
                   set_axes_currentpoint (ax_obj, pos_x, pos_y);
+                }
 
+              // Ensure windowbuttondownfcn is called after currentpoint
+              // is updated but before calling buttondownfcn.
+              if (fp.get_windowbuttondownfcn ().is_defined ())
+                fp.execute_windowbuttondownfcn (Fl::event_button ());
+
+              if (gh.ok ())
+                {
                   int ndim = calc_dimensions (ax_obj);
 
                   if (ndim == 3)