diff options
| -rw-r--r-- | hud/HudController.cpp | 2 | ||||
| -rw-r--r-- | launcher/EdgeBarrierController.cpp | 51 | ||||
| -rw-r--r-- | launcher/EdgeBarrierControllerPrivate.h | 5 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 8 | 
4 files changed, 24 insertions, 42 deletions
| diff --git a/hud/HudController.cpp b/hud/HudController.cpp index f88e8120f..ab941e88a 100644 --- a/hud/HudController.cpp +++ b/hud/HudController.cpp @@ -83,7 +83,7 @@ Controller::Controller(Controller::ViewCreator const& create_view,  }  SetupWindow(); - UScreen::GetDefault()->changed.connect([this] (int, std::vector<nux::Geometry> const&) { Relayout(true); }); + UScreen::GetDefault()->changed.connect(sigc::track_obj([this] (int, std::vector<nux::Geometry> const&) { Relayout(true); }, *this));  ubus.RegisterInterest(UBUS_HUD_CLOSE_REQUEST, sigc::mem_fun(this, &Controller::OnExternalHideHud)); 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); diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 0ecff9515..4e91d434f 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -4194,13 +4194,13 @@ void UnityScreen::InitUnityComponents()  }  }; - UScreen::GetDefault()->changed.connect([this, check_launchers_size] (int, std::vector<nux::Geometry> const&) { + UScreen::GetDefault()->changed.connect(sigc::track_obj([this, check_launchers_size] (int, std::vector<nux::Geometry> const&) {  check_launchers_size(); - }); + }, *this)); - Settings::Instance().launcher_position.changed.connect([this, check_launchers_size] (LauncherPosition const&) { + Settings::Instance().launcher_position.changed.connect(sigc::track_obj([this, check_launchers_size] (LauncherPosition const&) {  check_launchers_size(); - }); + }, *this));  check_launchers_size(); | 
