Mercurial > octave-antonio
changeset 20119:f46f6d906654
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.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 23 Apr 2015 09:14:10 -0700 |
parents | 144498565de9 |
children | 2db2db2df55b |
files | libinterp/dldfcn/__init_fltk__.cc |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 ();