summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2014-04-25 05:17:02 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2014-04-25 05:17:02 +0200
commitcd6798665b35b069065398b59978d5839ac21276 (patch)
tree11898f5e7f1e4dd3d0129103c30df5989c099300
parent5820920f6ab3bf2c5d96d8e1f7bf93abf4609bea (diff)
UnityScreen: if the screen is grabbed when showing the Hud, wait for ungrab for a couple of seconds
(bzr r3788.3.4)
-rw-r--r--plugins/unityshell/src/unityshell.cpp34
-rw-r--r--plugins/unityshell/src/unityshell.h1
2 files changed, 25 insertions, 10 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 97561b6cf..4a58c928f 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -143,6 +143,7 @@ const int FRAMES_TO_REDRAW_ON_RESUME = 10;
const RawPixel SCALE_PADDING = 40_em;
const RawPixel SCALE_SPACING = 20_em;
const std::string RELAYOUT_TIMEOUT = "relayout-timeout";
+const std::string HUD_UNGRAB_WAIT = "hud-ungrab-wait";
const std::string FIRST_RUN_STAMP = "first_run.stamp";
const std::string LOCKED_STAMP = "locked.stamp";
} // namespace local
@@ -2498,25 +2499,37 @@ bool UnityScreen::ShowHud()
{
if (switcher_controller_->Visible())
{
- LOG_ERROR(logger) << "this should never happen";
+ LOG_ERROR(logger) << "Switcher is visible when showing HUD: this should never happen";
return false; // early exit if the switcher is open
}
- auto& wm = WindowManager::Default();
-
- if (wm.IsTopWindowFullscreenOnMonitorWithMouse() ||
- lockscreen_controller_->IsLocked() ||
- wm.IsScreenGrabbed())
- {
- return false;
- }
-
if (hud_controller_->IsVisible())
{
hud_controller_->HideHud();
}
else
{
+ auto& wm = WindowManager::Default();
+
+ if (wm.IsTopWindowFullscreenOnMonitorWithMouse() ||
+ lockscreen_controller_->IsLocked())
+ {
+ return false;
+ }
+
+ if (wm.IsScreenGrabbed())
+ {
+ hud_ungrab_slot_ = wm.screen_ungrabbed.connect([this] { ShowHud(); });
+
+ // Let's wait ungrab event for maximum a couple of seconds...
+ sources_.AddTimeoutSeconds(2, [this] {
+ hud_ungrab_slot_->disconnect();
+ return false;
+ }, local::HUD_UNGRAB_WAIT);
+
+ return false;
+ }
+
// Handles closing KeyNav (Alt+F1) if the hud is about to show
if (launcher_controller_->KeyNavIsActive())
launcher_controller_->KeyNavTerminate(false);
@@ -2527,6 +2540,7 @@ bool UnityScreen::ShowHud()
if (QuicklistManager::Default()->Current())
QuicklistManager::Default()->Current()->Hide();
+ hud_ungrab_slot_->disconnect();
hud_controller_->ShowHud();
}
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 8ac68eb9e..1e99d00e8 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -419,6 +419,7 @@ private:
UBusManager ubus_manager_;
glib::SourceManager sources_;
+ connection::Wrapper hud_ungrab_slot_;
CompRegion buffered_compiz_damage_this_frame_;
CompRegion buffered_compiz_damage_last_frame_;