diff --git a/abstract_client.cpp b/abstract_client.cpp index 00c188ba8e..59c9b84c38 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -804,7 +804,7 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint break; case Options::MouseActivateAndRaise: { replay = isActive(); // for clickraise mode - bool mustReplay = !rules()->checkAcceptFocus(info->input()); + bool mustReplay = !rules()->checkAcceptFocus(acceptsFocus()); if (mustReplay) { ToplevelList::const_iterator it = workspace()->stackingOrder().constEnd(), begin = workspace()->stackingOrder().constBegin(); @@ -824,13 +824,13 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint workspace()->requestFocus(this); workspace()->lowerClient(this); screens()->setCurrent(globalPos); - replay = replay || !rules()->checkAcceptFocus(info->input()); + replay = replay || !rules()->checkAcceptFocus(acceptsFocus()); break; case Options::MouseActivate: replay = isActive(); // for clickraise mode workspace()->takeActivity(this, Workspace::ActivityFocus); screens()->setCurrent(globalPos); - replay = replay || !rules()->checkAcceptFocus(info->input()); + replay = replay || !rules()->checkAcceptFocus(acceptsFocus()); break; case Options::MouseActivateRaiseAndPassClick: workspace()->takeActivity(this, Workspace::ActivityFocus | Workspace::ActivityRaise); diff --git a/abstract_client.h b/abstract_client.h index 1cd60cd183..2c282620e4 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -589,6 +589,12 @@ protected: 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; /** * Called from ::setActive once the active value got updated, but before the changed signal * is emitted. diff --git a/client.cpp b/client.cpp index d224eaf890..c0bc621f40 100644 --- a/client.cpp +++ b/client.cpp @@ -1815,7 +1815,12 @@ void Client::sendSyncRequest() bool Client::wantsInput() const { - return rules()->checkAcceptFocus(info->input() || info->supportsProtocol(NET::TakeFocusProtocol)); + return rules()->checkAcceptFocus(acceptsFocus() || info->supportsProtocol(NET::TakeFocusProtocol)); +} + +bool Client::acceptsFocus() const +{ + return info->input(); } void Client::setBlockingCompositing(bool block) diff --git a/client.h b/client.h index 1607396d85..b61f96a394 100644 --- a/client.h +++ b/client.h @@ -410,6 +410,7 @@ protected: bool isWaitingForMoveResizeSync() const override; void doResizeSync() override; QSize resizeIncrements() const override; + bool acceptsFocus() const override; private Q_SLOTS: void delayedSetShortcut(); diff --git a/shell_client.cpp b/shell_client.cpp index 4821a7f144..abe1688c2a 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -569,6 +569,11 @@ bool ShellClient::userCanSetNoBorder() const } bool ShellClient::wantsInput() const +{ + return rules()->checkAcceptFocus(acceptsFocus()); +} + +bool ShellClient::acceptsFocus() const { if (isInternal()) { return false; diff --git a/shell_client.h b/shell_client.h index 9eb6794505..dfb740378f 100644 --- a/shell_client.h +++ b/shell_client.h @@ -129,6 +129,7 @@ protected: } void doResizeSync() override; bool isWaitingForMoveResizeSync() const override; + bool acceptsFocus() const override; private Q_SLOTS: void clientFullScreenChanged(bool fullScreen);