diff --git a/abstract_client.cpp b/abstract_client.cpp index 1d2acb217b..15c24c83e6 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -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; } diff --git a/abstract_client.h b/abstract_client.h index cf6c3fccd2..3c5ae809d0 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -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 diff --git a/events.cpp b/events.cpp index 63502fd2ad..43332b8766 100644 --- a/events.cpp +++ b/events.cpp @@ -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); diff --git a/x11client.h b/x11client.h index 18a7cec1ba..817aa69e04 100644 --- a/x11client.h +++ b/x11client.h @@ -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;