~unity-team/unity/trusty-1332509

« back to all changes in this revision

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

UnityScreen: toggle activation of all the unity compiz actions when locking the screen

Also, make sure that the lockscreen views are treated as "always-on-front" windows by nux
(and this applies to both visibility and events).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2027
2027
                                          CompAction::State state,
2028
2028
                                          CompOption::Vector& options)
2029
2029
{
2030
 
  if (lockscreen_controller_->IsLocked())
2031
 
    return true;
2032
 
 
2033
2030
  // to receive the Terminate event
2034
2031
  if (state & CompAction::StateInitKey)
2035
2032
    action->setState(action->state() | CompAction::StateTermKey);
2226
2223
 
2227
2224
void UnityScreen::SetUpAndShowSwitcher(switcher::ShowMode show_mode)
2228
2225
{
2229
 
  if(lockscreen_controller_->IsLocked())
2230
 
    return;
2231
 
 
2232
2226
  RaiseInputWindows();
2233
2227
 
2234
2228
  if (!optionGetAltTabBiasViewport())
2481
2475
    return false; // early exit if the switcher is open
2482
2476
  }
2483
2477
 
2484
 
  if (PluginAdapter::Default().IsTopWindowFullscreenOnMonitorWithMouse() ||
2485
 
      lockscreen_controller_->IsLocked())
 
2478
  if (PluginAdapter::Default().IsTopWindowFullscreenOnMonitorWithMouse())
2486
2479
  {
2487
2480
    return false;
2488
2481
  }
3734
3727
void UnityScreen::OnLockScreenRequested()
3735
3728
{
3736
3729
  if (switcher_controller_->Visible())
3737
 
  {
3738
3730
    switcher_controller_->Hide(false);
3739
 
  }
3740
 
  else if (launcher_controller_->IsOverlayOpen())
3741
 
  {
 
3731
 
 
3732
  if (dash_controller_->IsVisible())
3742
3733
    dash_controller_->HideDash();
 
3734
 
 
3735
  if (hud_controller_->IsVisible())
3743
3736
    hud_controller_->HideHud();
3744
 
  }
3745
3737
 
3746
3738
  launcher_controller_->ClearTooltips();
3747
3739
 
 
3740
  if (launcher_controller_->KeyNavIsActive())
 
3741
    launcher_controller_->KeyNavTerminate(false);
 
3742
 
 
3743
  if (QuicklistManager::Default()->Current())
 
3744
    QuicklistManager::Default()->Current()->Hide();
 
3745
 
3748
3746
  auto& wm = WindowManager::Default();
 
3747
 
3749
3748
  if (wm.IsScaleActive())
3750
3749
    wm.TerminateScale();
3751
3750
 
 
3751
  if (wm.IsExpoActive())
 
3752
    wm.TerminateExpo();
 
3753
 
3752
3754
  RaiseOSK();
3753
3755
}
3754
3756
 
 
3757
void UnityScreen::OnScreenLocked()
 
3758
{
 
3759
  SaveLockStamp(true);
 
3760
 
 
3761
  for (auto& option : getOptions())
 
3762
  {
 
3763
    if (option.isAction())
 
3764
    {
 
3765
      auto& value = option.value();
 
3766
 
 
3767
      if (value != mOptions[UnityshellOptions::PanelFirstMenu].value())
 
3768
        screen->removeAction(&value.action());
 
3769
    }
 
3770
  }
 
3771
 
 
3772
  for (auto& action : getActions())
 
3773
    screen->removeAction(&action);
 
3774
 
 
3775
  // We notify that super/alt have been released, to avoid to leave unity in inconsistent state
 
3776
  showLauncherKeyTerminate(&optionGetShowLauncher(), CompAction::StateTermKey, getOptions());
 
3777
  showMenuBarTerminate(&optionGetShowMenuBar(), CompAction::StateTermKey, getOptions());
 
3778
}
 
3779
 
 
3780
void UnityScreen::OnScreenUnlocked()
 
3781
{
 
3782
  SaveLockStamp(false);
 
3783
 
 
3784
  for (auto& option : getOptions())
 
3785
  {
 
3786
    if (option.isAction())
 
3787
      screen->addAction(&option.value().action());
 
3788
  }
 
3789
 
 
3790
  for (auto& action : getActions())
 
3791
    screen->addAction(&action);
 
3792
}
 
3793
 
3755
3794
void UnityScreen::SaveLockStamp(bool save)
3756
3795
{
3757
3796
  auto const& cache_dir = DesktopUtilities::GetUserRuntimeDirectory();
3845
3884
  auto manager = std::make_shared<session::GnomeManager>();
3846
3885
  manager->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
3847
3886
  manager->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
3848
 
  manager->locked.connect(sigc::bind(sigc::mem_fun(this, &UnityScreen::SaveLockStamp), true));
3849
 
  manager->unlocked.connect(sigc::bind(sigc::mem_fun(this, &UnityScreen::SaveLockStamp), false));
 
3887
  manager->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked));
 
3888
  manager->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked));
3850
3889
  session_dbus_manager_ = std::make_shared<session::DBusManager>(manager);
3851
3890
  session_controller_ = std::make_shared<session::Controller>(manager);
3852
3891
  AddChild(session_controller_.get());