diff --git a/abstract_client.h b/abstract_client.h --- a/abstract_client.h +++ b/abstract_client.h @@ -539,8 +539,8 @@ void setupWindowRules(bool ignore_temporary); void evaluateWindowRules(); virtual void applyWindowRules(); - virtual void takeFocus() = 0; - virtual bool wantsInput() const = 0; + virtual void takeFocus(); + virtual bool wantsInput() const; /** * Whether a dock window wants input. * @@ -909,12 +909,7 @@ void setIcon(const QIcon &icon); void startAutoRaise(); void autoRaise(); - /** - * Whether the window accepts focus. - * The difference to wantsInput is that the implementation should not check rules and return - * what the window effectively supports. - */ - virtual bool acceptsFocus() const = 0; + virtual bool acceptsFocus() const; /** * Called from setActive once the active value got updated, but before the changed signal * is emitted. diff --git a/abstract_client.cpp b/abstract_client.cpp --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -3300,4 +3300,36 @@ return false; } +/** + * Returns @c true if the window accepts focus; otherwise returns @c false. + * + * The difference to wantsInput is that the implementation should not check rules and return + * what the window effectively supports. + * + * Default implementation returns @c false. + */ +bool AbstractClient::acceptsFocus() const +{ + return false; +} + +/** + * Returns @c true if the window accepts focus; otherwise returns @c false. + * + * Default implementation returns @c false. + */ +bool AbstractClient::wantsInput() const +{ + return false; +} + +/** + * Performs the actual focusing of the window. + * + * Default implementation does nothing. + */ +void AbstractClient::takeFocus() +{ +} + } diff --git a/internal_client.h b/internal_client.h --- a/internal_client.h +++ b/internal_client.h @@ -60,7 +60,6 @@ bool isResizable() const override; bool noBorder() const override; bool userCanSetNoBorder() const override; - bool wantsInput() const override; bool isInternal() const override; bool isLockScreen() const override; bool isInputMethod() const override; @@ -76,7 +75,6 @@ bool supportsWindowRules() const override; AbstractClient *findModal(bool allow_itself = false) override; void setOnAllActivities(bool set) override; - void takeFocus() override; void setNoBorder(bool set) override; void updateDecoration(bool check_workspace_pos, bool force = false) override; void updateColorScheme() override; @@ -88,7 +86,6 @@ QWindow *internalWindow() const; protected: - bool acceptsFocus() const override; bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override; void destroyDecoration() override; void doMove(int x, int y) override; diff --git a/internal_client.cpp b/internal_client.cpp --- a/internal_client.cpp +++ b/internal_client.cpp @@ -243,11 +243,6 @@ return !m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup); } -bool InternalClient::wantsInput() const -{ - return false; -} - bool InternalClient::isInternal() const { return true; @@ -368,10 +363,6 @@ // Internal clients do not support activities. } -void InternalClient::takeFocus() -{ -} - void InternalClient::setNoBorder(bool set) { if (!userCanSetNoBorder()) { @@ -484,11 +475,6 @@ return m_internalWindow; } -bool InternalClient::acceptsFocus() const -{ - return false; -} - bool InternalClient::belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const { Q_UNUSED(checks)