# HG changeset patch # User Rik # Date 1429805650 25200 # Node ID f46f6d90665485510f87118eadb6ee69f31941c9 # Parent 144498565de97c557e89224d0fb6daf57786f1fc Avoid unnecessarily calling graphics callbacks in FLTK. * __init_fltk__.cc: Replace all tests for callback functions which use is_defined() (that is always true as long as the octave-value exists) with ! is_empty() which is a real test of whether there is a function handle to call. diff -r 144498565de9 -r f46f6d906654 libinterp/dldfcn/__init_fltk__.cc --- a/libinterp/dldfcn/__init_fltk__.cc Thu Apr 23 08:38:49 2015 -0700 +++ b/libinterp/dldfcn/__init_fltk__.cc Thu Apr 23 09:14:10 2015 -0700 @@ -1505,7 +1505,7 @@ evt = format_key_event (e_key, e_text, e_state); } - if (fp.get_keyreleasefcn ().is_defined () + if (! fp.get_keyreleasefcn ().is_empty () && (evt.contents ("Key").length () > 0)) fp.execute_keyreleasefcn (evt); return 1; @@ -1552,7 +1552,7 @@ // Ensure windowbuttondownfcn is called after currentpoint // is updated but before calling buttondownfcn. - if (fp.get_windowbuttondownfcn ().is_defined ()) + if (! fp.get_windowbuttondownfcn ().is_empty ()) fp.execute_windowbuttondownfcn (Fl::event_button ()); if (gh.ok ()) @@ -1567,18 +1567,18 @@ fp.set_currentobject (ax_obj.get_handle ().value ()); base_properties& props = ax_obj.get_properties (); - if (props.get_buttondownfcn ().is_defined ()) + if (! props.get_buttondownfcn ().is_empty ()) props.execute_buttondownfcn (Fl::event_button ()); return 1; } - else if (fp.get_buttondownfcn ().is_defined ()) + else if (! fp.get_buttondownfcn ().is_empty ()) fp.execute_buttondownfcn (Fl::event_button ()); break; case FL_DRAG: - if (fp.get_windowbuttonmotionfcn ().is_defined ()) + if (! fp.get_windowbuttonmotionfcn ().is_empty ()) { set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ()); fp.execute_windowbuttonmotionfcn (); @@ -1692,7 +1692,7 @@ } case FL_RELEASE: - if (fp.get_windowbuttonupfcn ().is_defined ()) + if (! fp.get_windowbuttonupfcn ().is_empty ()) { set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ()); fp.execute_windowbuttonupfcn ();