diff options
| author | Brandon Schaefer <brandontschaefer@gmail.com> | 2014-01-08 13:48:18 -0800 |
|---|---|---|
| committer | Brandon Schaefer <brandontschaefer@gmail.com> | 2014-01-08 13:48:18 -0800 |
| commit | d968ae1b3d06ffd921155c45ed6d5a6d5a3f9c1d (patch) | |
| tree | 5bed7dcc1b1b4629d0de0ccdb8ea81d1d26e41a9 | |
| parent | bd089bca0432c67fc36b24324061b720a47c206e (diff) | |
* Make sure we don't open the dash/hud on a monitor if the top most window on
it is fullscreen. Fixes LP: #1267210 (bzr r3616.2.1)
| -rw-r--r-- | launcher/LauncherController.cpp | 5 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 5 | ||||
| -rw-r--r-- | unity-shared/PluginAdapter.cpp | 43 | ||||
| -rw-r--r-- | unity-shared/PluginAdapter.h | 3 | ||||
| -rw-r--r-- | unity-shared/WindowManager.h | 2 |
5 files changed, 57 insertions, 1 deletions
diff --git a/launcher/LauncherController.cpp b/launcher/LauncherController.cpp index 98be37436..b1b068892 100644 --- a/launcher/LauncherController.cpp +++ b/launcher/LauncherController.cpp @@ -1202,7 +1202,10 @@ bool Controller::AboutToShowDash(int was_tap, int when) const void Controller::HandleLauncherKeyRelease(bool was_tap, int when) { int tap_duration = when - pimpl->launcher_key_press_time_; - if (tap_duration < options()->super_tap_duration && was_tap) + WindowManager& wm = WindowManager::Default(); + + if (tap_duration < options()->super_tap_duration && was_tap && + !wm.IsTopWindowFullscreenOnMonitorWithMouse()) { LOG_DEBUG(logger) << "Quick tap, sending activation request."; pimpl->SendHomeActivationRequest(); diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 3601ffbb8..999eb0d84 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2359,6 +2359,11 @@ bool UnityScreen::ShowHud() return false; // early exit if the switcher is open } + if (PluginAdapter::Default().IsTopWindowFullscreenOnMonitorWithMouse()) + { + return false; + } + if (hud_controller_->IsVisible()) { ubus_manager_.SendMessage(UBUS_HUD_CLOSE_REQUEST); diff --git a/unity-shared/PluginAdapter.cpp b/unity-shared/PluginAdapter.cpp index 8cc2f1332..e105dcf3d 100644 --- a/unity-shared/PluginAdapter.cpp +++ b/unity-shared/PluginAdapter.cpp @@ -449,6 +449,49 @@ std::vector<Window> PluginAdapter::GetWindowsInStackingOrder() const return ret; } +bool PluginAdapter::IsTopWindowFullscreenOnMonitorWithMouse() const +{ + int monitor = unity::UScreen::GetDefault()->GetMonitorWithMouse(); + Window top_win = GetTopMostWindowInMonitor(monitor); + CompWindow* window = m_Screen->findWindow(top_win); + + if (window) + return (window->state() & CompWindowStateFullscreenMask); + + return false; +} + +Window PluginAdapter::GetTopMostWindowInMonitor(int monitor) const +{ + CompWindow* window = nullptr; + nux::Geometry const& m_geo = unity::UScreen::GetDefault()->GetMonitorGeometry(monitor); + + CompPoint screen_vp = m_Screen->vp(); + + auto const& windows = m_Screen->windows(); + for (auto it = windows.rbegin(); it != windows.rend(); ++it) + { + window = *it; + nux::Geometry const& win_geo = GetWindowGeometry(window->id()); + nux::Geometry const& intersect_geo = win_geo.Intersect(m_geo); + + if (intersect_geo.width > 0 && + intersect_geo.height > 0 && + window->defaultViewport() == screen_vp && + window->isViewable() && window->isMapped() && + !window->minimized() && !window->inShowDesktopMode() && + !(window->state() & CompWindowStateAboveMask) && + !(window->type() & CompWindowTypeSplashMask) && + !(window->type() & CompWindowTypeDockMask) && + !window->overrideRedirect()) + { + return window->id(); + } + } + + return 0; +} + bool PluginAdapter::IsWindowMaximized(Window window_id) const { CompWindow* window = m_Screen->findWindow(window_id); diff --git a/unity-shared/PluginAdapter.h b/unity-shared/PluginAdapter.h index 45d4ab7e0..145749593 100644 --- a/unity-shared/PluginAdapter.h +++ b/unity-shared/PluginAdapter.h @@ -128,6 +128,8 @@ public: void Decorate(Window xid) const; void Undecorate(Window xid) const; + bool IsTopWindowFullscreenOnMonitorWithMouse() const override; + // WindowManager implementation bool IsWindowMaximized(Window window_id) const; bool IsWindowDecorated(Window window_id) const; @@ -208,6 +210,7 @@ private: void SetMwmWindowHints(Window xid, MotifWmHints* new_hints) const; unsigned long GetMwnDecorations(Window xid) const; + Window GetTopMostWindowInMonitor(int monitor) const; Window GetTopMostValidWindowInViewport() const; bool IsCurrentViewportEmpty() const; diff --git a/unity-shared/WindowManager.h b/unity-shared/WindowManager.h index 3c24b8fae..b80ad854e 100644 --- a/unity-shared/WindowManager.h +++ b/unity-shared/WindowManager.h @@ -76,6 +76,8 @@ public: virtual Window GetActiveWindow() const = 0; virtual std::vector<Window> GetWindowsInStackingOrder() const = 0; + virtual bool IsTopWindowFullscreenOnMonitorWithMouse() const = 0; + virtual bool IsWindowMaximized(Window window_id) const = 0; virtual bool IsWindowDecorated(Window window_id) const = 0; virtual bool IsWindowOnCurrentDesktop(Window window_id) const = 0; |
