Back to index

unity  6.0.0
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes
unity::launcher::Controller::Impl Class Reference
Collaboration diagram for unity::launcher::Controller::Impl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~Impl ()
void UpdateNumWorkspaces (int workspaces)
LauncherCreateLauncher (int monitor)
void Save ()
void SortAndUpdate ()
nux::ObjectPtr< LauncherCurrentLauncher ()
void OnIconAdded (AbstractLauncherIcon::Ptr icon)
void OnIconRemoved (AbstractLauncherIcon::Ptr icon)
void OnLauncherAddRequest (char *path, AbstractLauncherIcon::Ptr before)
void OnLauncherAddRequestSpecial (std::string const &path, std::string const &aptdaemon_trans_id, std::string const &icon_path, int icon_x, int icon_y, int icon_size)
void OnLauncherRemoveRequest (AbstractLauncherIcon::Ptr icon)
void OnSCIconAnimationComplete (AbstractLauncherIcon::Ptr icon)
void OnLauncherEntryRemoteAdded (LauncherEntryRemote::Ptr const &entry)
void OnLauncherEntryRemoteRemoved (LauncherEntryRemote::Ptr const &entry)
void OnFavoriteStoreFavoriteAdded (std::string const &entry, std::string const &pos, bool before)
void OnFavoriteStoreFavoriteRemoved (std::string const &entry)
void OnFavoriteStoreReordered ()
void InsertExpoAction ()
void RemoveExpoAction ()
void InsertDesktopIcon ()
void RemoveDesktopIcon ()
void SendHomeActivationRequest ()
int MonitorWithMouse ()
void InsertTrash ()
void RegisterIcon (AbstractLauncherIcon::Ptr icon)
AbstractLauncherIcon::Ptr CreateFavorite (const char *file_path)
SoftwareCenterLauncherIcon::Ptr CreateSCLauncherIcon (std::string const &file_path, std::string const &aptdaemon_trans_id, std::string const &icon_path)
void SetupBamf ()
void EnsureLaunchers (int primary, std::vector< nux::Geometry > const &monitors)
void OnExpoActivated ()
void OnScreenChanged (int primary_monitor, std::vector< nux::Geometry > &monitors)
void OnWindowFocusChanged (guint32 xid)
void OnViewOpened (BamfMatcher *matcher, BamfView *view)
void ReceiveMouseDownOutsideArea (int x, int y, unsigned long button_flags, unsigned long key_flags)
void ReceiveLauncherKeyPress (unsigned long eventType, unsigned long keysym, unsigned long state, const char *character, unsigned short keyCount)

Static Public Member Functions

 Impl (Display *display, Controller *parent)
static void OnBusAcquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
static void OnDBusMethodCall (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data)

Public Attributes

Controllerparent_
LauncherModel::Ptr model_
nux::ObjectPtr< Launcherlauncher_
nux::ObjectPtr< Launcherkeyboard_launcher_
int sort_priority_
DeviceLauncherSection device_section_
LauncherEntryRemoteModel remote_model_
AbstractLauncherIcon::Ptr expo_icon_
AbstractLauncherIcon::Ptr desktop_icon_
int num_workspaces_
bool show_desktop_icon_
Display * display_
bool launcher_open
bool launcher_keynav
bool launcher_grabbed
bool reactivate_keynav
int reactivate_index
bool keynav_restore_window_
int launcher_key_press_time_
unsigned int dbus_owner_
ui::EdgeBarrierController::Ptr edge_barriers_
LauncherList launchers
glib::Object< BamfMatcher > matcher_
glib::Signal< void,
BamfMatcher *, BamfView * > 
view_opened_signal_
glib::SourceManager sources_
UBusManager ubus
sigc::connection on_expoicon_activate_connection_
sigc::connection launcher_key_press_connection_
sigc::connection launcher_event_outside_connection_

Static Public Attributes

static GDBusInterfaceVTable interface_vtable

Detailed Description

Definition at line 95 of file LauncherController.cpp.


Constructor & Destructor Documentation

unity::launcher::Controller::Impl::Impl ( Display *  display,
Controller parent 
) [static]

