diff options
| -rw-r--r-- | UnityCore/GLibDBusProxy.cpp | 8 | ||||
| -rw-r--r-- | lockscreen/ShutdownNotifier.cpp | 20 | ||||
| -rw-r--r-- | lockscreen/ShutdownNotifier.h | 2 | ||||
| -rw-r--r-- | lockscreen/SuspendNotifier.cpp | 18 | ||||
| -rw-r--r-- | lockscreen/SuspendNotifier.h | 2 | ||||
| -rw-r--r-- | unity-shared/PluginAdapter.cpp | 24 |
6 files changed, 34 insertions, 40 deletions
diff --git a/UnityCore/GLibDBusProxy.cpp b/UnityCore/GLibDBusProxy.cpp index 2f234b9bb..08fb489f1 100644 --- a/UnityCore/GLibDBusProxy.cpp +++ b/UnityCore/GLibDBusProxy.cpp @@ -21,7 +21,7 @@ #include "GLibDBusProxy.h" -#include <map> +#include <unordered_map> #include <memory> #include <NuxCore/Logger.h> #include <vector> @@ -49,7 +49,7 @@ class DBusProxy::Impl { public: typedef std::vector<ReplyCallback> Callbacks; - typedef std::map<string, Callbacks> SignalHandlers; + typedef std::unordered_map<string, Callbacks> SignalHandlers; Impl(DBusProxy* owner, string const& name, @@ -460,7 +460,7 @@ void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointe if (error) { - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { // silently ignore, don't even invoke callback, FIXME: really? return; @@ -488,7 +488,7 @@ void DBusProxy::Impl::OnCallWithUnixFdListCallback(GObject* source, GAsyncResult if (error) { - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { // silently ignore, don't even invoke callback, FIXME: really? return; diff --git a/lockscreen/ShutdownNotifier.cpp b/lockscreen/ShutdownNotifier.cpp index 280620bf1..796497d67 100644 --- a/lockscreen/ShutdownNotifier.cpp +++ b/lockscreen/ShutdownNotifier.cpp @@ -94,7 +94,7 @@ void ShutdownNotifier::Impl::UnregisterInterest() Uninhibit(); logind_proxy_->DisconnectSignal("PrepareForShutdown"); - cb_ = 0; + cb_ = nullptr; } void ShutdownNotifier::Impl::Inhibit() @@ -102,15 +102,15 @@ void ShutdownNotifier::Impl::Inhibit() if (IsInhibited()) return; - logind_proxy_->CallWithUnixFdList("Inhibit", - g_variant_new("(ssss)", "shutdown", "Unity Lockscreen", "Screen is locked", "delay"), - [this](GVariant* variant, glib::Error const& e){ - if (e) - { - LOG_ERROR(logger) << "Failed to inhbit suspend"; - } - delay_inhibit_fd_ = glib::Variant(variant).GetInt32(); - }); + GVariant* args = g_variant_new("(ssss)", "shutdown", "Unity Lockscreen", "Screen is locked", "delay"); + + logind_proxy_->CallWithUnixFdList("Inhibit", args, [this] (GVariant* variant, glib::Error const& e) { + if (e) + { + LOG_ERROR(logger) << "Failed to inhbit suspend"; + } + delay_inhibit_fd_ = glib::Variant(variant).GetInt32(); + }); } void ShutdownNotifier::Impl::Uninhibit() diff --git a/lockscreen/ShutdownNotifier.h b/lockscreen/ShutdownNotifier.h index 8a3eebab5..ef4c9a3ef 100644 --- a/lockscreen/ShutdownNotifier.h +++ b/lockscreen/ShutdownNotifier.h @@ -37,7 +37,7 @@ public: ShutdownNotifier(); ~ShutdownNotifier(); - bool RegisterInterest(ShutdownCallback const& cb); + bool RegisterInterest(ShutdownCallback const&); void UnregisterInterest(); private: diff --git a/lockscreen/SuspendNotifier.cpp b/lockscreen/SuspendNotifier.cpp index 355681f9c..6086ffa7f 100644 --- a/lockscreen/SuspendNotifier.cpp +++ b/lockscreen/SuspendNotifier.cpp @@ -103,15 +103,15 @@ void SuspendNotifier::Impl::Inhibit() if (IsInhibited()) return; - logind_proxy_->CallWithUnixFdList("Inhibit", - g_variant_new("(ssss)", "sleep", "Unity Lockscreen", "Unity wants to lock screen before suspending.", "delay"), - [this](GVariant* variant, glib::Error const& e){ - if (e) - { - LOG_ERROR(logger) << "Failed to inhbit suspend"; - } - delay_inhibit_fd_ = glib::Variant(variant).GetInt32(); - }); + GVariant* args = g_variant_new("(ssss)", "sleep", "Unity Lockscreen", "Unity wants to lock screen before suspending.", "delay"); + + logind_proxy_->CallWithUnixFdList("Inhibit", args, [this] (GVariant* variant, glib::Error const& e) { + if (e) + { + LOG_ERROR(logger) << "Failed to inhbit suspend"; + } + delay_inhibit_fd_ = glib::Variant(variant).GetInt32(); + }); } void SuspendNotifier::Impl::Uninhibit() diff --git a/lockscreen/SuspendNotifier.h b/lockscreen/SuspendNotifier.h index 09ebe6f38..ff655bf68 100644 --- a/lockscreen/SuspendNotifier.h +++ b/lockscreen/SuspendNotifier.h @@ -37,7 +37,7 @@ public: SuspendNotifier(); ~SuspendNotifier(); - bool RegisterInterest(SuspendCallback const& cb); + bool RegisterInterest(SuspendCallback const&); void UnregisterInterest(); private: diff --git a/unity-shared/PluginAdapter.cpp b/unity-shared/PluginAdapter.cpp index 3c7f3d4f0..ea310bb3c 100644 --- a/unity-shared/PluginAdapter.cpp +++ b/unity-shared/PluginAdapter.cpp @@ -1457,28 +1457,22 @@ void PluginAdapter::OnWindowClosed(CompWindow *w) // XXX Don't use that outside lockscreen controller! void PluginAdapter::UnmapAllNoNuxWindowsSync() { - bool one_window_is_mapped = false; for (auto const& window : m_Screen->windows()) { - if (!IsNuxWindow(window) && window->isMapped()) + if (!IsNuxWindow(window) && (window->isMapped() || window->isViewable())) { - XUnmapWindow(m_Screen->dpy(), window->id()); - 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()) + if (window->overrideRedirect()) { - one_window_is_mapped = true; + XUnmapWindow(m_Screen->dpy(), window->id()); + } + else + { + window->hide(); } } } + + XSync(m_Screen->dpy(), False); } bool PluginAdapter::IsNuxWindow(CompWindow* value) |
