Back to index

unity  6.0.0
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
unity::PanelMenuView Class Reference

#include <PanelMenuView.h>

Inheritance diagram for unity::PanelMenuView:
Inheritance graph
[legend]
Collaboration diagram for unity::PanelMenuView:
Collaboration graph
[legend]

List of all members.

Public Types

enum  IndicatorEntryPosition { AUTO = -1, START = nux::NUX_LAYOUT_BEGIN, END = nux::NUX_LAYOUT_END }
typedef
PanelIndicatorEntryView::IndicatorEntryType 
IndicatorEntryType
typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 PanelMenuView ()
 ~PanelMenuView ()
void SetMenuShowTimings (int fadein, int fadeout, int discovery, int discovery_fadein, int discovery_fadeout)
void SetMousePosition (int x, int y)
void SetMonitor (int monitor)
Window GetTopWindow () const
Window GetMaximizedWindow () const
bool GetControlsActive () const
void NotifyAllMenusClosed ()
virtual void AddIndicator (indicator::Indicator::Ptr const &indicator)
virtual void OverlayShown ()
virtual void OverlayHidden ()
void RemoveIndicator (indicator::Indicator::Ptr const &indicator)
PanelIndicatorEntryViewAddEntry (indicator::Entry::Ptr const &entry, int padding=5, IndicatorEntryPosition pos=AUTO, IndicatorEntryType type=IndicatorEntryType::INDICATOR)
void RemoveEntry (std::string const &entry_id)
PanelIndicatorEntryViewActivateEntryAt (int x, int y, int button=1)
PanelIndicatorEntryViewActivateEntry (std::string const &entry_id, int button=1)
bool ActivateIfSensitive ()
void SetOpacity (double opacity)
double GetOpacity ()
void SetMaximumEntriesWidth (int max_width)
void GetGeometryForSync (indicator::EntryLocationMap &locations)
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
virtual IntrospectableList GetIntrospectableChildren ()
guint64 GetIntrospectionId () const

Public Attributes

sigc::signal< void,
PanelIndicatorEntryView * > 
on_indicator_updated

Protected Types

typedef std::vector
< indicator::Indicator::Ptr
Indicators
typedef std::map< std::string,
PanelIndicatorEntryView * > 
Entries

Protected Member Functions

std::string GetName () const
void AddProperties (GVariantBuilder *builder)
virtual void Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
virtual void PreLayoutManagement ()
virtual nux::Area * FindAreaUnderMouse (const nux::Point &mouse_position, nux::NuxEventType event_type)
virtual void OnEntryAdded (indicator::Entry::Ptr const &entry)
Indicators GetIndicators ()
virtual void OnEntryRefreshed (PanelIndicatorEntryView *view)
virtual void OnEntryRemoved (std::string const &entry_id)
virtual void AddEntryView (PanelIndicatorEntryView *view, IndicatorEntryPosition pos=AUTO)
virtual void RemoveEntryView (PanelIndicatorEntryView *view)
virtual std::string GetChildsName () const
 Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Protected Attributes

nux::HLayout * layout_
Entries entries_

Private Member Functions

void OnActiveChanged (PanelIndicatorEntryView *view, bool is_active)
void OnViewOpened (BamfMatcher *matcher, BamfView *view)
void OnViewClosed (BamfMatcher *matcher, BamfView *view)
void OnApplicationClosed (BamfApplication *app)
void OnActiveWindowChanged (BamfMatcher *matcher, BamfView *old_view, BamfView *new_view)
void OnActiveAppChanged (BamfMatcher *matcher, BamfApplication *old_app, BamfApplication *new_app)
void OnNameChanged (BamfView *bamf_view, gchar *new_name, gchar *old_name)
void OnSpreadInitiate ()
void OnSpreadTerminate ()
void OnExpoInitiate ()
void OnExpoTerminate ()
void OnWindowMinimized (guint32 xid)
void OnWindowUnminimized (guint32 xid)
void OnWindowUnmapped (guint32 xid)
void OnWindowMapped (guint32 xid)
void OnWindowMaximized (guint32 xid)
void OnWindowRestored (guint32 xid)
void OnWindowMoved (guint32 xid)
void OnWindowDecorated (guint32 xid)
void OnWindowUndecorated (guint32 xid)
void OnMaximizedActivate (int x, int y)
void OnMaximizedRestore (int x, int y)
void OnMaximizedLower (int x, int y)
void OnMaximizedGrabStart (int x, int y)
void OnMaximizedGrabMove (int x, int y)
void OnMaximizedGrabEnd (int x, int y)
void FullRedraw ()
void Refresh (bool force=false)
void DrawTitle (cairo_t *cr_real, nux::Geometry const &geo, std::string const &label) const
void OnPanelViewMouseEnter (int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state)
void OnPanelViewMouseLeave (int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state)
void OnPanelViewMouseMove (int x, int y, int dx, int dy, unsigned long mouse_button_state, unsigned long special_keys_state)
BamfWindow * GetBamfWindowForXid (Window xid) const
std::string GetActiveViewName (bool use_appname=false) const
void OnSwitcherShown (GVariant *data)
void OnSwitcherSelectionChanged (GVariant *data)
void OnLauncherKeyNavStarted (GVariant *data)
void OnLauncherKeyNavEnded (GVariant *data)
void OnLauncherSelectionChanged (GVariant *data)
void UpdateShowNow (bool ignore)
bool UpdateActiveWindowPosition ()
bool UpdateShowNowWithDelay ()
bool OnNewAppShow ()
bool OnNewAppHide ()
bool IsValidWindow (Window xid) const
bool IsWindowUnderOurControl (Window xid) const
bool DrawMenus () const
bool DrawWindowButtons () const
void OnFadeInChanged (double)
void OnFadeOutChanged (double)

Private Attributes

glib::Object< BamfMatcher > _matcher
nux::TextureLayer * _title_layer
nux::HLayout * _menu_layout
nux::ObjectPtr< WindowButtons_window_buttons
nux::ObjectPtr
< PanelTitlebarGrabArea
_titlebar_grab_area
nux::ObjectPtr< nux::BaseTexture > _title_texture
nux::ObjectPtr
< nux::IOpenGLBaseTexture > 
_gradient_texture
bool _is_inside
bool _is_grabbed
bool _is_maximized
PanelIndicatorEntryView_last_active_view
glib::Object< BamfApplication > _new_application
std::map< Window, bool > _decor_map
std::set< Window > _maximized_set
std::list< glib::Object
< BamfApplication > > 
_new_apps
std::string _panel_title
nux::Geometry _last_geo
bool _overlay_showing
bool _switcher_showing
bool _launcher_keynav
bool _show_now_activated
bool _we_control_active
bool _new_app_menu_shown
int _monitor
Window _active_xid
nux::Geometry _monitor_geo
const std::string _desktop_name
int _menus_fadein
int _menus_fadeout
int _menus_discovery
int _menus_discovery_fadein
int _menus_discovery_fadeout
glib::Signal< void,
BamfMatcher *, BamfView * > 
_view_opened_signal
glib::Signal< void,
BamfMatcher *, BamfView * > 
_view_closed_signal
glib::Signal< void,
BamfMatcher *, BamfView
*, BamfView * > 
_active_win_changed_signal
glib::Signal< void,
BamfMatcher *, BamfApplication
*, BamfApplication * > 
_active_app_changed_signal
glib::Signal< void, BamfView
*, gchar *, gchar * > 
_view_name_changed_signal
sigc::connection _style_changed_connection
UBusManager _ubus_manager
glib::SourceManager _sources
Animator _fade_in_animator
Animator _fade_out_animator

Detailed Description

Definition at line 39 of file PanelMenuView.h.


Member Typedef Documentation

typedef std::map<std::string, PanelIndicatorEntryView*> unity::PanelIndicatorsView::Entries [protected, inherited]

Definition at line 93 of file PanelIndicatorsView.h.

Definition at line 51 of file PanelIndicatorsView.h.

typedef std::vector<indicator::Indicator::Ptr> unity::PanelIndicatorsView::Indicators [protected, inherited]

Definition at line 78 of file PanelIndicatorsView.h.

Definition at line 34 of file Introspectable.h.


Member Enumeration Documentation

Enumerator:
AUTO 
START 
END 

Definition at line 45 of file PanelIndicatorsView.h.

                              {
    AUTO = -1,
    START = nux::NUX_LAYOUT_BEGIN,
    END = nux::NUX_LAYOUT_END,
  };

Constructor & Destructor Documentation

