diff options
| author | Andrea Azzarone <azzaronea@gmail.com> | 2014-10-10 16:56:53 +0200 |
|---|---|---|
| committer | Andrea Azzarone <azzaronea@gmail.com> | 2014-10-10 16:56:53 +0200 |
| commit | c388e20f7e050bd995338f7ecde5887704732151 (patch) | |
| tree | 0773f7f9cb0fd0401048476617eb3d2c4180f5c2 | |
| parent | dae721c2276c987833be6b49b32297c09826a687 (diff) | |
Unmap the windows on shutdown.
(bzr r3874.1.3)
| -rw-r--r-- | lockscreen/LockScreenController.cpp | 2 | ||||
| -rw-r--r-- | lockscreen/ShutdownNotifier.cpp | 5 | ||||
| -rw-r--r-- | unity-shared/PluginAdapter.cpp | 40 | ||||
| -rw-r--r-- | unity-shared/PluginAdapter.h | 4 | ||||
| -rw-r--r-- | unity-shared/StandaloneWindowManager.h | 2 | ||||
| -rw-r--r-- | unity-shared/WindowManager.h | 3 |
6 files changed, 53 insertions, 3 deletions
diff --git a/lockscreen/LockScreenController.cpp b/lockscreen/LockScreenController.cpp index abfbdbbcb..cd8eaddc9 100644 --- a/lockscreen/LockScreenController.cpp +++ b/lockscreen/LockScreenController.cpp @@ -421,7 +421,7 @@ void Controller::LockScreen() upstart_wrapper_->Emit("desktop-lock"); shutdown_notifier_->RegisterInterest([](){ - std::cout << "Shutdown!" << std::endl; + WindowManager::Default().UnmapAllNoNuxWindowsSync(); }); accelerator_controller_ = std::make_shared<AcceleratorController>(session_manager_); diff --git a/lockscreen/ShutdownNotifier.cpp b/lockscreen/ShutdownNotifier.cpp index e6a31939d..c38bf9084 100644 --- a/lockscreen/ShutdownNotifier.cpp +++ b/lockscreen/ShutdownNotifier.cpp @@ -75,9 +75,10 @@ bool ShutdownNotifier::Impl::RegisterInterest(ShutdownCallback const& cb) bool active = glib::Variant(variant).GetBool(); if (active) + { cb_(); - - UnregisterInterest(); + UnregisterInterest(); + } }); return true; diff --git a/unity-shared/PluginAdapter.cpp b/unity-shared/PluginAdapter.cpp index 140c13384..75a336f65 100644 --- a/unity-shared/PluginAdapter.cpp +++ b/unity-shared/PluginAdapter.cpp @@ -1454,6 +1454,46 @@ void PluginAdapter::OnWindowClosed(CompWindow *w) _last_focused_window = NULL; } +void PluginAdapter::UnmapAllNoNuxWindowsSync() +{ + bool one_window_is_mapped = false; + for (auto const& window : m_Screen->windows()) + { + if (!IsNuxWindow(window) && window->isMapped()) + { + window->unmap(); + one_window_is_mapped = true; + } + } + + // Wait! + while(one_window_is_mapped) + { + one_window_is_mapped = false; + for (auto const& window : m_Screen->windows()) + { + if (!IsNuxWindow(window) && window->isMapped()) + { + one_window_is_mapped = true; + } + } + } +} + +bool PluginAdapter::IsNuxWindow(CompWindow* value) +{ + std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList(); + auto id = value->id(); + + unsigned int size = xwns.size(); + for (unsigned int i = 0; i < size; ++i) + { + if (xwns[i] == id) + return true; + } + return false; +} + void PluginAdapter::AddProperties(debug::IntrospectionData& wrapper) { wrapper.add(GetScreenGeometry()) diff --git a/unity-shared/PluginAdapter.h b/unity-shared/PluginAdapter.h index e79d1010e..e132bbbac 100644 --- a/unity-shared/PluginAdapter.h +++ b/unity-shared/PluginAdapter.h @@ -193,6 +193,8 @@ public: Window GetTopWindowAbove(Window xid) const; + void UnmapAllNoNuxWindowsSync(); + protected: PluginAdapter(CompScreen* screen); void AddProperties(debug::IntrospectionData&); @@ -207,6 +209,8 @@ private: Window GetTopMostValidWindowInViewport() const; bool IsCurrentViewportEmpty() const; + bool IsNuxWindow(CompWindow* value); + CompScreen* m_Screen; MultiActionList m_ExpoActionList; MultiActionList m_ScaleActionList; diff --git a/unity-shared/StandaloneWindowManager.h b/unity-shared/StandaloneWindowManager.h index 4a75bd425..07eaeb2d5 100644 --- a/unity-shared/StandaloneWindowManager.h +++ b/unity-shared/StandaloneWindowManager.h @@ -163,6 +163,8 @@ public: virtual std::string GetStringProperty(Window window_id, Atom) const; virtual std::vector<long> GetCardinalProperty(Window window_id, Atom) const; + virtual void UnmapAllNoNuxWindowsSync() {}; + // Mock functions StandaloneWindow::Ptr GetWindowByXid(Window window_id) const; void AddStandaloneWindow(StandaloneWindow::Ptr const& window); diff --git a/unity-shared/WindowManager.h b/unity-shared/WindowManager.h index 38130804c..59bd31123 100644 --- a/unity-shared/WindowManager.h +++ b/unity-shared/WindowManager.h @@ -169,6 +169,9 @@ public: virtual std::string GetStringProperty(Window, Atom) const = 0; virtual std::vector<long> GetCardinalProperty(Window, Atom) const = 0; + virtual void UnmapAllNoNuxWindowsSync() = 0; + + // Nux Modifiers, Nux Keycode (= X11 KeySym) nux::Property<std::pair<unsigned, unsigned>> close_window_key; nux::Property<std::pair<unsigned, unsigned>> activate_indicators_key; |
