Don't perform MouseActivateRaiseAndPassClick for topmost windows

Do nothing if the active window is already most recently raised one.
This commit is contained in:
Vlad Zahorodnii 2020-07-15 12:14:50 +03:00
parent 6f640ece79
commit cae9828471
4 changed files with 8 additions and 8 deletions

View file

@ -383,6 +383,12 @@ void AbstractClient::autoRaise()
cancelAutoRaise();
}
bool AbstractClient::isMostRecentlyRaised() const
{
// The last toplevel in the unconstrained stacking order is the most recently raised one.
return workspace()->topClientOnDesktop(VirtualDesktopManager::self()->current(), -1, true, false) == this;
}
bool AbstractClient::wantsTabFocus() const
{
return (isNormalWindow() || isDialog()) && wantsInput();
@ -1634,7 +1640,7 @@ Options::MouseCommand AbstractClient::getMouseCommand(Qt::MouseButton button, bo
return Options::MouseNothing;
}
if (isActive()) {
if (options->isClickRaise()) {
if (options->isClickRaise() && !isMostRecentlyRaised()) {
*handled = true;
return Options::MouseActivateRaiseAndPassClick;
}

View file

@ -926,6 +926,7 @@ protected:
void setIcon(const QIcon &icon);
void startAutoRaise();
void autoRaise();
bool isMostRecentlyRaised() const;
/**
* Whether the window accepts focus.
* The difference to wantsInput is that the implementation should not check rules and return

View file

@ -853,12 +853,6 @@ void X11Client::grabButton(Qt::KeyboardModifier modifier, uint8_t button)
#undef XNumL
#undef XScrL
bool X11Client::isMostRecentlyRaised() const
{
// The last toplevel in the unconstrained stacking order is the most recently raised one.
return workspace()->topClientOnDesktop(VirtualDesktopManager::self()->current(), -1, true, false) == this;
}
void X11Client::updateMouseGrab()
{
xcb_ungrab_button(connection(), XCB_BUTTON_INDEX_ANY, m_wrapper, XCB_MOD_MASK_ANY);

View file

@ -396,7 +396,6 @@ Q_SIGNALS:
private:
void exportMappingState(int s); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1
bool isManaged() const; ///< Returns false if this client is not yet managed
bool isMostRecentlyRaised() const;
void updateAllowedActions(bool force = false);
QRect fullscreenMonitorsArea(NETFullscreenMonitors topology) const;
void changeMaximize(bool horizontal, bool vertical, bool adjust) override;