Definition at line 57 of file PanelMenuView.cpp.

  : _matcher(bamf_matcher_get_default()),
    _is_inside(false),
    _is_grabbed(false),
    _is_maximized(false),
    _last_active_view(nullptr),
    _new_application(nullptr),
    _overlay_showing(false),
    _switcher_showing(false),
    _launcher_keynav(false),
    _show_now_activated(false),
    _we_control_active(false),
    _new_app_menu_shown(false),
    _monitor(0),
    _active_xid(0),
    _desktop_name(_("Ubuntu Desktop")),
    _menus_fadein(DEFAULT_MENUS_FADEIN),
    _menus_fadeout(DEFAULT_MENUS_FADEOUT),
    _menus_discovery(DEFAULT_MENUS_DISCOVERY),
    _menus_discovery_fadein(DEFAULT_DISCOVERY_FADEIN),
    _menus_discovery_fadeout(DEFAULT_DISCOVERY_FADEOUT),
    _fade_in_animator(_menus_fadein),
    _fade_out_animator(_menus_fadeout)
{
  layout_->SetContentDistribution(nux::eStackLeft);

  BamfWindow* active_win = bamf_matcher_get_active_window(_matcher);
  if (BAMF_IS_WINDOW(active_win))
    _active_xid = bamf_window_get_xid(active_win);

  _view_opened_signal.Connect(_matcher, "view-opened",
                              sigc::mem_fun(this, &PanelMenuView::OnViewOpened));
  _view_closed_signal.Connect(_matcher, "view-closed",
                              sigc::mem_fun(this, &PanelMenuView::OnViewClosed));
  _active_win_changed_signal.Connect(_matcher, "active-window-changed",
                                     sigc::mem_fun(this, &PanelMenuView::OnActiveWindowChanged));
  _active_app_changed_signal.Connect(_matcher, "active-application-changed",
                                     sigc::mem_fun(this, &PanelMenuView::OnActiveAppChanged));

  _window_buttons = new WindowButtons();
  _window_buttons->SetParentObject(this);
  _window_buttons->SetMonitor(_monitor);
  _window_buttons->SetControlledWindow(_active_xid);
  _window_buttons->SetLeftAndRightPadding(MAIN_LEFT_PADDING, MENUBAR_PADDING);
  _window_buttons->SetMaximumHeight(panel::Style::Instance().panel_height);
  _window_buttons->ComputeContentSize();

  _window_buttons->mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter));
  _window_buttons->mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave));
  //_window_buttons->mouse_move.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseMove));
  AddChild(_window_buttons.GetPointer());

  layout_->SetLeftAndRightPadding(_window_buttons->GetContentWidth(), 0);
  layout_->SetBaseHeight(panel::Style::Instance().panel_height);

  _titlebar_grab_area = new PanelTitlebarGrabArea();
  _titlebar_grab_area->SetParentObject(this);
  _titlebar_grab_area->activate_request.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedActivate));
  _titlebar_grab_area->restore_request.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedRestore));
  _titlebar_grab_area->lower_request.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedLower));
  _titlebar_grab_area->grab_started.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedGrabStart));
  _titlebar_grab_area->grab_move.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedGrabMove));
  _titlebar_grab_area->grab_end.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedGrabEnd));
  AddChild(_titlebar_grab_area.GetPointer());

  WindowManager* win_manager = WindowManager::Default();
  win_manager->window_minimized.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowMinimized));
  win_manager->window_unminimized.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowUnminimized));
  win_manager->window_maximized.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowMaximized));
  win_manager->window_restored.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowRestored));
  win_manager->window_unmapped.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowUnmapped));
  win_manager->window_mapped.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowMapped));
  win_manager->window_moved.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowMoved));
  win_manager->window_resized.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowMoved));
  win_manager->window_decorated.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowDecorated));
  win_manager->window_undecorated.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowUndecorated));
  win_manager->initiate_spread.connect(sigc::mem_fun(this, &PanelMenuView::OnSpreadInitiate));
  win_manager->terminate_spread.connect(sigc::mem_fun(this, &PanelMenuView::OnSpreadTerminate));
  win_manager->initiate_expo.connect(sigc::mem_fun(this, &PanelMenuView::OnExpoInitiate));
  win_manager->terminate_expo.connect(sigc::mem_fun(this, &PanelMenuView::OnExpoTerminate));
  win_manager->compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &PanelMenuView::OnExpoTerminate));

  _style_changed_connection = panel::Style::Instance().changed.connect([&] {
    _window_buttons->ComputeContentSize();
    layout_->SetLeftAndRightPadding(_window_buttons->GetContentWidth(), 0);

    Refresh(true);
    FullRedraw();
  });

  mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter));
  mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave));
  //mouse_move.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseMove));

  _titlebar_grab_area->mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter));
  _titlebar_grab_area->mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave));

  _ubus_manager.RegisterInterest(UBUS_SWITCHER_SHOWN, sigc::mem_fun(this, &PanelMenuView::OnSwitcherShown));
  _ubus_manager.RegisterInterest(UBUS_SWITCHER_SELECTION_CHANGED, sigc::mem_fun(this, &PanelMenuView::OnSwitcherSelectionChanged));

  _ubus_manager.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV, sigc::mem_fun(this, &PanelMenuView::OnLauncherKeyNavStarted));
  _ubus_manager.RegisterInterest(UBUS_LAUNCHER_END_KEY_NAV, sigc::mem_fun(this, &PanelMenuView::OnLauncherKeyNavEnded));
  _ubus_manager.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWTICHER, sigc::mem_fun(this, &PanelMenuView::OnLauncherKeyNavStarted));
  _ubus_manager.RegisterInterest(UBUS_LAUNCHER_END_KEY_SWTICHER, sigc::mem_fun(this, &PanelMenuView::OnLauncherKeyNavEnded));
  _ubus_manager.RegisterInterest(UBUS_LAUNCHER_SELECTION_CHANGED, sigc::mem_fun(this, &PanelMenuView::OnLauncherSelectionChanged));

  _fade_in_animator.animation_updated.connect(sigc::mem_fun(this, &PanelMenuView::OnFadeInChanged));
  _fade_in_animator.animation_ended.connect(sigc::mem_fun(this, &PanelMenuView::FullRedraw));
  _fade_out_animator.animation_updated.connect(sigc::mem_fun(this, &PanelMenuView::OnFadeOutChanged));
  _fade_out_animator.animation_ended.connect(sigc::mem_fun(this, &PanelMenuView::FullRedraw));

  SetOpacity(0.0f);
  _window_buttons->SetOpacity(0.0f);

  Refresh();
  FullRedraw();
}

Definition at line 175 of file PanelMenuView.cpp.

{
  _style_changed_connection.disconnect();
  _window_buttons->UnParentObject();
  _titlebar_grab_area->UnParentObject();
}

Member Function Documentation

PanelIndicatorEntryView * unity::PanelIndicatorsView::ActivateEntry ( std::string const &  entry_id,
int  button = 1 
) [inherited]

Definition at line 152 of file PanelIndicatorsView.cpp.

