Back to index

unity  6.0.0
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
unity::launcher::LauncherHideMachine Class Reference

#include <LauncherHideMachine.h>

Inheritance diagram for unity::launcher::LauncherHideMachine:
Inheritance graph
[legend]
Collaboration diagram for unity::launcher::LauncherHideMachine:
Collaboration graph
[legend]

List of all members.

Public Types

enum  HideMode { HIDE_NEVER, AUTOHIDE, DODGE_WINDOWS, DODGE_ACTIVE_WINDOW }
enum  HideQuirk {
  DEFAULT = 0, LAUNCHER_HIDDEN = 1 << 0, MOUSE_OVER_LAUNCHER = 1 << 1, QUICKLIST_OPEN = 1 << 4,
  EXTERNAL_DND_ACTIVE = 1 << 5, INTERNAL_DND_ACTIVE = 1 << 6, TRIGGER_BUTTON_SHOW = 1 << 7, DND_PUSHED_OFF = 1 << 10,
  MOUSE_MOVE_POST_REVEAL = 1 << 11, VERTICAL_SLIDE_ACTIVE = 1 << 12, KEY_NAV_ACTIVE = 1 << 13, PLACES_VISIBLE = 1 << 14,
  LAST_ACTION_ACTIVATE = 1 << 15, SCALE_ACTIVE = 1 << 16, EXPO_ACTIVE = 1 << 17, MT_DRAG_OUT = 1 << 18,
  REVEAL_PRESSURE_PASS = 1 << 19, LAUNCHER_PULSE = 1 << 20, LOCK_HIDE = 1 << 21
}

Public Member Functions

 LauncherHideMachine ()
void SetMode (HideMode mode)
HideMode GetMode () const
void AddRevealPressure (int pressure)
void SetQuirk (HideQuirk quirk, bool active)
bool GetQuirk (HideQuirk quirk, bool allow_partial=true) const
bool ShouldHide () const
std::string DebugHideQuirks () const

Public Attributes

nux::Property< int > reveal_pressure
nux::Property< int > edge_decay_rate
nux::Property< float > reveal_progress
sigc::signal< void, bool > should_hide_changed

Private Member Functions

void EnsureHideState (bool skip_delay)
void SetShouldHide (bool value, bool skip_delay)
bool EmitShouldHideChanged ()
void OnDecayRateChanged (int value)

Private Attributes

ui::Decaymulator::Ptr decaymulator_
HideMode _mode
HideQuirk _quirks
bool _should_hide
bool _latest_emit_should_hide
glib::Source::UniquePtr _hide_delay_timeout
glib::Source::UniquePtr _hide_changed_emit_idle

Detailed Description

Definition at line 35 of file LauncherHideMachine.h.


Member Enumeration Documentation

Enumerator:
HIDE_NEVER 
AUTOHIDE 
DODGE_WINDOWS 
DODGE_ACTIVE_WINDOW 

Definition at line 38 of file LauncherHideMachine.h.

Enumerator:
DEFAULT 
LAUNCHER_HIDDEN 
MOUSE_OVER_LAUNCHER 
QUICKLIST_OPEN 
EXTERNAL_DND_ACTIVE 
INTERNAL_DND_ACTIVE 
TRIGGER_BUTTON_SHOW 
DND_PUSHED_OFF 
MOUSE_MOVE_POST_REVEAL 
VERTICAL_SLIDE_ACTIVE 
KEY_NAV_ACTIVE 
PLACES_VISIBLE 
LAST_ACTION_ACTIVATE 
SCALE_ACTIVE 
EXPO_ACTIVE 
MT_DRAG_OUT 
REVEAL_PRESSURE_PASS 
LAUNCHER_PULSE 
LOCK_HIDE 

Definition at line 46 of file LauncherHideMachine.h.

  {
    DEFAULT                = 0,
    LAUNCHER_HIDDEN        = 1 << 0,
    MOUSE_OVER_LAUNCHER    = 1 << 1,
    QUICKLIST_OPEN         = 1 << 4,
    EXTERNAL_DND_ACTIVE    = 1 << 5,
    INTERNAL_DND_ACTIVE    = 1 << 6,
    TRIGGER_BUTTON_SHOW    = 1 << 7,
    DND_PUSHED_OFF         = 1 << 10,
    MOUSE_MOVE_POST_REVEAL = 1 << 11,
    VERTICAL_SLIDE_ACTIVE  = 1 << 12,
    KEY_NAV_ACTIVE         = 1 << 13,
    PLACES_VISIBLE         = 1 << 14,
    LAST_ACTION_ACTIVATE   = 1 << 15,
    SCALE_ACTIVE           = 1 << 16,
    EXPO_ACTIVE            = 1 << 17,
    MT_DRAG_OUT            = 1 << 18,
    REVEAL_PRESSURE_PASS   = 1 << 19,
    LAUNCHER_PULSE         = 1 << 20,
    LOCK_HIDE              = 1 << 21
  } HideQuirk;

Constructor & Destructor Documentation