Definition at line 212 of file LauncherController.cpp.

  : parent_(parent)
  , model_(new LauncherModel())
  , sort_priority_(0)
  , show_desktop_icon_(false)
  , display_(display)
  , edge_barriers_(new ui::EdgeBarrierController())
  , matcher_(bamf_matcher_get_default())
{
  edge_barriers_->options = parent_->options();

  UScreen* uscreen = UScreen::GetDefault();
  auto monitors = uscreen->GetMonitors();
  int primary = uscreen->GetPrimaryMonitor();

  launcher_open = false;
  launcher_keynav = false;
  launcher_grabbed = false;
  reactivate_keynav = false;
  keynav_restore_window_ = true;

  EnsureLaunchers(primary, monitors);

  launcher_ = launchers[0];
  device_section_.IconAdded.connect(sigc::mem_fun(this, &Impl::OnIconAdded));

  num_workspaces_ = WindowManager::Default()->WorkspaceCount();
  if (num_workspaces_ > 1)
  {
    InsertExpoAction();
  }

  // Insert the "Show Desktop" launcher icon in the launcher...
  if (show_desktop_icon_)
    InsertDesktopIcon();

  InsertTrash();

  sources_.Add(std::make_shared<glib::Timeout>(500, [&]() { SetupBamf(); return false; }));

  remote_model_.entry_added.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteAdded));
  remote_model_.entry_removed.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteRemoved));

  FavoriteStore::Instance().favorite_added.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteAdded));
  FavoriteStore::Instance().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved));
  FavoriteStore::Instance().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));

  LauncherHideMode hide_mode = parent_->options()->hide_mode;
  BFBLauncherIcon* bfb = new BFBLauncherIcon(hide_mode);
  RegisterIcon(AbstractLauncherIcon::Ptr(bfb));

  HudLauncherIcon* hud = new HudLauncherIcon(hide_mode);
  RegisterIcon(AbstractLauncherIcon::Ptr(hud));

  parent_->options()->hide_mode.changed.connect([bfb,hud](LauncherHideMode mode) {
    bfb->SetHideMode(mode);
    hud->SetHideMode(mode);
  });

  desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());

  uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));

  WindowManager& plugin_adapter = *(WindowManager::Default());
  plugin_adapter.window_focus_changed.connect (sigc::mem_fun (this, &Controller::Impl::OnWindowFocusChanged));

  launcher_key_press_time_ = 0;

  ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [&](GVariant * args) {
    if (reactivate_keynav)
      parent_->KeyNavGrab();
      model_->SetSelection(reactivate_index);
  });

  parent_->AddChild(model_.get());

  uscreen->resuming.connect([&]() -> void {
    for (auto launcher : launchers)
      launcher->QueueDraw();
  });

  dbus_owner_ = g_bus_own_name(G_BUS_TYPE_SESSION, DBUS_NAME.c_str(), G_BUS_NAME_OWNER_FLAGS_NONE,
                               OnBusAcquired, nullptr, nullptr, this, nullptr);
}

Here is the call graph for this function:

Definition at line 297 of file LauncherController.cpp.

