Back to index

unity  6.0.0
Public Member Functions | Public Attributes
unity::ui::EdgeBarrierController::Impl Struct Reference
Collaboration diagram for unity::ui::EdgeBarrierController::Impl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Impl (EdgeBarrierController *parent)
 ~Impl ()
void ResizeBarrierList (std::vector< nux::Geometry > const &layout)
void SetupBarriers (std::vector< nux::Geometry > const &layout)
void OnPointerBarrierEvent (ui::PointerBarrierWrapper *owner, ui::BarrierEvent::Ptr event)

Public Attributes

std::vector
< PointerBarrierWrapper::Ptr
barriers_
Decaymulator::Ptr decaymulator_
float edge_overcome_pressure_
EdgeBarrierControllerparent_
std::vector
< EdgeBarrierSubscriber * > 
subscribers_

Detailed Description

Definition at line 27 of file EdgeBarrierController.cpp.


Constructor & Destructor Documentation

Definition at line 44 of file EdgeBarrierController.cpp.

  : decaymulator_(Decaymulator::Ptr(new Decaymulator()))
  , edge_overcome_pressure_(0)
  , parent_(parent)
{
  UScreen *uscreen = UScreen::GetDefault();

  auto monitors = uscreen->GetMonitors();
  ResizeBarrierList(monitors);

  uscreen->changed.connect([&](int primary, std::vector<nux::Geometry>& layout) {
    ResizeBarrierList(layout);
    SetupBarriers(layout);
  });

  parent_->sticky_edges.changed.connect([&](bool value) {
    SetupBarriers(UScreen::GetDefault()->GetMonitors());
  });

  parent_->options.changed.connect([&](launcher::Options::Ptr options) {
    options->option_changed.connect([&]() {
      SetupBarriers(UScreen::GetDefault()->GetMonitors());
    });
    SetupBarriers(UScreen::GetDefault()->GetMonitors());
  });
}

Here is the call graph for this function:

Definition at line 71 of file EdgeBarrierController.cpp.

{

}

Member Function Documentation

Definition at line 131 of file EdgeBarrierController.cpp.

{
  int monitor = owner->index;
  bool process = true;

  if ((size_t)monitor <= subscribers_.size())
  {
    auto subscriber = subscribers_[monitor];
    if (subscriber && subscriber->HandleBarrierEvent(owner, event))
      process = false;
  }

  if (process && owner->x1 > 0)
  {
    decaymulator_->value = decaymulator_->value + event->velocity;
    if (decaymulator_->value > edge_overcome_pressure_ || !parent_->options()->edge_resist())
    {
      owner->ReleaseBarrier(event->event_id);
      decaymulator_->value = 0;
    }
  }
  else
  {
    decaymulator_->value = 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::ui::EdgeBarrierController::Impl::ResizeBarrierList ( std::vector< nux::Geometry > const &  layout)

Definition at line 76 of file EdgeBarrierController.cpp.

{
  size_t num_monitors = layout.size();
  if (barriers_.size() > num_monitors)
  {
    barriers_.resize(num_monitors);
  }

  while (barriers_.size() < num_monitors)
  {
    auto barrier = PointerBarrierWrapper::Ptr(new PointerBarrierWrapper());
    barrier->barrier_event.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnPointerBarrierEvent));
    barriers_.push_back(barrier);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::ui::EdgeBarrierController::Impl::SetupBarriers ( std::vector< nux::Geometry > const &  layout)

Definition at line 92 of file EdgeBarrierController.cpp.

{
  bool edge_resist = parent_->options()->edge_resist();

  size_t size = layout.size();
  for (size_t i = 0; i < size; i++)
  {
    auto barrier = barriers_[i];
    auto monitor = layout[i];

    barrier->DestroyBarrier();

    if (!edge_resist && (subscribers_[i] == nullptr || parent_->options()->hide_mode() == launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER))
      continue;

    barrier->x1 = monitor.x;
    barrier->x2 = monitor.x;
    barrier->y1 = monitor.y;
    barrier->y2 = monitor.y + monitor.height;
    barrier->index = i;

    barrier->threshold = parent_->options()->edge_stop_velocity();
    barrier->max_velocity_multiplier = parent_->options()->edge_responsiveness();

    if (edge_resist)
      barrier->direction = BarrierDirection::BOTH;
    else
      barrier->direction = BarrierDirection::LEFT;

    barrier->ConstructBarrier();
  }

  float decay_responsiveness_mult = ((parent_->options()->edge_responsiveness() - 1) * .3f) + 1;
  decaymulator_->rate_of_decay = parent_->options()->edge_decay_rate() * decay_responsiveness_mult;
  
  float overcome_responsiveness_mult = ((parent_->options()->edge_responsiveness() - 1) * 1.0f) + 1;
  edge_overcome_pressure_ = parent_->options()->edge_overcome_pressure() * overcome_responsiveness_mult;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 37 of file EdgeBarrierController.cpp.

Definition at line 38 of file EdgeBarrierController.cpp.

Definition at line 39 of file EdgeBarrierController.cpp.

Definition at line 40 of file EdgeBarrierController.cpp.

Definition at line 41 of file EdgeBarrierController.cpp.


The documentation for this struct was generated from the following file: