Introduce pure virtual, protectd AbstractClient::acceptsFocus -> bool
Replacement for calls to info->input() which is only valid for the Client sub class, but not for ShellClient. In ShellClient the implementation is swapped with wantsInput() and wantsInput() has a new implementation which properly delegates to rules() just like Client does.
This commit is contained in:
parent
a4c347fc7a
commit
5f90fa5cfd
6 changed files with 22 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
1
client.h
1
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();
|
||||
|
|
|
@ -569,6 +569,11 @@ bool ShellClient::userCanSetNoBorder() const
|
|||
}
|
||||
|
||||
bool ShellClient::wantsInput() const
|
||||
{
|
||||
return rules()->checkAcceptFocus(acceptsFocus());
|
||||
}
|
||||
|
||||
bool ShellClient::acceptsFocus() const
|
||||
{
|
||||
if (isInternal()) {
|
||||
return false;
|
||||
|
|
|
@ -129,6 +129,7 @@ protected:
|
|||
}
|
||||
void doResizeSync() override;
|
||||
bool isWaitingForMoveResizeSync() const override;
|
||||
bool acceptsFocus() const override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void clientFullScreenChanged(bool fullScreen);
|
||||
|
|
Loading…
Reference in a new issue