From 41be18e317155c282fa6778620903b906ada69c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 23 May 2015 09:02:11 +0200 Subject: [PATCH] Robust modal activation; ensure showing activated ...window REVIEW: 123875 BUG: 348083 --- abstract_client.h | 2 ++ activation.cpp | 10 ++++++---- client.h | 2 +- shell_client.cpp | 4 ++++ shell_client.h | 1 + 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/abstract_client.h b/abstract_client.h index 05bd4768f3..3037b97f45 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -217,6 +217,8 @@ public: virtual bool isCloseable() const = 0; // TODO: remove boolean trap virtual bool isShown(bool shaded_is_shown) const = 0; + // TODO: remove boolean trap + virtual void hideClient(bool hide) = 0; virtual bool isFullScreenable() const = 0; virtual bool isFullScreen() const = 0; // TODO: remove boolean trap diff --git a/activation.cpp b/activation.cpp index b58c3c1372..f99f4c008c 100644 --- a/activation.cpp +++ b/activation.cpp @@ -311,6 +311,9 @@ void Workspace::activateClient(AbstractClient* c, bool force) if (c->isMinimized()) c->unminimize(); + // ensure the window is really visible - could eg. be a hidden utility window, see bug #348083 + c->hideClient(false); + // TODO force should perhaps allow this only if the window already contains the mouse if (options->focusPolicyIsReasonable() || force) requestFocus(c, force); @@ -354,11 +357,10 @@ void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags) if (flags & ActivityFocus) { AbstractClient* modal = c->findModal(); if (modal != NULL && modal != c) { - if (!modal->isOnDesktop(c->desktop())) { + if (!modal->isOnDesktop(c->desktop())) modal->setDesktop(c->desktop()); - if (modal->desktop() != c->desktop()) // forced desktop - activateClient(modal); - } + if (!modal->isShown(true) && !modal->isMinimized()) // forced desktop or utility window + activateClient(modal); // activating a minimized blocked window will unminimize its modal implicitly // if the click was inside the window (i.e. handled is set), // but it has a modal, there's no need to use handled mode, because // the modal doesn't get the click anyway diff --git a/client.h b/client.h index e07c9227f0..a07bde0e2f 100644 --- a/client.h +++ b/client.h @@ -356,7 +356,7 @@ public: /// Updates visibility depending on being shaded, virtual desktop, etc. void updateVisibility(); /// Hides a client - Basically like minimize, but without effects, it's simply hidden - void hideClient(bool hide); + void hideClient(bool hide) override; bool hiddenPreview() const; ///< Window is mapped in order to get a window pixmap virtual bool setupCompositing(); diff --git a/shell_client.cpp b/shell_client.cpp index df77807d3c..194de2c92c 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -296,6 +296,10 @@ bool ShellClient::isShown(bool shaded_is_shown) const return !m_closing && !m_unmapped; } +void ShellClient::hideClient(bool hide) +{ +} + void ShellClient::maximize(MaximizeMode mode) { if (m_maximizeMode == mode) { diff --git a/shell_client.h b/shell_client.h index 5856783187..95854a03eb 100644 --- a/shell_client.h +++ b/shell_client.h @@ -72,6 +72,7 @@ public: bool isMovableAcrossScreens() const override; bool isResizable() const override; bool isShown(bool shaded_is_shown) const override; + void hideClient(bool hide) override; void maximize(MaximizeMode) override; MaximizeMode maximizeMode() const override; bool noBorder() const override;