{
  // Since the launchers are in a window which adds a reference to the
  // launcher, we need to make sure the base windows are unreferenced
  // otherwise the launchers never die.
  for (auto launcher_ptr : launchers)
  {
    if (launcher_ptr.IsValid())
      launcher_ptr->GetParent()->UnReference();
  }

  g_bus_unown_name(dbus_owner_);
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 760 of file LauncherController.cpp.

{
  BamfApplication* app;
  AbstractLauncherIcon::Ptr result;

  app = bamf_matcher_get_application_for_desktop_file(matcher_, file_path, true);
  if (!app)
    return result;

  if (g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")))
  {
    bamf_view_set_sticky(BAMF_VIEW(app), true);
    return result;
  }

  bamf_view_set_sticky(BAMF_VIEW(app), true);
  AbstractLauncherIcon::Ptr icon (new BamfLauncherIcon(app));
  icon->SetSortPriority(sort_priority_++);
  result = icon;

  return result;
}

Definition at line 390 of file LauncherController.cpp.

{
  nux::BaseWindow* launcher_window = new nux::BaseWindow(TEXT("LauncherWindow"));

  Launcher* launcher = new Launcher(launcher_window);
  launcher->display = display_;
  launcher->monitor = monitor;
  launcher->options = parent_->options();
  launcher->SetModel(model_);

  nux::HLayout* layout = new nux::HLayout(NUX_TRACKER_LOCATION);
  layout->AddView(launcher, 1);
  layout->SetContentDistribution(nux::eStackLeft);
  layout->SetVerticalExternalMargin(0);
  layout->SetHorizontalExternalMargin(0);

  launcher_window->SetLayout(layout);
  launcher_window->SetBackgroundColor(nux::color::Transparent);
  launcher_window->ShowWindow(true);
  launcher_window->EnableInputWindow(true, launcher::window_title, false, false);
  launcher_window->InputWindowEnableStruts(false);
  launcher_window->SetEnterFocusInputArea(launcher);

  launcher->launcher_addrequest.connect(sigc::mem_fun(this, &Impl::OnLauncherAddRequest));
  launcher->launcher_removerequest.connect(sigc::mem_fun(this, &Impl::OnLauncherRemoveRequest));

  launcher->icon_animation_complete.connect(sigc::mem_fun(this, &Impl::OnSCIconAnimationComplete));

  parent_->AddChild(launcher);

  return launcher;
}

Here is the call graph for this function:

SoftwareCenterLauncherIcon::Ptr unity::launcher::Controller::Impl::CreateSCLauncherIcon ( std::string const &  file_path,
std::string const &  aptdaemon_trans_id,
std::string const &  icon_path 
)

Definition at line 783 of file LauncherController.cpp.

{
  BamfApplication* app;
  SoftwareCenterLauncherIcon::Ptr result;

  app = bamf_matcher_get_application_for_desktop_file(matcher_, file_path.c_str(), true);
  if (!BAMF_IS_APPLICATION(app))
    return result;

  if (g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")))
  {
    bamf_view_set_sticky(BAMF_VIEW(app), true);
    return result;
  }

  bamf_view_set_sticky(BAMF_VIEW(app), true);
  result = new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path);
  result->SetSortPriority(sort_priority_++);

  return result;
}

Definition at line 961 of file LauncherController.cpp.

{
  nux::ObjectPtr<Launcher> result;
  int best = std::min<int> (launchers.size() - 1, MonitorWithMouse());
  if (best >= 0)
    result = launchers[best];
  return result;
}

Here is the call graph for this function:

void unity::launcher::Controller::Impl::EnsureLaunchers ( int  primary,
std::vector< nux::Geometry > const &  monitors 
)

Definition at line 311 of file LauncherController.cpp.

{
  unsigned int num_monitors = monitors.size();
  unsigned int num_launchers = parent_->multiple_launchers ? num_monitors : 1;
  unsigned int launchers_size = launchers.size();
  unsigned int last_monitor = 0;

  if (num_launchers == 1)
  {
    if (launchers_size == 0)
    {
      launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher(primary)));
    }
    else if (!launchers[0].IsValid())
    {
      launchers[0] = nux::ObjectPtr<Launcher>(CreateLauncher(primary));
    }

    launchers[0]->monitor(primary);
    launchers[0]->Resize();
    last_monitor = 1;
  }
  else
  {
    for (unsigned int i = 0; i < num_monitors; i++, last_monitor++)
    {
      if (i >= launchers_size)
      {
        launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher(i)));
      }

      launchers[i]->monitor(i);
      launchers[i]->Resize();
    }
  }

  for (unsigned int i = last_monitor; i < launchers_size; ++i)
  {
    auto launcher = launchers[i];
    if (launcher.IsValid())
    {
      parent_->RemoveChild(launcher.GetPointer());
      launcher->GetParent()->UnReference();
      edge_barriers_->Unsubscribe(launcher.GetPointer(), launcher->monitor);
    }
  }

  launchers.resize(num_launchers);

  for (size_t i = 0; i < launchers.size(); ++i)
  {
    edge_barriers_->Subscribe(launchers[i].GetPointer(), launchers[i]->monitor);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 715 of file LauncherController.cpp.

Here is the caller graph for this function:

Definition at line 690 of file LauncherController.cpp.

{
  expo_icon_ = AbstractLauncherIcon::Ptr(new SimpleLauncherIcon());

  SimpleLauncherIcon* icon = static_cast<SimpleLauncherIcon*>(expo_icon_.GetPointer());
  icon->tooltip_text = _("Workspace Switcher");
  icon->icon_name = "workspace-switcher";
  icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
  icon->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false);
  icon->SetIconType(AbstractLauncherIcon::TYPE_EXPO);
  icon->SetShortcut('s');

  on_expoicon_activate_connection_ = icon->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated));


  RegisterIcon(expo_icon_);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 670 of file LauncherController.cpp.

{
  AbstractLauncherIcon::Ptr icon(new TrashLauncherIcon());
  RegisterIcon(icon);
}

Here is the caller graph for this function:

Definition at line 955 of file LauncherController.cpp.

{
  UScreen* uscreen = UScreen::GetDefault();
  return uscreen->GetMonitorWithMouse();
}

Here is the call graph for this function:

void unity::launcher::Controller::Impl::OnBusAcquired ( GDBusConnection *  connection,
const gchar *  name,
gpointer  user_data 
) [static]

Definition at line 1324 of file LauncherController.cpp.

{
  GDBusNodeInfo* introspection_data = g_dbus_node_info_new_for_xml(DBUS_INTROSPECTION.c_str(), nullptr);
  unsigned int reg_id;

  if (!introspection_data)
  {
    LOG_WARNING(logger) << "No introspection data loaded. Won't get dynamic launcher addition.";
    return;
  }

  reg_id = g_dbus_connection_register_object(connection, DBUS_PATH.c_str(),
                                             introspection_data->interfaces[0],
                                             &interface_vtable, user_data,
                                             nullptr, nullptr);
  if (!reg_id)
  {
    LOG_WARNING(logger) << "Object registration failed. Won't get dynamic launcher addition.";
  }

  g_dbus_node_info_unref(introspection_data);
}

Here is the caller graph for this function:

void unity::launcher::Controller::Impl::OnDBusMethodCall ( GDBusConnection *  connection,
const gchar *  sender,
const gchar *  object_path,
const gchar *  interface_name,
const gchar *  method_name,
GVariant *  parameters,
GDBusMethodInvocation *  invocation,
gpointer  user_data 
) [static]

Definition at line 1347 of file LauncherController.cpp.

{
  if (g_strcmp0(method_name, "AddLauncherItemFromPosition") == 0)
  {
    auto self = static_cast<Controller::Impl*>(user_data);
    glib::String icon, icon_title, desktop_file, aptdaemon_task;
    gint icon_x, icon_y, icon_size;

    g_variant_get(parameters, "(ssiiiss)", &icon_title, &icon, &icon_x, &icon_y,
                                           &icon_size, &desktop_file, &aptdaemon_task);

    self->OnLauncherAddRequestSpecial(desktop_file.Str(), aptdaemon_task.Str(),
                                      icon.Str(), icon_x, icon_y, icon_size);

    g_dbus_method_invocation_return_value(invocation, nullptr);
  }
}

Here is the call graph for this function:

Definition at line 665 of file LauncherController.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::launcher::Controller::Impl::OnFavoriteStoreFavoriteAdded ( std::string const &  entry,
std::string const &  pos,
bool  before 
)

Definition at line 585 of file LauncherController.cpp.

{
  auto bamf_list = model_->GetSublist<BamfLauncherIcon>();
  AbstractLauncherIcon::Ptr other;
  if (bamf_list.size() > 0)
    other = *(bamf_list.begin());

  if (!pos.empty())
  {
    for (auto it : bamf_list)
    {
      if (it->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) && pos == it->DesktopFile())
        other = it;
    }
  }

  for (auto it : bamf_list)
  {
    if (entry == it->DesktopFile())
    {
      it->Stick(false);
      if (!before)
        model_->ReorderAfter(it, other);
      else
        model_->ReorderBefore(it, other, false);
      return;
    }
  }

  AbstractLauncherIcon::Ptr result = CreateFavorite(entry.c_str());
  if (result)
  {
    RegisterIcon(result);
    if (!before)
      model_->ReorderAfter(result, other);
    else
      model_->ReorderBefore(result, other, false);
  }

  SortAndUpdate();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 627 of file LauncherController.cpp.

{
  for (auto it : model_->GetSublist<BamfLauncherIcon> ())
  {
    if (it->DesktopFile() == entry)
    {
      OnLauncherRemoveRequest(it);
      break;
     }
  }
}

