~3v1n0/unity/alt+tab-scroll-wheel

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/unityshell.cpp

  • Committer: Marco Trevisan (Treviño)
  • Date: 2012-02-29 01:33:51 UTC
  • mfrom: (2021.2.15 unity)
  • Revision ID: mail@3v1n0.net-20120229013351-yxai8hauzd939vyl
Merging with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
292
292
     optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
293
293
     optionSetAltTabBiasViewportNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
294
294
 
 
295
     optionSetAltTabForwardAllInitiate(boost::bind(&UnityScreen::altTabForwardAllInitiate, this, _1, _2, _3));
295
296
     optionSetAltTabForwardInitiate(boost::bind(&UnityScreen::altTabForwardInitiate, this, _1, _2, _3));
296
297
     optionSetAltTabForwardTerminate(boost::bind(&UnityScreen::altTabTerminateCommon, this, _1, _2, _3));
 
298
     optionSetAltTabForwardAllTerminate(boost::bind(&UnityScreen::altTabTerminateCommon, this, _1, _2, _3));
 
299
     optionSetAltTabPrevAllInitiate(boost::bind(&UnityScreen::altTabPrevAllInitiate, this, _1, _2, _3));
297
300
     optionSetAltTabPrevInitiate(boost::bind(&UnityScreen::altTabPrevInitiate, this, _1, _2, _3));
298
301
 
299
302
     optionSetAltTabDetailStartInitiate(boost::bind(&UnityScreen::altTabDetailStartInitiate, this, _1, _2, _3));
1595
1598
  return false;
1596
1599
}
1597
1600
 
1598
 
bool UnityScreen::altTabInitiateCommon(CompAction *action,
1599
 
                                      CompAction::State state,
1600
 
                                      CompOption::Vector& options)
 
1601
bool UnityScreen::altTabInitiateCommon(switcher::ShowMode show_mode)
1601
1602
{
1602
1603
  if (!grab_index_)
1603
1604
    grab_index_ = screen->pushGrab (screen->invisibleCursor(), "unity-switcher");
1617
1618
                                                 screen->outputDevs()[device].width() - 200,
1618
1619
                                                 screen->outputDevs()[device].height() - 200), device);
1619
1620
 
1620
 
  switcher::ShowMode show_mode = optionGetAltTabBiasViewport() ? switcher::ShowMode::CURRENT_VIEWPORT : switcher::ShowMode::ALL;
 
1621
  if (!optionGetAltTabBiasViewport())
 
1622
  {
 
1623
    if (show_mode == switcher::ShowMode::CURRENT_VIEWPORT)
 
1624
      show_mode = switcher::ShowMode::ALL;
 
1625
    else
 
1626
      show_mode = switcher::ShowMode::CURRENT_VIEWPORT;
 
1627
  }
1621
1628
 
1622
1629
  RaiseInputWindows();
1623
1630
 
1624
 
  int show_monitor = (show_mode == switcher::ShowMode::CURRENT_VIEWPORT) ? device : -1;
1625
 
 
1626
 
  auto results = launcher_controller_->GetAltTabIcons(show_monitor);
 
1631
  auto results = launcher_controller_->GetAltTabIcons(show_mode == switcher::ShowMode::CURRENT_VIEWPORT);
1627
1632
 
1628
1633
  if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::TYPE_BEGIN))
1629
1634
    switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results);
1661
1666
  if (switcher_controller_->Visible())
1662
1667
    switcher_controller_->Next();
1663
1668
  else
1664
 
    altTabInitiateCommon(action, state, options);
1665
 
 
1666
 
  action->setState(action->state() | CompAction::StateTermKey);
1667
 
  return false;
1668
 
}
1669
 
 
 
1669
    altTabInitiateCommon(switcher::ShowMode::CURRENT_VIEWPORT);
 
1670
 
 
1671
  action->setState(action->state() | CompAction::StateTermKey);
 
1672
  return false;
 
1673
}
 
1674
 
 
1675
bool UnityScreen::altTabForwardAllInitiate(CompAction* action,
 
1676
                                        CompAction::State state,
 
1677
                                        CompOption::Vector& options)
 
1678
{
 
1679
  if (switcher_controller_->Visible())
 
1680
    switcher_controller_->Next();
 
1681
  else
 
1682
    altTabInitiateCommon(switcher::ShowMode::ALL);
 
1683
 
 
1684
  action->setState(action->state() | CompAction::StateTermKey);
 
1685
  return false;
 
1686
}
 
1687
 
 
1688
bool UnityScreen::altTabPrevAllInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options)
 
1689
{
 
1690
  if (switcher_controller_->Visible())
 
1691
    switcher_controller_->Prev();
 
1692
 
 
1693
  return false;
 
1694
}
1670
1695
 
1671
1696
bool UnityScreen::altTabPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options)
1672
1697
{
1696
1721
{
1697
1722
  if (!switcher_controller_->Visible())
1698
1723
  {
1699
 
    altTabInitiateCommon(action, state, options);
 
1724
    altTabInitiateCommon(switcher::ShowMode::CURRENT_VIEWPORT);
1700
1725
    switcher_controller_->Select(1); // always select the current application
1701
1726
  }
1702
1727