diff --git a/libgui/src/qt-application.h b/libgui/src/qt-application.h index 52530c1dd3..dea3b18c64 100644 --- a/libgui/src/qt-application.h +++ b/libgui/src/qt-application.h @@ -68,6 +68,8 @@ class OCTGUI_API qt_application : public application bool gui_running () const { return m_gui_running; } void gui_running (bool arg) { m_gui_running = arg; } + bool multi_threaded () const { return true; } + private: // If TRUE, the GUI should be started. diff --git a/libinterp/dldfcn/__init_fltk__.cc b/libinterp/dldfcn/__init_fltk__.cc index 221891e064..364138b53a 100644 --- a/libinterp/dldfcn/__init_fltk__.cc +++ b/libinterp/dldfcn/__init_fltk__.cc @@ -32,7 +32,7 @@ To initialize: */ -// PKG_ADD: if (__have_feature__ ("FLTK") && __have_feature__ ("OPENGL") && have_window_system () && ! (ismac () && __event_manager_enabled__ ())) register_graphics_toolkit ("fltk"); endif +// PKG_ADD: if (__have_feature__ ("FLTK") && __have_feature__ ("OPENGL") && have_window_system () && ! (ismac () && __is_multi_threaded__ ())) register_graphics_toolkit ("fltk"); endif #if defined (HAVE_CONFIG_H) # include "config.h" @@ -1296,8 +1296,8 @@ class plot_window : public Fl_Window graphics_object robj = gh_mgr.get_object (m_fp.get_parent ()); root_figure::properties& rp - = dynamic_cast (robj.get_properties ()); + rp.set_currentfigure (m_fp.get___myhandle__ ().value ()); } } diff --git a/libinterp/octave.cc b/libinterp/octave.cc index 62454dbd98..b771db3369 100644 --- a/libinterp/octave.cc +++ b/libinterp/octave.cc @@ -460,6 +460,27 @@ Return true if Octave is running in GUI mode and false otherwise. %!error isguirunning (1) */ +DEFUN (__is_multi_threaded__, args, , + doc: /* -*- texinfo -*- +@deftypefn {} {@var{tf} =} __is_multi_threaded__ () +Return true if Octave is running with multiple threads. +@seealso{isguirunning} +@end deftypefn */) +{ + if (args.length () != 0) + print_usage (); + + // FIXME: This isn't quite right, it just says that we intended to + // start the GUI, not that it is actually running. + + return ovl (application::is_multi_threaded ()); +} + +/* +%!assert (islogical (__is_multi_threaded__ ())) +%!error __is_multi_threaded__ (1) +*/ + DEFUN (argv, args, , doc: /* -*- texinfo -*- @deftypefn {} {@var{args} =} argv () diff --git a/libinterp/octave.h b/libinterp/octave.h index e0484a05ec..7dc2849abb 100644 --- a/libinterp/octave.h +++ b/libinterp/octave.h @@ -287,6 +287,9 @@ class OCTINTERP_API application virtual bool gui_running () const { return false; } virtual void gui_running (bool) { } + // TRUE if Octave uses multiple threads (e.g., for interpreter and GUI). + virtual bool multi_threaded () const { return false; } + void program_invocation_name (const std::string& nm) { m_program_invocation_name = nm; } @@ -320,6 +323,11 @@ class OCTINTERP_API application return s_instance ? s_instance->gui_running () : false; } + static bool is_multi_threaded () + { + return s_instance ? s_instance->multi_threaded () : false; + } + // Convenience functions. static bool forced_interactive ();