Here is the caller graph for this function:

Definition at line 639 of file LauncherController.cpp.

{
  FavoriteList const& favs = FavoriteStore::Instance().GetFavorites();
  auto bamf_list = model_->GetSublist<BamfLauncherIcon>();

  int i = 0;
  for (auto it : favs)
  {
    auto icon = std::find_if(bamf_list.begin(), bamf_list.end(),
    [&it](AbstractLauncherIcon::Ptr x) { return (x->DesktopFile() == it); });

    if (icon != bamf_list.end())
    {
      (*icon)->SetSortPriority(i++);
    }
  }

  for (auto it : bamf_list)
  {
    if (!it->IsSticky())
      it->SetSortPriority(i++);
  }

  model_->Sort();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 523 of file LauncherController.cpp.

{
  this->RegisterIcon(icon);
}

Here is the caller graph for this function:

Definition at line 528 of file LauncherController.cpp.

Here is the caller graph for this function:

Definition at line 423 of file LauncherController.cpp.

{
  for (auto it : model_->GetSublist<BamfLauncherIcon> ())
  {
    if (path && path == it->DesktopFile())
    {
      it->Stick();
      model_->ReorderBefore(it, before, false);
      Save();
      return;
    }
  }

  AbstractLauncherIcon::Ptr result = CreateFavorite(path);
  if (result)
  {
    RegisterIcon(result);
    if (before)
      model_->ReorderBefore(result, before, false);
  }

  Save();
}

Here is the caller graph for this function:

void unity::launcher::Controller::Impl::OnLauncherAddRequestSpecial ( std::string const &  path,
std::string const &  aptdaemon_trans_id,
std::string const &  icon_path,
int  icon_x,
int  icon_y,
int  icon_size 
)

Definition at line 468 of file LauncherController.cpp.

{
  auto bamf_icons = model_->GetSublist<BamfLauncherIcon>();
  for (auto icon : bamf_icons)
  {
    if (icon->DesktopFile() == path)
      return;
  }

  SoftwareCenterLauncherIcon::Ptr result = CreateSCLauncherIcon(path, aptdaemon_trans_id, icon_path);

  CurrentLauncher()->ForceReveal(true);

  if (result)
  {
    result->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false);
    result->Animate(CurrentLauncher(), icon_x, icon_y, icon_size);
    RegisterIcon(result);
    Save();
  }
}

Definition at line 563 of file LauncherController.cpp.

{
  for (auto icon : *model_)
  {
    if (!icon || icon->RemoteUri().empty())
      continue;

    if (entry->AppUri() == icon->RemoteUri())
    {
      icon->InsertEntryRemote(entry);
    }
  }
}

Here is the caller graph for this function:

Definition at line 577 of file LauncherController.cpp.

{
  for (auto icon : *model_)
  {
    icon->RemoveEntryRemote(entry);
  }
}

Here is the caller graph for this function:

Definition at line 533 of file LauncherController.cpp.

{
  switch (icon->GetIconType())
  {
    case AbstractLauncherIcon::TYPE_APPLICATION:
    {
      BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon.GetPointer());

      if (bamf_icon)
      {
        bamf_icon->UnStick();
        bamf_icon->Quit();
      }

      break;
    }
    case AbstractLauncherIcon::TYPE_DEVICE:
    {
      DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon.GetPointer());

      if (device_icon && device_icon->CanEject())
        device_icon->Eject();

      break;
    }
    default:
      break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 495 of file LauncherController.cpp.

{
  icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
  launcher_->ForceReveal(false);
}

Here is the caller graph for this function:

void unity::launcher::Controller::Impl::OnScreenChanged ( int  primary_monitor,
std::vector< nux::Geometry > &  monitors 
)

Definition at line 366 of file LauncherController.cpp.

{
  EnsureLaunchers(primary_monitor, monitors);
}

Here is the caller graph for this function:

void unity::launcher::Controller::Impl::OnViewOpened ( BamfMatcher *  matcher,
BamfView *  view 
)

Definition at line 740 of file LauncherController.cpp.

