Commit cae98284 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Don't perform MouseActivateRaiseAndPassClick for topmost windows

Do nothing if the active window is already most recently raised one.
parent 6f640ece
......@@ -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;
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment