From c388e20f7e050bd995338f7ecde5887704732151 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Fri, 10 Oct 2014 16:56:53 +0200 Subject: Unmap the windows on shutdown. (bzr r3874.1.3) --- unity-shared/PluginAdapter.cpp | 40 ++++++++++++++++++++++++++++++++++ unity-shared/PluginAdapter.h | 4 ++++ unity-shared/StandaloneWindowManager.h | 2 ++ unity-shared/WindowManager.h | 3 +++ 4 files changed, 49 insertions(+) (limited to 'unity-shared') 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 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 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 GetCardinalProperty(Window, Atom) const = 0; + virtual void UnmapAllNoNuxWindowsSync() = 0; + + // Nux Modifiers, Nux Keycode (= X11 KeySym) nux::Property> close_window_key; nux::Property> activate_indicators_key; -- cgit v1.2.3