{
  if (!BAMF_IS_APPLICATION(view))
    return;

  BamfApplication* app = BAMF_APPLICATION(view);

  if (bamf_view_is_sticky(view) ||
      g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")))
  {
    return;
  }

  AbstractLauncherIcon::Ptr icon(new BamfLauncherIcon(app));
  icon->visibility_changed.connect(sigc::mem_fun(this, &Impl::SortAndUpdate));
  icon->SetSortPriority(sort_priority_++);
  RegisterIcon(icon);
  SortAndUpdate();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 371 of file LauncherController.cpp.

{
  static bool keynav_first_focus = false;

  if (parent_->IsOverlayOpen())
    keynav_first_focus = false;

  if (keynav_first_focus)
  {
    keynav_first_focus = false;
    keynav_restore_window_ = false;
    parent_->KeyNavTerminate(false);
  }
  else if (launcher_keynav)
  {
    keynav_first_focus = true;
  }
}

Here is the caller graph for this function:

void unity::launcher::Controller::Impl::ReceiveLauncherKeyPress ( unsigned long  eventType,
unsigned long  keysym,
unsigned long  state,
const char *  character,
unsigned short  keyCount 
)

Definition at line 1249 of file LauncherController.cpp.

{
  /*
   * all key events below are related to keynavigation. Make an additional
   * check that we are in a keynav mode when we inadvertadly receive the focus
   */
  if (!launcher_grabbed)
    return;

  switch (keysym)
  {
      // up (move selection up or go to global-menu if at top-most icon)
    case NUX_VK_UP:
    case NUX_KP_UP:
      parent_->KeyNavPrevious();
      break;

      // down (move selection down and unfold launcher if needed)
    case NUX_VK_DOWN:
    case NUX_KP_DOWN:
      parent_->KeyNavNext();
      break;

      // super/control/esc/left (close quicklist or exit laucher key-focus)
    case NUX_VK_LWIN:
    case NUX_VK_RWIN:
    case NUX_VK_CONTROL:
    case NUX_VK_LEFT:
    case NUX_KP_LEFT:
    case NUX_VK_ESCAPE:
      // hide again
      parent_->KeyNavTerminate(false);
      break;

      // right/shift-f10 (open quicklist of currently selected icon)
    case XK_F10:
      if (!(state & nux::NUX_STATE_SHIFT))
        break;
    case NUX_VK_RIGHT:
    case NUX_KP_RIGHT:
    case XK_Menu:
      if (model_->Selection()->OpenQuicklist(true, keyboard_launcher_->monitor()))
      {
        reactivate_keynav = true;
        reactivate_index = model_->SelectionIndex();
        parent_->KeyNavTerminate(false);
      }
      break;

      // <SPACE> (open a new instance)
    case NUX_VK_SPACE:
      model_->Selection()->OpenInstance(ActionArg(ActionArg::LAUNCHER, 0));
      parent_->KeyNavTerminate(false);
      break;

      // <RETURN> (start/activate currently selected icon)
    case NUX_VK_ENTER:
    case NUX_KP_ENTER:
    parent_->KeyNavTerminate(true);
    break;

    default:
      // ALT + <Anykey>; treat it as a shortcut and exit keynav
      if (state & nux::NUX_STATE_ALT)
      {
        parent_->KeyNavTerminate(false);
      }
      break;
  }
}

Here is the caller graph for this function:

void unity::launcher::Controller::Impl::ReceiveMouseDownOutsideArea ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
)

Definition at line 1095 of file LauncherController.cpp.

Here is the caller graph for this function:

Definition at line 725 of file LauncherController.cpp.

{
  model_->AddIcon(icon);
  std::string const& path = icon->DesktopFile();

  if (!path.empty())
  {
    LauncherEntryRemote::Ptr const& entry = remote_model_.LookupByDesktopFile(path);

    if (entry)
      icon->InsertEntryRemote(entry);
  }
}

Here is the caller graph for this function:

Definition at line 720 of file LauncherController.cpp.

{
  model_->RemoveIcon(desktop_icon_);
}

Definition at line 708 of file LauncherController.cpp.

Definition at line 447 of file LauncherController.cpp.

{
  unity::FavoriteList desktop_paths;

  // Updates gsettings favorites.
  auto launchers = model_->GetSublist<BamfLauncherIcon> ();
  for (auto icon : launchers)
  {
    if (!icon->IsSticky())
      continue;

    std::string const& desktop_file = icon->DesktopFile();

    if (!desktop_file.empty())
      desktop_paths.push_back(desktop_file);
  }

  unity::FavoriteStore::Instance().SetFavorites(desktop_paths);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 853 of file LauncherController.cpp.

{
  ubus.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST, g_variant_new("(sus)", "home.lens", dash::NOT_HANDLED, ""));
}

Definition at line 807 of file LauncherController.cpp.

{
  GList* apps, *l;
  BamfApplication* app;

  // Sufficiently large number such that we ensure proper sorting
  // (avoids case where first item gets tacked onto end rather than start)
  int priority = 100;

  FavoriteList const& favs = FavoriteStore::Instance().GetFavorites();

  for (FavoriteList::const_iterator i = favs.begin(), end = favs.end();
       i != end; ++i)
  {
    AbstractLauncherIcon::Ptr fav = CreateFavorite(i->c_str());

    if (fav)
    {
      fav->SetSortPriority(priority);
      RegisterIcon(fav);
      priority++;
    }
  }

  apps = bamf_matcher_get_applications(matcher_);
  view_opened_signal_.Connect(matcher_, "view-opened", sigc::mem_fun(this, &Impl::OnViewOpened));

  for (l = apps; l; l = l->next)
  {
    app = BAMF_APPLICATION(l->data);

    if (g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")))
      continue;

    AbstractLauncherIcon::Ptr icon(new BamfLauncherIcon(app));
    icon->SetSortPriority(sort_priority_++);
    RegisterIcon(icon);
  }
  g_list_free(apps);
  SortAndUpdate();

  model_->order_changed.connect(sigc::mem_fun(this, &Impl::SortAndUpdate));
  model_->icon_removed.connect(sigc::mem_fun(this, &Impl::OnIconRemoved));
  model_->saved.connect(sigc::mem_fun(this, &Impl::Save));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 501 of file LauncherController.cpp.

{
  gint   shortcut = 1;

  auto launchers = model_->GetSublist<BamfLauncherIcon> ();
  for (auto icon : launchers)
  {
    if (shortcut <= 10 && icon->IsVisible())
    {
      std::stringstream shortcut_string;
      shortcut_string << (shortcut % 10);
      icon->SetShortcut(shortcut_string.str()[0]);
      ++shortcut;
    }
    // reset shortcut
    else
    {
      icon->SetShortcut(0);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 676 of file LauncherController.cpp.

{
  if ((num_workspaces_ == 0) && (workspaces > 0))
  {
    InsertExpoAction();
  }
  else if ((num_workspaces_ > 0) && (workspaces == 0))
  {
    RemoveExpoAction();
  }

  num_workspaces_ = workspaces;
}

Member Data Documentation

Definition at line 193 of file LauncherController.cpp.

Definition at line 181 of file LauncherController.cpp.

Definition at line 178 of file LauncherController.cpp.

Definition at line 184 of file LauncherController.cpp.

Definition at line 195 of file LauncherController.cpp.

Definition at line 180 of file LauncherController.cpp.

Initial value:

Definition at line 171 of file LauncherController.cpp.

Definition at line 176 of file LauncherController.cpp.

Definition at line 191 of file LauncherController.cpp.

Definition at line 175 of file LauncherController.cpp.

Definition at line 206 of file LauncherController.cpp.

Definition at line 188 of file LauncherController.cpp.

Definition at line 205 of file LauncherController.cpp.

Definition at line 192 of file LauncherController.cpp.

Definition at line 187 of file LauncherController.cpp.

Definition at line 186 of file LauncherController.cpp.

Definition at line 197 of file LauncherController.cpp.

Definition at line 199 of file LauncherController.cpp.

Definition at line 174 of file LauncherController.cpp.

Definition at line 182 of file LauncherController.cpp.

Definition at line 204 of file LauncherController.cpp.

Definition at line 173 of file LauncherController.cpp.

Definition at line 190 of file LauncherController.cpp.

Definition at line 189 of file LauncherController.cpp.

Definition at line 179 of file LauncherController.cpp.

Definition at line 183 of file LauncherController.cpp.

Definition at line 177 of file LauncherController.cpp.

Definition at line 201 of file LauncherController.cpp.

Definition at line 202 of file LauncherController.cpp.

Definition at line 200 of file LauncherController.cpp.


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