{
  auto entry = entries_.find(entry_id);

  if (entry != entries_.end())
  {
    PanelIndicatorEntryView* view = entry->second;

    if (view->IsSensitive() && view->IsVisible())
      view->Activate(button);

    return view;
  }

  return nullptr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PanelIndicatorEntryView * unity::PanelIndicatorsView::ActivateEntryAt ( int  x,
int  y,
int  button = 1 
) [inherited]

Definition at line 200 of file PanelIndicatorsView.cpp.

{
  PanelIndicatorEntryView* target = nullptr;
  bool found_old_active = false;

  //
  // Change the entry active status without waiting
  // for slow inter-process communication with unity-panel-service,
  // which causes visible lag in many cases.
  //

  for (auto entry : entries_)
  {
    PanelIndicatorEntryView* view = entry.second;

    if (!target && view->IsVisible() && view->IsFocused() &&
        view->IsSensitive() &&
        view->GetAbsoluteGeometry().IsPointInside(x, y))
    {
      view->Activate(button);
      target = view;
      break;
    }
    else if (target && view->IsActive())
    {
      view->Unactivate();
      found_old_active = true;
      break;
    }
  }

  if (target && !found_old_active)
  {
    for (auto entry : entries_)
    {
      PanelIndicatorEntryView* view = entry.second;

      if (view != target && view->IsActive())
      {
        view->Unactivate();
        break;
      }
    }
  }

  return target;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 170 of file PanelIndicatorsView.cpp.

{
  std::map<int, PanelIndicatorEntryView*> sorted_entries;
  
  for (auto entry : entries_)
    sorted_entries[entry.second->GetEntryPriority()] = entry.second;
  
  for (auto entry : sorted_entries)
  {
    PanelIndicatorEntryView* view = entry.second;

    if (view->IsSensitive() && view->IsVisible() && view->IsFocused())
    {
      /* Use the 0 button, it means it's a keyboard activation */
      view->Activate(0);
      return true;
    }
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file Introspectable.cpp.

{
  _children.push_back(child);
  child->_parents.push_back(this);
}

Here is the caller graph for this function:

PanelIndicatorEntryView * unity::PanelIndicatorsView::AddEntry ( indicator::Entry::Ptr const &  entry,
int  padding = 5,
IndicatorEntryPosition  pos = AUTO,
IndicatorEntryType  type = IndicatorEntryType::INDICATOR 
) [inherited]

Definition at line 301 of file PanelIndicatorsView.cpp.

{
  auto view = new PanelIndicatorEntryView(entry, padding, type);
  AddEntryView(view, pos);

  return view;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelIndicatorsView::AddEntryView ( PanelIndicatorEntryView view,
IndicatorEntryPosition  pos = AUTO 
) [protected, virtual, inherited]

Definition at line 257 of file PanelIndicatorsView.cpp.

{
  if (!view)
    return;

  int entry_pos = pos;

  view->SetOpacity(opacity_);
  view->refreshed.connect(sigc::mem_fun(this, &PanelIndicatorsView::OnEntryRefreshed));

  if (entry_pos == IndicatorEntryPosition::AUTO)
  {
    entry_pos = nux::NUX_LAYOUT_BEGIN;

    if (view->GetEntryPriority() > -1)
    {
      for (auto area : layout_->GetChildren())
      {
        auto en = dynamic_cast<PanelIndicatorEntryView*>(area);

        if (en)
        {
          if (en && view->GetEntryPriority() <= en->GetEntryPriority())
            break;

          entry_pos++;
        }
      }
    }
  }

  layout_->AddView(view, 0, nux::eCenter, nux::eFull, 1.0, (nux::LayoutPosition) entry_pos);

  entries_[view->GetEntryID()] = view;

  AddChild(view);
  QueueRelayout();
  QueueDraw();

  on_indicator_updated.emit(view);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::AddIndicator ( indicator::Indicator::Ptr const &  indicator) [virtual]

Reimplemented from unity::PanelIndicatorsView.

Definition at line 194 of file PanelMenuView.cpp.

{
  if (!GetIndicators().empty())
  {
    LOG_ERROR(logger) << "PanelMenuView has already an indicator!";
    return;
  }

  PanelIndicatorsView::AddIndicator(indicator);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::AddProperties ( GVariantBuilder *  builder) [protected, virtual]

Reimplemented from unity::PanelIndicatorsView.

Definition at line 1508 of file PanelMenuView.cpp.

{
  PanelIndicatorsView::AddProperties(builder);

  variant::BuilderWrapper(builder)
  .add("mouse_inside", _is_inside)
  .add("grabbed", _is_grabbed)
  .add("active_win_maximized", _is_maximized)
  .add("panel_title", _panel_title)
  .add("desktop_active", (_panel_title == _desktop_name))
  .add("monitor", _monitor)
  .add("active_window", _active_xid)
  .add("draw_menus", DrawMenus())
  .add("draw_window_buttons", DrawWindowButtons())
  .add("controls_active_window", _we_control_active)
  .add("fadein_duration", _menus_fadein)
  .add("fadeout_duration", _menus_fadeout)
  .add("discovery_duration", _menus_discovery)
  .add("discovery_fadein_duration", _menus_discovery_fadein)
  .add("discovery_fadeout_duration", _menus_discovery_fadeout);
}

Here is the call graph for this function:

void unity::PanelMenuView::Draw ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [protected, virtual]

Reimplemented from unity::PanelIndicatorsView.

Definition at line 357 of file PanelMenuView.cpp.

{
  nux::Geometry const& geo = GetGeometry();
  int button_width = _window_buttons->GetContentWidth();
  const float factor = 4;
  button_width /= factor;

  if (geo != _last_geo)
  {
    _last_geo = geo;
    QueueRelayout();
    Refresh(true);
  }

  GfxContext.PushClippingRectangle(geo);

  /* "Clear" out the background */
  nux::ROPConfig rop;
  rop.Blend = true;
  rop.SrcBlend = GL_ONE;
  rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;

  nux::ColorLayer layer(nux::Color(0x00000000), true, rop);
  nux::GetPainter().PushDrawLayer(GfxContext, GetGeometry(), &layer);

  if (_title_texture)
  {
    guint blend_alpha = 0, blend_src = 0, blend_dest = 0;
    bool draw_menus = DrawMenus();
    bool draw_window_buttons = DrawWindowButtons();
    bool has_menu = false;
    bool draw_faded_title = false;

    GfxContext.GetRenderStates().GetBlend(blend_alpha, blend_src, blend_dest);

    for (auto entry : entries_)
    {
      if (entry.second->IsVisible())
      {
        has_menu = true;
        break;
      }
    }

    if (!draw_window_buttons && _we_control_active && has_menu &&
        (draw_menus || (GetOpacity() > 0.0f && _window_buttons->GetOpacity() == 0.0f)))
    {
      draw_faded_title = true;
    }

    if (draw_faded_title)
    {
      bool build_gradient = false;
      nux::SURFACE_LOCKED_RECT lockrect;
      lockrect.pBits = 0;
      bool locked = false;

      if (_gradient_texture.IsNull() || (_gradient_texture->GetWidth() != geo.width))
      {
        build_gradient = true;
      }
      else
      {
        if (_gradient_texture->LockRect(0, &lockrect, nullptr) != OGL_OK)
          build_gradient = true;
        else
          locked = true;

        if (!lockrect.pBits)
        {
          build_gradient = true;

          if (locked)
            _gradient_texture->UnlockRect(0);
        }
      }

      if (build_gradient)
      {
        nux::NTextureData texture_data(nux::BITFMT_R8G8B8A8, geo.width, 1, 1);

        _gradient_texture = nux::GetGraphicsDisplay()->GetGpuDevice()->
                            CreateSystemCapableDeviceTexture(texture_data.GetWidth(),
                            texture_data.GetHeight(), 1, texture_data.GetFormat());
        locked = (_gradient_texture->LockRect(0, &lockrect, nullptr) == OGL_OK);
      }

      BYTE* dest_buffer = (BYTE*) lockrect.pBits;
      int gradient_opacity = 255.0f * GetOpacity();
      int buttons_opacity = 255.0f * _window_buttons->GetOpacity();

      int first_step = button_width * (factor - 1);
      int second_step = button_width * factor;

      for (int x = 0; x < geo.width && dest_buffer && locked; x++)
      {
        BYTE r, g, b, a;

        r = 223;
        g = 219;
        b = 210;

        if (x < first_step)
        {
          int color_increment = (first_step - x) * 4;

          r = CLAMP(r + color_increment, r, 0xff);
          g = CLAMP(g + color_increment, g, 0xff);
          b = CLAMP(b + color_increment, b, 0xff);
          a = 0xff - buttons_opacity;
        }
        else if (x < second_step)
        {
          a = 0xff - gradient_opacity * (((float)x - (first_step)) /
                                         (float)(button_width));
        }
        else
        {
          if (!draw_menus)
          {
            a = 0xff - gradient_opacity;
          }
          else
          {
            // If we're fading-out the title, it's better to quickly hide
            // the transparent right-most area
            a = CLAMP(0xff - gradient_opacity - 0x55, 0x00, 0xff);
          }
        }

        *(dest_buffer + 4 * x + 0) = (r * a) / 0xff; //red
        *(dest_buffer + 4 * x + 1) = (g * a) / 0xff; //green
        *(dest_buffer + 4 * x + 2) = (b * a) / 0xff; //blue
        *(dest_buffer + 4 * x + 3) = a;
      }

      // FIXME Nux shouldn't make unity to crash if we try to unlock a wrong rect
      if (locked)
        _gradient_texture->UnlockRect(0);

      GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

      nux::TexCoordXForm texxform0;
      nux::TexCoordXForm texxform1;

      // Modulate the checkboard and the gradient texture
      GfxContext.QRP_2TexMod(geo.x, geo.y,
                             geo.width, geo.height,
                             _gradient_texture, texxform0,
                             nux::color::White,
                             _title_texture->GetDeviceTexture(),
                             texxform1,
                             nux::color::White);
    }
    else if (!_overlay_showing)
    {
      double title_opacity = 0.0f;

      if (_we_control_active && _window_buttons->GetOpacity() == 0.0 &&
          (!has_menu || (has_menu && GetOpacity() == 0.0)))
      {
        title_opacity = 1.0f;
      }
      else
      {
        title_opacity = 1.0f;

        if (has_menu)
          title_opacity -= MAX(GetOpacity(), _window_buttons->GetOpacity());
        else
          title_opacity -= _window_buttons->GetOpacity();

        if (!draw_window_buttons && !draw_menus)
        {
          // If we're fading-out the buttons/menus, let's fade-in quickly the title
          title_opacity = CLAMP(title_opacity + 0.1f, 0.0f, 1.0f);
        }
        else
        {
          // If we're fading-in the buttons/menus, let's fade-out quickly the title
          title_opacity = CLAMP(title_opacity - 0.2f, 0.0f, 1.0f);
        }
      }

      if (title_opacity > 0.0f)
      {
        nux::TexCoordXForm texxform;
        GfxContext.QRP_1Tex(geo.x, geo.y, geo.width, geo.height,
                            _title_texture->GetDeviceTexture(), texxform,
                            nux::color::White * title_opacity);
      }
    }

    GfxContext.GetRenderStates().SetBlend(blend_alpha, blend_src, blend_dest);
  }

  nux::GetPainter().PopBackground();

  GfxContext.PopClippingRectangle();
}

Here is the call graph for this function:

void unity::PanelMenuView::DrawContent ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [protected, virtual]

Reimplemented from unity::PanelIndicatorsView.

Definition at line 558 of file PanelMenuView.cpp.

{
  nux::Geometry const& geo = GetGeometry();
  bool draw_menus = DrawMenus();
  bool draw_buttons = DrawWindowButtons();

  GfxContext.PushClippingRectangle(geo);

  if (draw_menus)
  {
    for (auto entry : entries_)
      entry.second->SetDisabled(false);

    layout_->ProcessDraw(GfxContext, true);

    _fade_out_animator.Stop();

    if (_new_application && !_is_inside)
    {
      _fade_in_animator.Start(_menus_discovery_fadein, GetOpacity());
    }
    else
    {
      _fade_in_animator.Start(GetOpacity());
      _new_app_menu_shown = false;
    }
  }
  else
  {
    for (auto entry : entries_)
      entry.second->SetDisabled(true);
  }

  if (GetOpacity() != 0.0f && !draw_menus && !_overlay_showing)
  {
    layout_->ProcessDraw(GfxContext, true);

    _fade_in_animator.Stop();

    if (!_new_app_menu_shown)
    {
      _fade_out_animator.Start(1.0f - GetOpacity());
    }
    else
    {
      _fade_out_animator.Start(_menus_discovery_fadeout, 1.0f - GetOpacity());
    }
  }

  if (draw_buttons)
  {
    _window_buttons->ProcessDraw(GfxContext, true);

    if (_window_buttons->GetOpacity() != 1.0f)
    {
      _fade_out_animator.Stop();
      _fade_in_animator.Start(_window_buttons->GetOpacity());
    }
  }

  if (_window_buttons->GetOpacity() != 0.0f && !draw_buttons)
  {
    _window_buttons->ProcessDraw(GfxContext, true);
    _fade_in_animator.Stop();

    /* If we try to hide only the buttons, then use a faster fadeout */
    if (!_fade_out_animator.IsRunning())
    {
      _fade_out_animator.Start(_menus_fadeout/3, 1.0f - _window_buttons->GetOpacity());
    }
  }

  GfxContext.PopClippingRectangle();
}

Here is the call graph for this function:

bool unity::PanelMenuView::DrawMenus ( ) const [private]

Definition at line 320 of file PanelMenuView.cpp.

{
  auto wm = WindowManager::Default();
  bool screen_grabbed = (wm->IsExpoActive() || wm->IsScaleActive());

  if (_we_control_active && !_overlay_showing && !screen_grabbed &&
      !_switcher_showing && !_launcher_keynav)
  {
    if (_is_inside || _last_active_view || _show_now_activated || _new_application)
    {
      return true;
    }
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::DrawTitle ( cairo_t *  cr_real,
nux::Geometry const &  geo,
std::string const &  label 
) const [private]

Definition at line 698 of file PanelMenuView.cpp.

{
  using namespace panel;
  cairo_t* cr;
  cairo_pattern_t* linpat;
  const int fading_pixels = 35;
  int x = MAIN_LEFT_PADDING + TITLE_PADDING + geo.x;
  int y = geo.y;

  int text_width = 0;
  int text_height = 0;
  int text_space = 0;

  // Find out dimensions first
  GdkScreen* screen = gdk_screen_get_default();
  PangoContext* cxt;
  PangoRectangle log_rect;
  PangoFontDescription* desc;

  nux::CairoGraphics util_cg(CAIRO_FORMAT_ARGB32, 1, 1);
  cr = util_cg.GetContext();

  int dpi = Style::Instance().GetTextDPI();

  std::string font_description(Style::Instance().GetFontDescription(PanelItem::TITLE));
  desc = pango_font_description_from_string(font_description.c_str());

  glib::Object<PangoLayout> layout(pango_cairo_create_layout(cr));
  pango_layout_set_font_description(layout, desc);
  pango_layout_set_markup(layout, label.c_str(), -1);

  cxt = pango_layout_get_context(layout);
  pango_cairo_context_set_font_options(cxt, gdk_screen_get_font_options(screen));
  pango_cairo_context_set_resolution(cxt, dpi / static_cast<float>(PANGO_SCALE));
  pango_layout_context_changed(layout);

  pango_layout_get_extents(layout, nullptr, &log_rect);
  text_width = log_rect.width / PANGO_SCALE;
  text_height = log_rect.height / PANGO_SCALE;

  pango_font_description_free(desc);
  cairo_destroy(cr);

  // Draw the text
  GtkStyleContext* style_context = Style::Instance().GetStyleContext();
  text_space = geo.width - x;
  cr = cr_real;
  cairo_set_operator(cr, CAIRO_OPERATOR_OVER);

  gtk_style_context_save(style_context);

  GtkWidgetPath* widget_path = gtk_widget_path_new();
  gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);
  gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
  gtk_widget_path_iter_set_name(widget_path, -1 , "UnityPanelWidget");

  gtk_style_context_set_path(style_context, widget_path);
  gtk_style_context_add_class(style_context, GTK_STYLE_CLASS_MENUBAR);
  gtk_style_context_add_class(style_context, GTK_STYLE_CLASS_MENUITEM);

  y += (geo.height - text_height) / 2;

  pango_cairo_update_layout(cr, layout);

  if (text_width > text_space)
  {
    int out_pixels = text_width - text_space;
    int fading_width = out_pixels < fading_pixels ? out_pixels : fading_pixels;

    cairo_push_group(cr);
    gtk_render_layout(style_context, cr, x, y, layout);
    cairo_pop_group_to_source(cr);

    linpat = cairo_pattern_create_linear(geo.width - fading_width, y, geo.width, y);
    cairo_pattern_add_color_stop_rgba(linpat, 0, 0, 0, 0, 1);
    cairo_pattern_add_color_stop_rgba(linpat, 1, 0, 0, 0, 0);
    cairo_mask(cr, linpat);

    cairo_pattern_destroy(linpat);
  }
  else
  {
    gtk_render_layout(style_context, cr, x, y, layout);
  }

  x += text_width;

  gtk_widget_path_free(widget_path);
  gtk_style_context_restore(style_context);
}

Here is the caller graph for this function:

bool unity::PanelMenuView::DrawWindowButtons ( ) const [private]

Definition at line 337 of file PanelMenuView.cpp.

{
  auto wm = WindowManager::Default();
  bool screen_grabbed = (wm->IsExpoActive() || wm->IsScaleActive());

  if (_overlay_showing)
    return true;

  if (_we_control_active && _is_maximized && !screen_grabbed &&
      !_launcher_keynav && !_switcher_showing)
  {
    if (_is_inside || _show_now_activated || _new_application)
    {
      return true;
    }
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nux::Area * unity::PanelMenuView::FindAreaUnderMouse ( const nux::Point &  mouse_position,
nux::NuxEventType  event_type 
) [protected, virtual]

Definition at line 236 of file PanelMenuView.cpp.

{
  bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type);

  if (!mouse_inside)
    return nullptr;

  Area* found_area = nullptr;

  if (_overlay_showing)
  {
    if (_window_buttons)
      return _window_buttons->FindAreaUnderMouse(mouse_position, event_type);
  }

  if (!_we_control_active)
  {
    /* When the current panel is not active, it all behaves like a grab-area */
    if (GetAbsoluteGeometry().IsInside(mouse_position))
      return _titlebar_grab_area.GetPointer();
  }

  if (_is_maximized)
  {
    if (_window_buttons)
    {
      found_area = _window_buttons->FindAreaUnderMouse(mouse_position, event_type);
      NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area);
    }
  }

  if (_titlebar_grab_area && !_overlay_showing)
  {
    found_area = _titlebar_grab_area->FindAreaUnderMouse(mouse_position, event_type);
    NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area);
  }

  return PanelIndicatorsView::FindAreaUnderMouse(mouse_position, event_type);
}

Definition at line 230 of file PanelMenuView.cpp.

{
  QueueDraw();
  _window_buttons->QueueDraw();
}

Here is the caller graph for this function:

std::string unity::PanelMenuView::GetActiveViewName ( bool  use_appname = false) const [private]

Definition at line 633 of file PanelMenuView.cpp.

{
  std::string label;
  BamfWindow* window;

  window = bamf_matcher_get_active_window(_matcher);

  if (BAMF_IS_WINDOW(window))
  {
    BamfView *view = reinterpret_cast<BamfView*>(window);
    std::vector<Window> const& our_xids = nux::XInputWindow::NativeHandleList();
    Window window_xid = bamf_window_get_xid(window);

    if (std::find(our_xids.begin(), our_xids.end(), window_xid) != our_xids.end())
    {
      /* If the active window is an unity window, we need to fallback to the
       * top one, anyway we should always avoid to focus unity internal windows */
      BamfWindow* top_win = GetBamfWindowForXid(GetTopWindow());

      if (top_win && top_win != window)
      {
        window = top_win;
      }
      else
      {
        return "";
      }
    }

    if (bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP)
    {
      label = _desktop_name;
    }
    else if (!IsValidWindow(window_xid))
    {
       return "";
    }

    if (WindowManager::Default()->IsWindowMaximized(window_xid) && !use_appname)
    {
      label = glib::String(bamf_view_get_name(view)).Str();
    }

    if (label.empty())
    {
      BamfApplication* app;
      app = bamf_matcher_get_application_for_window(_matcher, window);

      if (BAMF_IS_APPLICATION(app))
      {
        view = reinterpret_cast<BamfView*>(app);
        label = glib::String(bamf_view_get_name(view)).Str();
      }
    }

    if (label.empty())
    {
      view = reinterpret_cast<BamfView*>(window);
      label = glib::String(bamf_view_get_name(view)).Str();
    }
  }

  return label;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfWindow * unity::PanelMenuView::GetBamfWindowForXid ( Window  xid) const [private]

Definition at line 1344 of file PanelMenuView.cpp.

{
  BamfWindow* window = nullptr;

  if (xid != 0)
  {
    GList* windows = bamf_matcher_get_windows(_matcher);

    for (GList* l = windows; l; l = l->next)
    {
      if (!BAMF_IS_WINDOW(l->data))
        continue;

      auto win = static_cast<BamfWindow*>(l->data);

      if (bamf_window_get_xid(win) == xid)
      {
        window = win;
        break;
      }
    }

    g_list_free(windows);
  }

  return window;
}

Here is the caller graph for this function:

std::string unity::debug::Introspectable::GetChildsName ( ) const [protected, virtual, inherited]

Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Definition at line 92 of file Introspectable.cpp.

{
  return "Children";
}

Here is the caller graph for this function:

Definition at line 1698 of file PanelMenuView.cpp.

{
  return _we_control_active;
}

Here is the caller graph for this function:

Definition at line 193 of file PanelIndicatorsView.cpp.

{
  for (auto entry : entries_)
    entry.second->GetGeometryForSync(locations);
}

Here is the caller graph for this function:

Definition at line 109 of file PanelIndicatorsView.cpp.

{
  return indicators_;
}

Here is the caller graph for this function:

Introspectable::IntrospectableList unity::debug::Introspectable::GetIntrospectableChildren ( ) [virtual, inherited]

Reimplemented in unity::hud::View, unity::launcher::LauncherModel, unity::QuicklistView, and unity::dash::ResultView.

Definition at line 41 of file Introspectable.cpp.

{
  return _children;
}

Here is the caller graph for this function:

guint64 unity::debug::Introspectable::GetIntrospectionId ( ) const [inherited]

Definition at line 97 of file Introspectable.cpp.

{
  return _id;
}

Here is the caller graph for this function:

Definition at line 1302 of file PanelMenuView.cpp.

{
  Window window_xid = 0;

  // Find the front-most of the maximized windows we are controlling
  for (auto xid : _maximized_set)
  {
    // We can safely assume only the front-most is visible
    if (IsValidWindow(xid))
    {
      window_xid = xid;
      break;
    }
  }

  return window_xid;
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unity::PanelMenuView::GetName ( ) const [protected, virtual]

Reimplemented from unity::PanelIndicatorsView.

Definition at line 1503 of file PanelMenuView.cpp.

{
  return "MenuView";
}

Definition at line 368 of file PanelIndicatorsView.cpp.

{
  return opacity_;
}

Here is the caller graph for this function:

Definition at line 1320 of file PanelMenuView.cpp.

{
  Window window_xid = 0;
  GList* windows = bamf_matcher_get_window_stack_for_monitor(_matcher, _monitor);

  for (GList* l = windows; l; l = l->next)
  {
    if (!BAMF_IS_WINDOW(l->data))
      continue;

    Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
    bool visible = bamf_view_user_visible(static_cast<BamfView*>(l->data));

    if (visible && IsValidWindow(xid))
    {
      window_xid = xid;
    }
  }

  g_list_free(windows);

  return window_xid;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GVariant * unity::debug::Introspectable::Introspect ( ) [inherited]

Definition at line 47 of file Introspectable.cpp.

{
  GVariantBuilder  builder;
  GVariantBuilder  child_builder;
  gint             n_children = 0;

  g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}"));
  g_variant_builder_add(&builder, "{sv}", "id", g_variant_new_uint64(_id));

  AddProperties(&builder);

  g_variant_builder_init(&child_builder, G_VARIANT_TYPE("as"));

  auto children = GetIntrospectableChildren();
  for (auto it = children.begin(); it != children.end(); it++)
  {
    if ((*it)->GetName() != "")
    {
      g_variant_builder_add(&child_builder, "s", (*it)->GetName().c_str());
      n_children++;
    }
  }

  GVariant* child_results = g_variant_builder_end(&child_builder);

  if (n_children > 0)
    g_variant_builder_add(&builder, "{sv}", GetChildsName().c_str(), child_results);
  return g_variant_builder_end(&builder);
}

Here is the call graph for this function:

bool unity::PanelMenuView::IsValidWindow ( Window  xid) const [private]

Definition at line 1287 of file PanelMenuView.cpp.

{
  auto wm = WindowManager::Default();
  std::vector<Window> const& our_xids = nux::XInputWindow::NativeHandleList();

  if (wm->IsWindowOnCurrentDesktop(xid) && !wm->IsWindowObscured(xid) &&
      wm->IsWindowVisible(xid) && IsWindowUnderOurControl(xid) &&
      std::find(our_xids.begin(), our_xids.end(), xid) == our_xids.end())
  {
    return true;
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::PanelMenuView::IsWindowUnderOurControl ( Window  xid) const [private]

Definition at line 1272 of file PanelMenuView.cpp.

{
  if (UScreen::GetDefault()->GetMonitors().size() > 1)
  {
    auto wm = WindowManager::Default();
    nux::Geometry const& window_geo = wm->GetWindowGeometry(xid);
    nux::Geometry const& intersect = _monitor_geo.Intersect(window_geo);

    /* We only care of the horizontal window portion */
    return (intersect.width > window_geo.width/2 && intersect.height > 0);
  }

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 891 of file PanelMenuView.cpp.

{
  _last_active_view = nullptr;

  auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
  _is_inside = GetAbsoluteGeometry().IsInside(mouse);
  FullRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnActiveAppChanged ( BamfMatcher *  matcher,
BamfApplication *  old_app,
BamfApplication *  new_app 
) [private]

Definition at line 988 of file PanelMenuView.cpp.

{
  if (BAMF_IS_APPLICATION(new_app))
  {
    if (std::find(_new_apps.begin(), _new_apps.end(), new_app) != _new_apps.end())
    {
      if (_new_application != new_app)
      {
        /* Add a small delay before showing the menus, this is done both
         * to fix the issues with applications that takes some time to loads
         * menus and to show the menus only when an application has been
         * kept active for some time */

        auto timeout = std::make_shared<glib::Timeout>(300);
        _sources.Add(timeout, NEW_APP_SHOW_TIMEOUT);
        timeout->Run(sigc::mem_fun(this, &PanelMenuView::OnNewAppShow));
      }
    }
    else
    {
      _sources.Remove(NEW_APP_SHOW_TIMEOUT);

      if (_sources.GetSource(NEW_APP_HIDE_TIMEOUT))
      {
        _sources.Remove(NEW_APP_HIDE_TIMEOUT);
        _new_app_menu_shown = false;
      }

      if (_new_application)
        OnApplicationClosed(_new_application);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnActiveChanged ( PanelIndicatorEntryView view,
bool  is_active 
) [private]

Definition at line 859 of file PanelMenuView.cpp.

{
  if (is_active)
  {
    _last_active_view = view;
  }
  else
  {
    if (_last_active_view == view)
    {
      _last_active_view = nullptr;
    }
  }

  Refresh();
  FullRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnActiveWindowChanged ( BamfMatcher *  matcher,
BamfView *  old_view,
BamfView *  new_view 
) [private]

Definition at line 1024 of file PanelMenuView.cpp.

{
  _show_now_activated = false;
  _is_maximized = false;
  _active_xid = 0;

  _sources.Remove(WINDOW_MOVED_TIMEOUT);

  if (BAMF_IS_WINDOW(new_view))
  {
    WindowManager *wm = WindowManager::Default();
    BamfWindow* window = reinterpret_cast<BamfWindow*>(new_view);
    guint32 xid = bamf_window_get_xid(window);
    _active_xid = xid;
    _is_maximized = wm->IsWindowMaximized(xid);

    if (bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP)
      _we_control_active = true;
    else
      _we_control_active = IsWindowUnderOurControl(xid);

    if (_decor_map.find(xid) == _decor_map.end())
    {
      _decor_map[xid] = true;

      // if we've just started tracking this window and it is maximized, let's
      // make sure it's undecorated just in case it slipped by us earlier
      // (I'm looking at you, Chromium!)
      if (_is_maximized && wm->IsWindowDecorated(xid))
      {
        wm->Undecorate(xid);
        _maximized_set.insert(xid);
      }
    }

    // first see if we need to remove and old callback
    _view_name_changed_signal.Disconnect();

    // register callback for new view
    _view_name_changed_signal.Connect(new_view, "name-changed",
                                      sigc::mem_fun(this, &PanelMenuView::OnNameChanged));

    _window_buttons->SetControlledWindow(_is_maximized ? _active_xid : 0);
  }

  Refresh();
  FullRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnApplicationClosed ( BamfApplication *  app) [private]

Definition at line 944 of file PanelMenuView.cpp.

{
  if (BAMF_IS_APPLICATION(app))
  {
    if (std::find(_new_apps.begin(), _new_apps.end(), app) != _new_apps.end())
    {
      _new_apps.remove(glib::Object<BamfApplication>(app, glib::AddRef()));
    }
    else if (_new_apps.empty())
    {
      _new_application = nullptr;
    }
  }

  if (app == _new_application)
  {
    _new_application = nullptr;
  }
}

Here is the caller graph for this function:

void unity::PanelMenuView::OnEntryAdded ( indicator::Entry::Ptr const &  entry) [protected, virtual]

Reimplemented from unity::PanelIndicatorsView.

Definition at line 877 of file PanelMenuView.cpp.

{
  PanelIndicatorEntryView* view;

  view = new PanelIndicatorEntryView(entry, MENU_ENTRIES_PADDING, IndicatorEntryType::MENU);
  view->mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter));
  view->mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave));

  entry->show_now_changed.connect(sigc::mem_fun(this, &PanelMenuView::UpdateShowNow));
  view->active_changed.connect(sigc::mem_fun(this, &PanelMenuView::OnActiveChanged));

  AddEntryView(view, IndicatorEntryPosition::END);
}

Here is the call graph for this function:

void unity::PanelIndicatorsView::OnEntryRefreshed ( PanelIndicatorEntryView view) [protected, virtual, inherited]

Definition at line 317 of file PanelIndicatorsView.cpp.

{
  QueueRelayout();
  QueueDraw();

  on_indicator_updated.emit(view);
}

Here is the caller graph for this function:

void unity::PanelIndicatorsView::OnEntryRemoved ( std::string const &  entry_id) [protected, virtual, inherited]

Definition at line 348 of file PanelIndicatorsView.cpp.

{
  RemoveEntry(entry_id);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1099 of file PanelMenuView.cpp.

{
  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1105 of file PanelMenuView.cpp.

{
  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnFadeInChanged ( double  opacity) [private]

Definition at line 296 of file PanelMenuView.cpp.

{
  if (DrawMenus() && GetOpacity() != 1.0f)
    SetOpacity(opacity);

  if (DrawWindowButtons() && _window_buttons->GetOpacity() != 1.0f)
    _window_buttons->SetOpacity(opacity);

  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnFadeOutChanged ( double  progress) [private]

Definition at line 307 of file PanelMenuView.cpp.

{
  double opacity = CLAMP(1.0f - progress, 0.0f, 1.0f);

  if (!DrawMenus() && GetOpacity() != 0.0f)
    SetOpacity(opacity);

  if (!DrawWindowButtons() && _window_buttons->GetOpacity() != 0.0f)
    _window_buttons->SetOpacity(opacity);

  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnLauncherKeyNavEnded ( GVariant *  data) [private]

Definition at line 1582 of file PanelMenuView.cpp.

{
  if (!_launcher_keynav)
    return;

  _launcher_keynav = false;

  auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
  _is_inside = GetAbsoluteGeometry().IsInside(mouse);

  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnLauncherKeyNavStarted ( GVariant *  data) [private]

Definition at line 1570 of file PanelMenuView.cpp.

{
  if (_launcher_keynav)
    return;


  if (!data || (data && g_variant_get_int32(data) == _monitor))
  {
    _launcher_keynav = true;
  }
}

Here is the caller graph for this function:

void unity::PanelMenuView::OnLauncherSelectionChanged ( GVariant *  data) [private]

Definition at line 1596 of file PanelMenuView.cpp.

{
  if (!data || !_launcher_keynav)
    return;

  const gchar *title = g_variant_get_string(data, 0);
  _panel_title = (title ? title : "");

  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnMaximizedActivate ( int  x,
int  y 
) [private]

Definition at line 1372 of file PanelMenuView.cpp.

{
  Window maximized = GetMaximizedWindow();

  if (maximized != 0)
  {
    WindowManager::Default()->Activate(maximized);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnMaximizedGrabEnd ( int  x,
int  y 
) [private]

Definition at line 1486 of file PanelMenuView.cpp.

{
  _titlebar_grab_area->SetGrabbed(false);

  x += _titlebar_grab_area->GetAbsoluteX();
  y += _titlebar_grab_area->GetAbsoluteY();
  _is_inside = GetAbsoluteGeometry().IsPointInside(x, y);

  if (!_is_inside)
    _is_grabbed = false;

  Refresh();
  FullRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnMaximizedGrabMove ( int  x,
int  y 
) [private]

Definition at line 1427 of file PanelMenuView.cpp.

{
  auto panel = static_cast<nux::BaseWindow*>(GetTopLevelViewWindow());

  if (!panel)
    return;

  /* Adjusting the x, y coordinates to get the absolute values */
  x += _titlebar_grab_area->GetAbsoluteX();
  y += _titlebar_grab_area->GetAbsoluteY();

  Window maximized = GetMaximizedWindow();

  /* When the drag goes out from the Panel, start the real movement.
   *
   * This is a workaround to avoid that the grid plugin would be fired
   * showing the window shape preview effect. See bug #838923 */
  if (maximized != 0 && panel)
  {
    nux::Geometry const& panel_geo = panel->GetAbsoluteGeometry();

    if (!panel_geo.IsPointInside(x, y))
    {
      auto wm = WindowManager::Default();
      nux::Geometry const& restored_geo = wm->GetWindowSavedGeometry(maximized);
      nux::Geometry const& workarea_geo = wm->GetWorkAreaGeometry(maximized);

      /* By default try to restore the window horizontally-centered respect to the
       * pointer position, if it doesn't fit on that area try to keep it into the
       * current workarea as much as possible, but giving priority to the left border
       * that shouldn't be never put out of the workarea */
      int restore_x = x - (restored_geo.width * x / panel_geo.width);
      int restore_y = y;

      if (restore_x + restored_geo.width > workarea_geo.x + workarea_geo.width)
      {
        restore_x = workarea_geo.x + workarea_geo.width - restored_geo.width;
      }

      if (restore_x < workarea_geo.x)
      {
        restore_x = workarea_geo.x;
      }

      wm->Activate(maximized);
      wm->RestoreAt(maximized, restore_x, restore_y);

      _is_inside = true;
      _is_grabbed = true;
      Refresh();
      FullRedraw();

      /* Ungrab the pointer and start the X move, to make the decorator handle it */
      _titlebar_grab_area->SetGrabbed(false);
      wm->StartMove(maximized, x, y);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnMaximizedGrabStart ( int  x,
int  y 
) [private]

Definition at line 1409 of file PanelMenuView.cpp.

{
  /* When Start dragging the panelmenu of a maximized window, change cursor
   * to simulate the dragging, waiting to go out of the panel area.
   *
   * This is a workaround to avoid that the grid plugin would be fired
   * showing the window shape preview effect. See bug #838923 */

  Window maximized = GetMaximizedWindow();

  if (maximized != 0)
  {
    /* Always activate the window in case it is on another monitor */
    WindowManager::Default()->Activate(maximized);
    _titlebar_grab_area->SetGrabbed(true);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnMaximizedLower ( int  x,
int  y 
) [private]

Definition at line 1396 of file PanelMenuView.cpp.

{
  if (_overlay_showing)
    return;

  Window maximized = GetMaximizedWindow();

  if (maximized != 0)
  {
    WindowManager::Default()->Lower(maximized);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnMaximizedRestore ( int  x,
int  y 
) [private]

Definition at line 1382 of file PanelMenuView.cpp.

{
  if (_overlay_showing)
    return;

  Window maximized = GetMaximizedWindow();

  if (maximized != 0)
  {
    WindowManager::Default()->Restore(maximized);
    _is_inside = true;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnNameChanged ( BamfView *  bamf_view,
gchar *  new_name,
gchar *  old_name 
) [private]

Definition at line 900 of file PanelMenuView.cpp.

{
  Refresh();
  FullRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 924 of file PanelMenuView.cpp.

{
  OnApplicationClosed(_new_application);
  _new_app_menu_shown = true;
  QueueDraw();

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 906 of file PanelMenuView.cpp.

{
  BamfApplication* active_app = bamf_matcher_get_active_application(_matcher);
  _new_application = glib::Object<BamfApplication>(active_app, glib::AddRef());
  QueueDraw();

  if (_sources.GetSource(NEW_APP_HIDE_TIMEOUT))
  {
    _new_app_menu_shown = false;
  }

  auto timeout = std::make_shared<glib::TimeoutSeconds>(_menus_discovery);
  _sources.Add(timeout, NEW_APP_HIDE_TIMEOUT);
  timeout->Run(sigc::mem_fun(this, &PanelMenuView::OnNewAppHide));

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnPanelViewMouseEnter ( int  x,
int  y,
unsigned long  mouse_button_state,
unsigned long  special_keys_state 
) [private]

Definition at line 1703 of file PanelMenuView.cpp.

{
  if (!_is_inside)
  {
    if (_is_grabbed)
      _is_grabbed = false;
    else
      _is_inside = true;

    FullRedraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnPanelViewMouseLeave ( int  x,
int  y,
unsigned long  mouse_button_state,
unsigned long  special_keys_state 
) [private]

Definition at line 1716 of file PanelMenuView.cpp.

{
  if (_is_inside)
  {
    _is_inside = false;
    FullRedraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnPanelViewMouseMove ( int  x,
int  y,
int  dx,
int  dy,
unsigned long  mouse_button_state,
unsigned long  special_keys_state 
) [private]

Definition at line 1725 of file PanelMenuView.cpp.

{}

Definition at line 1075 of file PanelMenuView.cpp.

{
  /*foreach (guint32 &xid, windows)
  {
    if (WindowManager::Default()->IsWindowMaximized(xid))
      WindowManager::Default()->Decorate(xid);
  }*/

  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1087 of file PanelMenuView.cpp.

{
  /*foreach (guint32 &xid, windows)
  {
    if (WindowManager::Default()->IsWindowMaximized(xid))
      WindowManager::Default()->Undecorate(xid);
  }*/

  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnSwitcherSelectionChanged ( GVariant *  data) [private]

Definition at line 1558 of file PanelMenuView.cpp.

{
  if (!data || !_switcher_showing)
    return;

  const gchar *title = g_variant_get_string(data, 0);
  _panel_title = (title ? title : "");

  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnSwitcherShown ( GVariant *  data) [private]

Definition at line 1530 of file PanelMenuView.cpp.

{
  if (!data)
    return;

  gboolean switcher_shown;
  gint monitor;
  g_variant_get(data, "(bi)", &switcher_shown, &monitor);

  if (switcher_shown == _switcher_showing || monitor != _monitor)
    return;

  _switcher_showing = switcher_shown;

  if (!_switcher_showing)
  {
    auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
    _is_inside = GetAbsoluteGeometry().IsInside(mouse);
  }
  else
  {
    _show_now_activated = false;
  }

  Refresh();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnViewClosed ( BamfMatcher *  matcher,
BamfView *  view 
) [private]

Definition at line 964 of file PanelMenuView.cpp.

{
  if (reinterpret_cast<BamfView*>(_view_name_changed_signal.object()) == view)
  {
    _view_name_changed_signal.Disconnect();
  }

  if (BAMF_IS_APPLICATION(view))
  {
    OnApplicationClosed(reinterpret_cast<BamfApplication*>(view));
  }
  else if (reinterpret_cast<BamfApplication*>(view) == _new_application)
  {
    _new_application = nullptr;
  }
  else if (BAMF_IS_WINDOW(view))
  {
    /* FIXME, this can be removed when window_unmapped WindowManager signal
     * will emit the proper xid */
    Window xid = bamf_window_get_xid(reinterpret_cast<BamfWindow*>(view));
    OnWindowUnmapped(xid);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnViewOpened ( BamfMatcher *  matcher,
BamfView *  view 
) [private]

Definition at line 933 of file PanelMenuView.cpp.

{
  /* FIXME: here we should also check for if the view is also user_visible
   * but it seems that BAMF doesn't handle this correctly after some
   * stress tests (repeated launches). */
  if (!BAMF_IS_APPLICATION(view))
    return;

  _new_apps.push_front(glib::Object<BamfApplication>(BAMF_APPLICATION(view), glib::AddRef()));
}

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowDecorated ( guint32  xid) [private]

Definition at line 1162 of file PanelMenuView.cpp.

{
  _decor_map[xid] = true;

  if (_maximized_set.find(xid) != _maximized_set.end ())
  {
    WindowManager::Default()->Undecorate(xid);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowMapped ( guint32  xid) [private]

Definition at line 1150 of file PanelMenuView.cpp.

{
  if (WindowManager::Default()->IsWindowMaximized(xid))
  {
    WindowManager::Default()->Undecorate(xid);
    _maximized_set.insert(xid);

    Refresh();
    QueueDraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowMaximized ( guint32  xid) [private]

Definition at line 1177 of file PanelMenuView.cpp.

{
  bool updated = false;
  bool is_active = (_active_xid == xid);

  if (is_active)
  {
    // We need to update the _is_inside state in the case of maximization by grab
    auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
    _is_inside = GetAbsoluteGeometry().IsInside(mouse);

    _is_maximized = true;
    updated = true;
  }

  // update the state of the window in the _decor_map
  _decor_map[xid] = WindowManager::Default()->IsWindowDecorated(xid);

  if (_decor_map[xid])
    WindowManager::Default()->Undecorate(xid);

  _maximized_set.insert(xid);

  if (updated)
  {
    Refresh();
    FullRedraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowMinimized ( guint32  xid) [private]

Definition at line 1111 of file PanelMenuView.cpp.

{
  if (WindowManager::Default()->IsWindowMaximized(xid))
  {
    WindowManager::Default()->Decorate(xid);
    _maximized_set.erase(xid);

    Refresh();
    QueueDraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowMoved ( guint32  xid) [private]

Definition at line 1242 of file PanelMenuView.cpp.

{
  if (_active_xid == xid)
  {
    /* When moving the active window, if the current panel is controlling
     * the active window, then we postpone the timeout function every movement
     * that we have, setting a longer timeout.
     * Otherwise, if the moved window is not controlled by the current panel
     * every few millisecond we check the new window position */

    unsigned int timeout_length = 250;

    if (_we_control_active)
    {
      _sources.Remove(WINDOW_MOVED_TIMEOUT);
    }
    else
    {
      if (_sources.GetSource(WINDOW_MOVED_TIMEOUT))
        return;

      timeout_length = 60;
    }

    auto timeout = std::make_shared<glib::Timeout>(timeout_length);
    _sources.Add(timeout, WINDOW_MOVED_TIMEOUT);
    timeout->Run(sigc::mem_fun(this, &PanelMenuView::UpdateActiveWindowPosition));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowRestored ( guint32  xid) [private]

Definition at line 1207 of file PanelMenuView.cpp.

{
  if (_maximized_set.find(xid) == _maximized_set.end())
    return;

  if (_active_xid == xid)
  {
    _is_maximized = false;
    _is_grabbed = false;
  }

  if (_decor_map[xid])
    WindowManager::Default()->Decorate(xid);

  _maximized_set.erase(xid);

  Refresh();
  FullRedraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowUndecorated ( guint32  xid) [private]

Definition at line 1172 of file PanelMenuView.cpp.

{
  _decor_map[xid] = false;
}

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowUnmapped ( guint32  xid) [private]

Definition at line 1135 of file PanelMenuView.cpp.

{
  // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap)
  // we need to do this again on BamfView closed signal.
  if (_maximized_set.find(xid) != _maximized_set.end())
  {
    WindowManager::Default()->Decorate(xid);
    _maximized_set.erase(xid);
    _decor_map.erase(xid);

    Refresh();
    QueueDraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::OnWindowUnminimized ( guint32  xid) [private]

Definition at line 1123 of file PanelMenuView.cpp.

{
  if (WindowManager::Default()->IsWindowMaximized(xid))
  {
    WindowManager::Default()->Undecorate(xid);
    _maximized_set.insert(xid);

    Refresh();
    QueueDraw();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from unity::PanelIndicatorsView.

Definition at line 188 of file PanelMenuView.cpp.

{
  _overlay_showing = false;
  QueueDraw();
}

Here is the caller graph for this function:

Reimplemented from unity::PanelIndicatorsView.

Definition at line 182 of file PanelMenuView.cpp.

{
  _overlay_showing = true;
  QueueDraw();
}

Here is the caller graph for this function:

void unity::PanelMenuView::PreLayoutManagement ( ) [protected, virtual]

Definition at line 276 of file PanelMenuView.cpp.

{
  PanelIndicatorsView::PreLayoutManagement();
  nux::Geometry const& geo = GetGeometry();

  _window_buttons->ComputeContentSize();
  int buttons_diff = geo.height - _window_buttons->GetContentHeight();
  _window_buttons->SetBaseY(buttons_diff > 0 ? std::ceil(buttons_diff/2.0f) : 0);

  layout_->ComputeContentSize();
  int layout_width = layout_->GetContentWidth();

  _titlebar_grab_area->SetBaseX(layout_width);
  _titlebar_grab_area->SetBaseHeight(geo.height);
  _titlebar_grab_area->SetMinimumWidth(geo.width - layout_width);
  _titlebar_grab_area->SetMaximumWidth(geo.width - layout_width);

  SetMaximumEntriesWidth(geo.width - _window_buttons->GetContentWidth());
}

Here is the call graph for this function:

void unity::PanelMenuView::Refresh ( bool  force = false) [private]

Definition at line 789 of file PanelMenuView.cpp.

{
  nux::Geometry const& geo = GetGeometry();

  // We can get into a race that causes the geometry to be wrong as there hasn't been a
  // layout cycle before the first callback. This is to protect from that.
  if (geo.width > _monitor_geo.width)
    return;

  auto win_manager = WindowManager::Default();
  std::string new_title;

  if (win_manager->IsScaleActive())
  {
    if (win_manager->IsScaleActiveForGroup())
      new_title = GetActiveViewName(true);
    else if (_we_control_active)
      new_title = _desktop_name;
  }
  else if (win_manager->IsExpoActive())
  {
    new_title = _desktop_name;
  }
  else if (!_we_control_active)
  {
    new_title = "";
  }
  else if (!_switcher_showing && !_launcher_keynav)
  {
    new_title = GetActiveViewName();
    _window_buttons->SetControlledWindow(_active_xid);
  }

  if (!_switcher_showing && !_launcher_keynav)
  {
    if (_panel_title != new_title)
    {
      _panel_title = new_title;
    }
    else if (!force && _last_geo == geo && _title_texture)
    {
      // No need to redraw the title, let's save some CPU time!
      return;
    }
  }

  if (_panel_title.empty())
  {
    _title_texture = nullptr;
    return;
  }

  nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height);
  cairo_t* cr = cairo_graphics.GetContext();

  cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
  cairo_paint(cr);

  glib::String escaped(g_markup_escape_text(_panel_title.c_str(), -1));

  std::ostringstream bold_label;
  bold_label << "<b>" << escaped.Str() << "</b>";

  DrawTitle(cr, geo, bold_label.str());

  cairo_destroy(cr);

  _title_texture = texture_ptr_from_cairo_graphics(cairo_graphics);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 85 of file Introspectable.cpp.

{
  _children.remove(child);
  child->_parents.remove(this);
}

Here is the caller graph for this function:

void unity::PanelIndicatorsView::RemoveEntry ( std::string const &  entry_id) [inherited]

Definition at line 342 of file PanelIndicatorsView.cpp.

{
  RemoveEntryView(entries_[entry_id]);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelIndicatorsView::RemoveEntryView ( PanelIndicatorEntryView view) [protected, virtual, inherited]

Definition at line 326 of file PanelIndicatorsView.cpp.

{
  if (!view)
    return;

  std::string const& entry_id = view->GetEntryID();
  RemoveChild(view);
  on_indicator_updated.emit(view);
  entries_.erase(entry_id);
  layout_->RemoveChildObject(view);

  QueueRelayout();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 82 of file PanelIndicatorsView.cpp.

{
  auto connections = indicators_connections_.find(indicator);

  if (connections != indicators_connections_.end()) {
    for (auto conn : connections->second)
      conn.disconnect();

    indicators_connections_.erase(indicator);
  }

  for (auto entry : indicator->GetEntries())
    OnEntryRemoved(entry->id());

  for (auto i = indicators_.begin(); i != indicators_.end(); i++)
  {
    if (*i == indicator)
    {
      indicators_.erase(i);
      break;
    }
  }

  LOG_DEBUG(logger) << "IndicatorRemoved: " << indicator->name();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelIndicatorsView::SetMaximumEntriesWidth ( int  max_width) [inherited]

Definition at line 125 of file PanelIndicatorsView.cpp.

{
  unsigned int n_entries = 0;

  for (auto entry : entries_)
    if (entry.second->IsVisible())
      n_entries++;

  if (n_entries > 0)
  {
    for (auto entry : entries_)
    {
      if (entry.second->IsVisible() && n_entries > 0)
      {
        int max_entry_width = max_width / n_entries;

        if (entry.second->GetBaseWidth() > max_entry_width)
          entry.second->SetMaximumWidth(max_entry_width);

        max_width -= entry.second->GetBaseWidth();
        --n_entries;
      }
    }
  }
}

Here is the caller graph for this function:

void unity::PanelMenuView::SetMenuShowTimings ( int  fadein,
int  fadeout,
int  discovery,
int  discovery_fadein,
int  discovery_fadeout 
)

Definition at line 205 of file PanelMenuView.cpp.

{
  if (fadein > -1)
  {
    _menus_fadein = fadein;
    _fade_in_animator.SetDuration(_menus_fadein);
  }

  if (fadeout > -1)
  {
    _menus_fadeout = fadeout;
    _fade_out_animator.SetDuration(_menus_fadeout);
  }

  if (discovery > -1)
    _menus_discovery = discovery;

  if (discovery_fadein > -1)
    _menus_discovery_fadein = discovery_fadein;

  if (discovery_fadeout > -1)
    _menus_discovery_fadeout = discovery_fadeout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::SetMonitor ( int  monitor)

Definition at line 1655 of file PanelMenuView.cpp.

{
  _monitor = monitor;
  _monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(_monitor);

  _maximized_set.clear();
  GList* windows = bamf_matcher_get_window_stack_for_monitor(_matcher, _monitor);

  for (GList* l = windows; l; l = l->next)
  {
    if (!BAMF_IS_WINDOW(l->data))
      continue;

    auto window = static_cast<BamfWindow*>(l->data);
    auto view = static_cast<BamfView*>(l->data);

    if (bamf_view_is_active(view))
    {
      _active_xid = bamf_window_get_xid(window);
    }

    if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED)
    {
      Window xid = bamf_window_get_xid(window);

      _decor_map[xid] = WindowManager::Default()->IsWindowDecorated(xid);

      if (_decor_map[xid])
        WindowManager::Default()->Undecorate(xid);

      _maximized_set.insert(xid);
    }
  }

  Window maximized = GetMaximizedWindow();
  Window buttons_win = (maximized == _active_xid) ? maximized : 0;

  _window_buttons->SetMonitor(_monitor);
  _window_buttons->SetControlledWindow(buttons_win);

  g_list_free(windows);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::SetMousePosition ( int  x,
int  y 
)

Definition at line 1728 of file PanelMenuView.cpp.

{
  if (_last_active_view ||
      (x >= 0 && y >= 0 && GetAbsoluteGeometry().IsPointInside(x, y)))
  {
    if (!_is_inside)
    {
      _is_inside = true;
      FullRedraw();
    }
  }
  else
  {
    if (_is_inside)
    {
      _is_inside = false;
      FullRedraw();
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelIndicatorsView::SetOpacity ( double  opacity) [inherited]

Definition at line 374 of file PanelIndicatorsView.cpp.

{
  opacity = CLAMP(opacity, 0.0f, 1.0f);

  for (auto entry: entries_)
    entry.second->SetOpacity(opacity);

  if (opacity_ != opacity)
  {
    opacity_ = opacity;
    NeedRedraw();
  }
}

Here is the caller graph for this function:

Definition at line 1227 of file PanelMenuView.cpp.

{
  bool we_control_window = IsWindowUnderOurControl(_active_xid);

  if (we_control_window != _we_control_active)
  {
    _we_control_active = we_control_window;

    Refresh();
    QueueDraw();
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::PanelMenuView::UpdateShowNow ( bool  ignore) [private]

Definition at line 1630 of file PanelMenuView.cpp.

{
  /* When we get a show now event, if we are requested to show the menus,
   * we take the last incoming event and we wait for small delay (to avoid the
   * Alt+Tab conflict) then we check if any menuitem has requested to show.
   * If the status is false, we just check that the menus entries are hidden
   * and we remove any eventual delayed request */

   _sources.Remove(UPDATE_SHOW_NOW_TIMEOUT);

  if (!status && _show_now_activated)
  {
    _show_now_activated = false;
    QueueDraw();
    return;
  }

  if (status && !_show_now_activated)
  {
    auto timeout = std::make_shared<glib::Timeout>(180);
    _sources.Add(timeout, UPDATE_SHOW_NOW_TIMEOUT);
    timeout->Run(sigc::mem_fun(this, &PanelMenuView::UpdateShowNowWithDelay));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1608 of file PanelMenuView.cpp.

{
  bool active = false;

  for (auto entry : entries_)
  {
    if (entry.second->GetShowNow())
    {
      active = true;
      break;
    }
  }

  if (active)
  {
    _show_now_activated = true;
    QueueDraw();
  }

  return false;
}

Here is the caller graph for this function:


Member Data Documentation

glib::Signal<void, BamfMatcher*, BamfApplication*, BamfApplication*> unity::PanelMenuView::_active_app_changed_signal [private]

Definition at line 180 of file PanelMenuView.h.

glib::Signal<void, BamfMatcher*, BamfView*, BamfView*> unity::PanelMenuView::_active_win_changed_signal [private]

Definition at line 179 of file PanelMenuView.h.

Definition at line 167 of file PanelMenuView.h.

std::map<Window, bool> unity::PanelMenuView::_decor_map [private]

Definition at line 153 of file PanelMenuView.h.

const std::string unity::PanelMenuView::_desktop_name [private]

Definition at line 169 of file PanelMenuView.h.

Definition at line 187 of file PanelMenuView.h.

Definition at line 188 of file PanelMenuView.h.

nux::ObjectPtr<nux::IOpenGLBaseTexture> unity::PanelMenuView::_gradient_texture [private]

Definition at line 144 of file PanelMenuView.h.

Definition at line 147 of file PanelMenuView.h.

Definition at line 146 of file PanelMenuView.h.

Definition at line 148 of file PanelMenuView.h.

Definition at line 150 of file PanelMenuView.h.

nux::Geometry unity::PanelMenuView::_last_geo [private]

Definition at line 157 of file PanelMenuView.h.

Definition at line 161 of file PanelMenuView.h.

Definition at line 137 of file PanelMenuView.h.

std::set<Window> unity::PanelMenuView::_maximized_set [private]

Definition at line 154 of file PanelMenuView.h.

nux::HLayout* unity::PanelMenuView::_menu_layout [private]

Definition at line 140 of file PanelMenuView.h.

Definition at line 173 of file PanelMenuView.h.

Definition at line 174 of file PanelMenuView.h.

Definition at line 175 of file PanelMenuView.h.

Definition at line 171 of file PanelMenuView.h.

Definition at line 172 of file PanelMenuView.h.

Definition at line 166 of file PanelMenuView.h.

nux::Geometry unity::PanelMenuView::_monitor_geo [private]

Definition at line 168 of file PanelMenuView.h.

Definition at line 164 of file PanelMenuView.h.

Definition at line 151 of file PanelMenuView.h.

std::list<glib::Object<BamfApplication> > unity::PanelMenuView::_new_apps [private]

Definition at line 155 of file PanelMenuView.h.

Definition at line 159 of file PanelMenuView.h.

std::string unity::PanelMenuView::_panel_title [private]

Definition at line 156 of file PanelMenuView.h.

Definition at line 162 of file PanelMenuView.h.

Definition at line 185 of file PanelMenuView.h.

Definition at line 182 of file PanelMenuView.h.

Definition at line 160 of file PanelMenuView.h.

nux::TextureLayer* unity::PanelMenuView::_title_layer [private]

Definition at line 139 of file PanelMenuView.h.

nux::ObjectPtr<nux::BaseTexture> unity::PanelMenuView::_title_texture [private]

Definition at line 143 of file PanelMenuView.h.

Definition at line 142 of file PanelMenuView.h.

Definition at line 184 of file PanelMenuView.h.

glib::Signal<void, BamfMatcher*, BamfView*> unity::PanelMenuView::_view_closed_signal [private]

Definition at line 178 of file PanelMenuView.h.

glib::Signal<void, BamfView*, gchar*, gchar*> unity::PanelMenuView::_view_name_changed_signal [private]

Definition at line 181 of file PanelMenuView.h.

glib::Signal<void, BamfMatcher*, BamfView*> unity::PanelMenuView::_view_opened_signal [private]

Definition at line 177 of file PanelMenuView.h.

Definition at line 163 of file PanelMenuView.h.

Definition at line 141 of file PanelMenuView.h.

Definition at line 94 of file PanelIndicatorsView.h.

nux::HLayout* unity::PanelIndicatorsView::layout_ [protected, inherited]

Definition at line 92 of file PanelIndicatorsView.h.

Definition at line 72 of file PanelIndicatorsView.h.


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