diff options
| -rw-r--r-- | launcher/EdgeBarrierController.cpp | 51 | ||||
| -rw-r--r-- | launcher/EdgeBarrierControllerPrivate.h | 5 | 
2 files changed, 19 insertions, 37 deletions
| diff --git a/launcher/EdgeBarrierController.cpp b/launcher/EdgeBarrierController.cpp index 42d509eb3..4e15b5015 100644 --- a/launcher/EdgeBarrierController.cpp +++ b/launcher/EdgeBarrierController.cpp @@ -48,16 +48,17 @@ EdgeBarrierController::Impl::Impl(EdgeBarrierController *parent)  auto monitors = uscreen->GetMonitors();  ResizeBarrierList(monitors); - /* FIXME: Back to c++11 lambda once we get sigc::track_obj. - uscreen->changed.connect(sigc::track_obj(([this](int primary, std::vector<nux::Geometry> const& layout) { - ResizeBarrierList(layout); - SetupBarriers(layout); - }));*/ + uscreen->changed.connect(sigc::track_obj([this] (int primary, std::vector<nux::Geometry> const& layout) { + ResetBarriers(); + }, *this)); - uscreen->changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnUScreenChanged)); - Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnOptionsChanged))); + parent_->force_disable.changed.connect(sigc::track_obj([this] (bool) { + ResetBarriers(); + }, *this)); - parent_->force_disable.changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnForceDisableChanged)); + Settings::Instance().launcher_position.changed.connect(sigc::track_obj([this] (LauncherPosition) { + ResetBarriers(); + }, *this));  parent_->sticky_edges.SetGetterFunction([this] {  return parent_->options() ? parent_->options()->edge_resist() : false; @@ -73,12 +74,11 @@ EdgeBarrierController::Impl::Impl(EdgeBarrierController *parent)  });  parent_->options.changed.connect([this](launcher::Options::Ptr options) { - /* FIXME: Back to c++11 lambda once we get sigc::track_obj. - options->option_changed.connect([this]() { - SetupBarriers(UScreen::GetDefault()->GetMonitors()); - });*/ - options->option_changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnOptionsChanged)); - SetupBarriers(UScreen::GetDefault()->GetMonitors()); + options->option_changed.connect(sigc::track_obj([this] { + ResetBarriers(); + }, *this)); + + ResetBarriers();  });  } @@ -87,33 +87,20 @@ EdgeBarrierController::Impl::~Impl()  nux::GetGraphicsDisplay()->RemoveEventFilter(this);  } -void EdgeBarrierController::Impl::OnUScreenChanged(int primary, std::vector<nux::Geometry> const& layout) -{ - ResizeBarrierList(layout); - SetupBarriers(layout); -} - -void EdgeBarrierController::Impl::OnForceDisableChanged(bool value) +void EdgeBarrierController::Impl::ResetBarriers()  { - auto monitors = UScreen::GetDefault()->GetMonitors(); + auto const& monitors = UScreen::GetDefault()->GetMonitors();  ResizeBarrierList(monitors);  SetupBarriers(monitors);  } -void EdgeBarrierController::Impl::OnOptionsChanged() -{ - SetupBarriers(UScreen::GetDefault()->GetMonitors()); -} -  void EdgeBarrierController::Impl::AddSubscriber(EdgeBarrierSubscriber* subscriber, unsigned int monitor, std::vector<EdgeBarrierSubscriber*>& subscribers)  {  if (monitor >= subscribers.size())  subscribers.resize(monitor + 1); - auto const& monitors = UScreen::GetDefault()->GetMonitors();  subscribers[monitor] = subscriber; - ResizeBarrierList(monitors); - SetupBarriers(monitors); + ResetBarriers();  }  void EdgeBarrierController::Impl::RemoveSubscriber(EdgeBarrierSubscriber* subscriber, unsigned int monitor, std::vector<EdgeBarrierSubscriber*>& subscribers) @@ -121,10 +108,8 @@ void EdgeBarrierController::Impl::RemoveSubscriber(EdgeBarrierSubscriber* subscr  if (monitor >= subscribers.size() || subscribers[monitor] != subscriber)  return; - auto const& monitors = UScreen::GetDefault()->GetMonitors();  subscribers[monitor] = nullptr; - ResizeBarrierList(monitors); - SetupBarriers(monitors); + ResetBarriers();  }  void EdgeBarrierController::Impl::ResizeBarrierList(std::vector<nux::Geometry> const& layout) diff --git a/launcher/EdgeBarrierControllerPrivate.h b/launcher/EdgeBarrierControllerPrivate.h index 1de19822c..a7bc76de2 100644 --- a/launcher/EdgeBarrierControllerPrivate.h +++ b/launcher/EdgeBarrierControllerPrivate.h @@ -40,10 +40,7 @@ struct EdgeBarrierController::Impl : public sigc::trackable  void ResizeBarrierList(std::vector<nux::Geometry> const& layout);  void SetupBarriers(std::vector<nux::Geometry> const& layout); - - void OnUScreenChanged(int primary, std::vector<nux::Geometry> const& layout); - void OnForceDisableChanged(bool value); - void OnOptionsChanged(); + void ResetBarriers();  void OnPointerBarrierEvent(PointerBarrierWrapper::Ptr const& owner, BarrierEvent::Ptr const& event);  void BarrierPush(PointerBarrierWrapper::Ptr const& owner, BarrierEvent::Ptr const& event); | 
