octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60509] First initialization of graphics subsy


From: Rik
Subject: [Octave-bug-tracker] [bug #60509] First initialization of graphics subsystem switches graphics_toolkit when octave-cli used
Date: Mon, 3 May 2021 20:49:46 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36

Follow-up Comment #10, bug #60509 (project octave):

In graphics.cc, the constructor for gh_manager is


gh_manager::gh_manager (octave::interpreter& interp)
  : m_interpreter (interp), m_handle_map (), m_handle_free_list (),
    m_next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)),
    m_figure_list (), m_graphics_lock (),  m_event_queue (),
    m_callback_objects (), m_event_processing (0)
{
  m_handle_map[0] = graphics_object (new root_figure ());

  octave::gtk_manager& gtk_mgr = octave::__get_gtk_manager__ ("gh_manager");

  // Make sure the default graphics toolkit is registered.
  gtk_mgr.default_toolkit ();
}


Problem #1 is that default_toolkit is a read-only function defined in
gtk-manager.h


    std::string default_toolkit (void) const { return dtk; }


It just returns a string which is discarded in the function above.

Is it a requirement that gh_manager exist before figures can be plotted?  If
so then this would make a natural point to force at least one toolkit to be
loaded, or error out.  But maybe we shouldn't even do this.  If a user is
going to use gnuplot all of the time then there is no point loading the 'qt'
or 'fltk' toolkits.

The toolkit needs to be stored on a per-figure basis, since it is switchable. 
But the initialization needs to happen just once per toolkit.  Maybe we need
to store 1 bit of state information in gtk_manager that says whether any
toolkit has been initialized?  It might make even more sense to map this
functionality on to a test for whether loaded_graphics_toolkits is empty or
not.  If toolkits were unregistered this would naturally track the current
status.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60509>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]