# HG changeset patch # User Andreas Weber # Date 1406661183 -7200 # Node ID 0257a936dc4a4d56dbb119ecebbafe27c2fc447d # Parent 69658bd9952b8b5aa6f2f2cbb08e2dff7c6395b3 Fix FLTK redraw and event issue * __init_fltk__.cc: Move axis auto code in own function (again). Fix event issue where windowbuttondownfcn was called before set_currentpoint and execute event only if it's defined. * __add_default_menu__.m: Add drawnow () for grid and axis callback diff -r 69658bd9952b -r 0257a936dc4a libinterp/dldfcn/__init_fltk__.cc --- a/libinterp/dldfcn/__init_fltk__.cc Tue Jul 29 10:18:05 2014 +0200 +++ b/libinterp/dldfcn/__init_fltk__.cc Tue Jul 29 21:13:03 2014 +0200 @@ -946,12 +946,7 @@ void button_press (Fl_Widget* widg, void*) { if (widg == autoscale) - { - set_on_ax_obj ("xlimmode", "auto"); - set_on_ax_obj ("ylimmode", "auto"); - set_on_ax_obj ("zlimmode", "auto"); - mark_modified (); - } + axis_auto (); else if (widg == togglegrid) toggle_grid (); else if (widg == panzoom) @@ -995,6 +990,19 @@ int pos_x; int pos_y; + + void axis_auto (void) + { + octave_value_list args; + if (fp.get_currentaxes ().ok ()) + { + args(0) = fp.get_currentaxes ().as_octave_value (); + args(1) = "auto"; + feval ("axis", args); + mark_modified (); + } + } + void toggle_grid (void) { octave_value_list args; @@ -1198,7 +1206,6 @@ if (event == FL_FOCUS) return 1; - Fl_Window::handle (event); graphics_handle gh; if (!fp.is_beingdeleted ()) @@ -1224,10 +1231,7 @@ { case 'a': case 'A': - set_on_ax_obj ("xlimmode", "auto"); - set_on_ax_obj ("ylimmode", "auto"); - set_on_ax_obj ("zlimmode", "auto"); - mark_modified (); + axis_auto (); return 1; case 'g': @@ -1278,13 +1282,14 @@ return 1; case FL_PUSH: - fp.execute_windowbuttondownfcn (Fl::event_button()); - pos_x = Fl::event_x (); pos_y = Fl::event_y () - menu_dy (); set_currentpoint (pos_x, pos_y); + if (fp.get_windowbuttonupfcn ().is_defined ()) + fp.execute_windowbuttondownfcn (Fl::event_button()); + gh = pixel2axes_or_ca (pos_x, pos_y); if (gh.ok ()) diff -r 69658bd9952b -r 0257a936dc4a scripts/plot/util/private/__add_default_menu__.m --- a/scripts/plot/util/private/__add_default_menu__.m Tue Jul 29 10:18:05 2014 +0200 +++ b/scripts/plot/util/private/__add_default_menu__.m Tue Jul 29 21:13:03 2014 +0200 @@ -105,11 +105,13 @@ otherwise arrayfun (@(h) grid(h, id), hax); endswitch + drawnow (); endfunction function autoscale_cb (h, e) hax = __get_axes__ (h); arrayfun (@(h) axis (h, "auto"), hax) + drawnow (); endfunction function guimode_cb (h, e)