diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc index 83df2b76b5..d41d6aac44 100644 --- a/libs/pbd/base_ui.cc +++ b/libs/pbd/base_ui.cc @@ -175,5 +175,6 @@ BaseUI::attach_request_source () { DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: attach request source\n", event_loop_name())); request_channel.attach (m_context); + maybe_install_precall_handler (m_context); } diff --git a/libs/pbd/glib_event_source.cc b/libs/pbd/glib_event_source.cc new file mode 100644 index 0000000000..59ae3d7c86 --- /dev/null +++ b/libs/pbd/glib_event_source.cc @@ -0,0 +1,19 @@ +#include "pbd/glib_event_source.h" + +bool +GlibEventLoopSource::prepare (int& timeout) +{ + return false; +} + +bool +GlibEventLoopSource::check () +{ + return false; +} + +bool +GlibEventLoopSource::dispatch (sigc::slot_base*) +{ + return false; +} diff --git a/libs/pbd/pbd/base_ui.h b/libs/pbd/pbd/base_ui.h index fff6f5da84..fe412f2537 100644 --- a/libs/pbd/pbd/base_ui.h +++ b/libs/pbd/pbd/base_ui.h @@ -105,6 +105,8 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop void signal_new_request (); void attach_request_source (); + virtual void maybe_install_precall_handler (Glib::RefPtr) {} + /** Derived UI objects must implement this method, * which will be called whenever there are requests * to be dealt with. diff --git a/libs/pbd/pbd/glib_event_source.h b/libs/pbd/pbd/glib_event_source.h new file mode 100644 index 0000000000..22400f0c53 --- /dev/null +++ b/libs/pbd/pbd/glib_event_source.h @@ -0,0 +1,34 @@ +#ifndef __libpbd_glib_event_source_h__ +#define __libpbd_glib_event_source_h__ + +#include + +#include +#include "pbd/libpbd_visibility.h" + +class LIBPBD_API GlibEventLoopSource : public Glib::Source +{ + public: + GlibEventLoopSource () {}; + + bool prepare (int& timeout); + bool check(); + bool dispatch (sigc::slot_base*); +}; + + +class LIBPBD_API GlibEventLoopCallback : public GlibEventLoopSource +{ + public: + GlibEventLoopCallback (boost::function callback) : _callback (callback) {} + + bool check() { + _callback(); + return false; + } + + private: + boost::function _callback; +}; + +#endif /* __libpbd_glib_event_source_h__ */ diff --git a/libs/pbd/wscript b/libs/pbd/wscript index 2dda798a45..82960539a2 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -51,6 +51,7 @@ libpbd_sources = [ 'file_archive.cc', 'file_utils.cc', 'fpu.cc', + 'glib_event_source.cc', 'id.cc', 'locale_guard.cc', 'localtime_r.cc',