diff options
Diffstat (limited to 'plugins/unityshell/src')
| -rw-r--r-- | plugins/unityshell/src/UnityShowdesktopHandler.cpp | 7 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 63 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 6 |
3 files changed, 53 insertions, 23 deletions
diff --git a/plugins/unityshell/src/UnityShowdesktopHandler.cpp b/plugins/unityshell/src/UnityShowdesktopHandler.cpp index 1f5bc2038..5ef286cac 100644 --- a/plugins/unityshell/src/UnityShowdesktopHandler.cpp +++ b/plugins/unityshell/src/UnityShowdesktopHandler.cpp @@ -21,6 +21,7 @@ #include <glib.h> #include "UnityShowdesktopHandler.h" +#include "unity-shared/UnitySettings.h" namespace unity { @@ -99,7 +100,7 @@ void ShowdesktopHandler::FadeOut() return; state_ = ShowdesktopHandler::StateFadeOut; - progress_ = 0.0f; + progress_ = Settings::Instance().low_gfx() ? 1.0f : 0.0f; was_hidden_ = showdesktop_handler_window_interface_->Hidden(); @@ -143,7 +144,7 @@ ShowdesktopHandlerWindowInterface::PostPaintAction ShowdesktopHandler::Animate ( if (state_ == ShowdesktopHandler::StateFadeOut) { - progress_ += inc; + progress_ = Settings::Instance().low_gfx() ? 1.0f : progress_ + inc; if (progress_ >= 1.0f) { progress_ = 1.0f; @@ -152,7 +153,7 @@ ShowdesktopHandlerWindowInterface::PostPaintAction ShowdesktopHandler::Animate ( } else if (state_ == StateFadeIn) { - progress_ -= inc; + progress_ = Settings::Instance().low_gfx() ? 0.0f : progress_ - inc; if (progress_ <= 0.0f) { progress_ = 0.0f; diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 207b7a11b..7a18dc471 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -221,6 +221,7 @@ UnityScreen::UnityScreen(CompScreen* screen) , key_nav_mode_requested_(false) , big_tick_(0) , back_buffer_age_(0) + , next_active_window_(0) { Timer timer; #ifndef USE_GLES @@ -300,12 +301,12 @@ UnityScreen::UnityScreen(CompScreen* screen) (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1) || optionGetLowGraphicsMode()) { - unity_settings_.SetLowGfxMode(true); + unity_settings_.low_gfx = true; } if (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 0) { - unity_settings_.SetLowGfxMode(false); + unity_settings_.low_gfx = false; } #endif @@ -445,6 +446,7 @@ UnityScreen::UnityScreen(CompScreen* screen) auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::InitPluginActions); sources_.Add(std::make_shared<glib::Idle>(init_plugins_cb, glib::Source::Priority::DEFAULT)); + Settings::Instance().gestures_changed.connect(sigc::mem_fun(this, &UnityScreen::UpdateGesturesSupport)); InitGesturesSupport(); LoadPanelShadowTexture(); @@ -1214,6 +1216,8 @@ void UnityWindow::leaveShowDesktop () void UnityWindow::activate () { + uScreen->SetNextActiveWindow(window->id()); + ShowdesktopHandler::InhibitLeaveShowdesktopMode (window->id ()); window->activate (); ShowdesktopHandler::AllowLeaveShowdesktopMode (window->id ()); @@ -2483,7 +2487,7 @@ bool UnityScreen::altTabNextWindowInitiate(CompAction* action, CompAction::State } else { - switcher_controller_->detail = true; + switcher_controller_->SetDetail(true); } action->setState(action->state() | CompAction::StateTermKey); @@ -2982,7 +2986,7 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, uScreen->windows_for_monitor_[monitor] = 1; if (!(mask & nonOcclusionBits) && - (window->state() & CompWindowStateFullscreenMask && !window->minimized()) && + (window->state() & CompWindowStateFullscreenMask && !window->minimized() && !window->inShowDesktopMode()) && uScreen->windows_for_monitor_[monitor] == 1) // And I've been advised to test other things, but they don't work: // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw @@ -3185,6 +3189,9 @@ bool UnityWindow::glDraw(const GLMatrix& matrix, bool UnityWindow::damageRect(bool initial, CompRect const& rect) { + if (uScreen->lockscreen_controller_->IsLocked() && !CanBypassLockScreen()) + return true; + if (initial) deco_win_->Update(); @@ -3723,7 +3730,7 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) else BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental(); - unity::Settings::Instance().SetLowGfxMode(optionGetLowGraphicsMode()); + unity::Settings::Instance().low_gfx = optionGetLowGraphicsMode(); break; case UnityshellOptions::DecayRate: launcher_options->edge_decay_rate = optionGetDecayRate() * 100; @@ -4077,24 +4084,24 @@ void UnityScreen::InitUnityComponents() ShowFirstRunHints(); // Setup Session Controller - auto manager = std::make_shared<session::GnomeManager>(); - manager->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); - manager->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); - manager->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked)); - manager->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked)); - session_dbus_manager_ = std::make_shared<session::DBusManager>(manager); - session_controller_ = std::make_shared<session::Controller>(manager); + auto session = std::make_shared<session::GnomeManager>(); + session->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); + session->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); + session->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked)); + session->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked)); + session_dbus_manager_ = std::make_shared<session::DBusManager>(session); + session_controller_ = std::make_shared<session::Controller>(session); LOG_INFO(logger) << "InitUnityComponents-Session " << timer.ElapsedSeconds() << "s"; Introspectable::AddChild(session_controller_.get()); // Setup Lockscreen Controller - screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(manager); - lockscreen_controller_ = std::make_shared<lockscreen::Controller>(screensaver_dbus_manager_, manager); + screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(session); + lockscreen_controller_ = std::make_shared<lockscreen::Controller>(screensaver_dbus_manager_, session, menus_->KeyGrabber()); UpdateActivateIndicatorsKey(); LOG_INFO(logger) << "InitUnityComponents-Lockscreen " << timer.ElapsedSeconds() << "s"; if (g_file_test((DesktopUtilities::GetUserRuntimeDirectory()+local::LOCKED_STAMP).c_str(), G_FILE_TEST_EXISTS)) - manager->PromptLockScreen(); + session->PromptLockScreen(); auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) { /* The launcher geometry includes 1px used to draw the right/top margin @@ -4186,22 +4193,26 @@ lockscreen::Controller::Ptr UnityScreen::lockscreen_controller() return lockscreen_controller_; } +void UnityScreen::UpdateGesturesSupport() +{ + Settings::Instance().gestures_launcher_drag() ? gestures_sub_launcher_->Activate() : gestures_sub_launcher_->Deactivate(); + Settings::Instance().gestures_dash_tap() ? gestures_sub_dash_->Activate() : gestures_sub_dash_->Deactivate(); + Settings::Instance().gestures_windows_drag_pinch() ? gestures_sub_windows_->Activate() : gestures_sub_windows_->Deactivate(); +} + void UnityScreen::InitGesturesSupport() { std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker); wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker)); - gestures_sub_launcher_.reset(new nux::GesturesSubscription); gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE); gestures_sub_launcher_->SetNumTouches(4); gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW()); - gestures_sub_launcher_->Activate(); gestures_sub_dash_.reset(new nux::GesturesSubscription); gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE); gestures_sub_dash_->SetNumTouches(4); gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW()); - gestures_sub_dash_->Activate(); gestures_sub_windows_.reset(new nux::GesturesSubscription); gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE @@ -4209,7 +4220,9 @@ void UnityScreen::InitGesturesSupport() | nux::PINCH_GESTURE); gestures_sub_windows_->SetNumTouches(3); gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW()); - gestures_sub_windows_->Activate(); + + // Apply the user's settings + UpdateGesturesSupport(); } CompAction::Vector& UnityScreen::getActions() @@ -4245,6 +4258,16 @@ void UnityScreen::ShowFirstRunHints() }); } +Window UnityScreen::GetNextActiveWindow() const +{ + return next_active_window_; +} + +void UnityScreen::SetNextActiveWindow(Window next_active_window) +{ + next_active_window_ = next_active_window; +} + /* Window init */ namespace @@ -4604,7 +4627,7 @@ void UnityWindow::OnTerminateSpread() if (IsInShowdesktopMode()) { - if (!(screen->activeWindow() == window->id())) + if (uScreen->GetNextActiveWindow() != window->id()) { if (!mShowdesktopHandler) mShowdesktopHandler.reset(new ShowdesktopHandler(static_cast <ShowdesktopHandlerWindowInterface *>(this), diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 8f3d89c08..b1dfda5b0 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -282,6 +282,7 @@ private: void OnDecorationStyleChanged(); void InitGesturesSupport(); + void UpdateGesturesSupport(); void DrawPanelUnderDash(); @@ -298,6 +299,9 @@ private: void SpreadAppWindows(bool anywhere); bool queryForShader(); + Window GetNextActiveWindow() const; + void SetNextActiveWindow(Window next_active_window); + /* We store these to avoid unecessary calls to ::get */ CompScreen* screen; CompositeScreen* cScreen; @@ -413,6 +417,8 @@ private: uint64_t big_tick_; unsigned int back_buffer_age_; + Window next_active_window_; + friend class UnityWindow; friend class debug::ScreenIntrospection; friend class decoration::Manager; |
