Mercurial > hg > orthanc-stone
diff Framework/Viewport/SdlViewport.h @ 1307:8a28a9bf8876 broker
ViewportController now gets a ref to its parent viewport for proper lock usage
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 04 Mar 2020 10:07:37 +0100 |
parents | 7ec8fea061b9 |
children | adf234ecaa00 |
line wrap: on
line diff
--- a/Framework/Viewport/SdlViewport.h Wed Mar 04 10:07:14 2020 +0100 +++ b/Framework/Viewport/SdlViewport.h Wed Mar 04 10:07:37 2020 +0100 @@ -43,12 +43,20 @@ #include <SDL_events.h> +// TODO: required for UndoStack injection +// I don't like it either :) +#include <boost/weak_ptr.hpp> + +#include <boost/thread/recursive_mutex.hpp> + namespace OrthancStone { + class UndoStack; + class SdlViewport : public IViewport { private: - boost::mutex mutex_; + boost::recursive_mutex mutex_; uint32_t refreshEvent_; boost::shared_ptr<ViewportController> controller_; std::auto_ptr<ICompositor> compositor_; @@ -59,8 +67,8 @@ class SdlLock : public ILock { private: - SdlViewport& that_; - boost::mutex::scoped_lock lock_; + SdlViewport& that_; + boost::recursive_mutex::scoped_lock lock_; public: SdlLock(SdlViewport& that) : @@ -96,6 +104,7 @@ public: SdlViewport(); + SdlViewport(boost::weak_ptr<UndoStack> undoStackW); bool IsRefreshEvent(const SDL_Event& event) const { @@ -128,6 +137,12 @@ unsigned int height, bool allowDpiScaling = true); + SdlOpenGLViewport(const char* title, + boost::weak_ptr<UndoStack> undoStackW, + unsigned int width, + unsigned int height, + bool allowDpiScaling = true); + virtual ~SdlOpenGLViewport(); virtual void Paint() ORTHANC_OVERRIDE;