Definition at line 36 of file LauncherHideMachine.cpp.

  : reveal_progress(0)
  , decaymulator_(new ui::Decaymulator())
  , _mode(HIDE_NEVER)
  , _quirks(DEFAULT)
  , _should_hide(false)
  , _latest_emit_should_hide(false)
{
  decaymulator_->value.changed.connect([&](int value) { reveal_progress = value / static_cast<float>(reveal_pressure); });
  edge_decay_rate.changed.connect(sigc::mem_fun (this, &LauncherHideMachine::OnDecayRateChanged));
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 53 of file LauncherHideMachine.cpp.

{
  decaymulator_->value = decaymulator_->value + pressure;

  if (decaymulator_->value > reveal_pressure)
  {
    SetQuirk(REVEAL_PRESSURE_PASS, true);
    SetQuirk(MOUSE_MOVE_POST_REVEAL, true);
    decaymulator_->value = 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 239 of file LauncherHideMachine.cpp.

{
  // Although I do wonder why we are returning a string representation
  // of the enum value as an integer anyway.
  return boost::lexical_cast<std::string>(_quirks);
}

Here is the caller graph for this function:

Definition at line 228 of file LauncherHideMachine.cpp.

Here is the caller graph for this function:

void unity::launcher::LauncherHideMachine::EnsureHideState ( bool  skip_delay) [private]

Definition at line 112 of file LauncherHideMachine.cpp.

{
  bool should_hide;

  if (_mode == HIDE_NEVER)
  {
    SetShouldHide(false, skip_delay);
    return;
  }
  
  // early check to see if we are locking to hidden - but only if we are in non HIDE_NEVER
  if (GetQuirk(LOCK_HIDE))
  {
    SetShouldHide(true, true);
    return;
  }

  do
  {
    // first we check the condition where external DND is active and the push off has happened
    if (GetQuirk((HideQuirk)(EXTERNAL_DND_ACTIVE | DND_PUSHED_OFF), false))
    {
      should_hide = true;
      break;
    }

    // figure out if we are going to hide because of a window
    bool hide_for_window = false;
    if (_mode == AUTOHIDE)
      hide_for_window = true;

    // if we activated AND we would hide because of a window, go ahead and do it
    if (!_should_hide && GetQuirk(LAST_ACTION_ACTIVATE) && hide_for_window)
    {
      should_hide = true;
      break;
    }

    // Is there anything holding us open?
    HideQuirk _should_show_quirk;
    if (GetQuirk(LAUNCHER_HIDDEN))
    {
      _should_show_quirk = (HideQuirk) ((VISIBLE_REQUIRED) | REVEAL_PRESSURE_PASS);
    }
    else
    {
      _should_show_quirk = (HideQuirk)(VISIBLE_REQUIRED);
      // mouse position over launcher is only taken into account if we move it after the revealing state
      if (GetQuirk(MOUSE_MOVE_POST_REVEAL))
        _should_show_quirk = (HideQuirk)(_should_show_quirk | MOUSE_OVER_LAUNCHER);
    }

    if (GetQuirk(_should_show_quirk))
    {
      should_hide = false;
      break;
    }

    // nothing holding us open, any reason to hide?
    should_hide = hide_for_window;

  }
  while (false);

  SetShouldHide(should_hide, skip_delay);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 189 of file LauncherHideMachine.cpp.

{
  return _mode;
}
bool unity::launcher::LauncherHideMachine::GetQuirk ( LauncherHideMachine::HideQuirk  quirk,
bool  allow_partial = true 
) const

Definition at line 216 of file LauncherHideMachine.cpp.

{
  if (allow_partial)
    return _quirks & quirk;
  return (_quirks & quirk) == quirk;
}

Here is the caller graph for this function:

Definition at line 48 of file LauncherHideMachine.cpp.

{
  decaymulator_->rate_of_decay = value;  
}

Here is the caller graph for this function:

Definition at line 179 of file LauncherHideMachine.cpp.

{
  if (_mode == mode)
    return;

  _mode = mode;
  EnsureHideState(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 196 of file LauncherHideMachine.cpp.

{
  if (GetQuirk(quirk) == active)
    return;

  if (active)
    _quirks = (HideQuirk)(_quirks | quirk);
  else
    _quirks = (HideQuirk)(_quirks & ~quirk);

  // no skipping when last action was activate on general case
  bool skip = quirk & SKIP_DELAY_QUIRK && !GetQuirk(LAST_ACTION_ACTIVATE);

  // but skip on last action if we were out of the launcher/bfb
  if (GetQuirk(LAST_ACTION_ACTIVATE) && !active && (quirk & (MOUSE_OVER_LAUNCHER)))
    skip = true;

  EnsureHideState(skip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::launcher::LauncherHideMachine::SetShouldHide ( bool  value,
bool  skip_delay 
) [private]

Definition at line 65 of file LauncherHideMachine.cpp.

{
  if (_should_hide == value)
    return;

  if (value && !skip_delay)
  {
    _hide_delay_timeout.reset(new glib::Timeout(HIDE_DELAY_TIMEOUT_LENGTH));
    _hide_delay_timeout->Run([&] () {
      EnsureHideState(true);
      return false;
    });
  }
  else
  {
    _should_hide = value;

    _hide_changed_emit_idle.reset(new glib::Idle(glib::Source::Priority::DEFAULT));
    _hide_changed_emit_idle->Run(sigc::mem_fun(this, &LauncherHideMachine::EmitShouldHideChanged));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file LauncherHideMachine.cpp.

{
  return _should_hide;
}

Member Data Documentation

Definition at line 103 of file LauncherHideMachine.h.

Definition at line 102 of file LauncherHideMachine.h.

Definition at line 100 of file LauncherHideMachine.h.

Definition at line 97 of file LauncherHideMachine.h.

Definition at line 98 of file LauncherHideMachine.h.

Definition at line 99 of file LauncherHideMachine.h.

Definition at line 96 of file LauncherHideMachine.h.

Definition at line 70 of file LauncherHideMachine.h.

Definition at line 69 of file LauncherHideMachine.h.

Definition at line 71 of file LauncherHideMachine.h.

Definition at line 85 of file LauncherHideMachine.h.


The documentation for this class was generated from the following files: