From 02a9457bbc486f755caed072d99703bc8179282f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 28 Aug 2021 17:52:02 +0300 Subject: [PATCH] Port Workspace::clientUnderMouse() to AbstractOutput --- src/abstract_client.cpp | 2 +- src/activation.cpp | 6 +++--- src/useractions.cpp | 2 +- src/workspace.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index 7e404d6f11..a508f3cc39 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -1748,7 +1748,7 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint // used to be activateNextClient(this), then topClientOnDesktop // since this is a mouseOp it's however safe to use the client under the mouse instead if (isActive() && options->focusPolicyIsReasonable()) { - AbstractClient *next = workspace()->clientUnderMouse(screen()); + AbstractClient *next = workspace()->clientUnderMouse(output()); if (next && next != this) workspace()->requestFocus(next, false); } diff --git a/src/activation.cpp b/src/activation.cpp index f1d694defd..bf4c1a4248 100644 --- a/src/activation.cpp +++ b/src/activation.cpp @@ -411,7 +411,7 @@ void Workspace::clientHidden(AbstractClient* c) activateNextClient(c); } -AbstractClient *Workspace::clientUnderMouse(int screen) const +AbstractClient *Workspace::clientUnderMouse(AbstractOutput *output) const { auto it = stackingOrder().constEnd(); while (it != stackingOrder().constBegin()) { @@ -423,7 +423,7 @@ AbstractClient *Workspace::clientUnderMouse(int screen) const // rule out clients which are not really visible. // the screen test is rather superfluous for xrandr & twinview since the geometry would differ -> TODO: might be dropped if (!(client->isShown(false) && client->isOnCurrentDesktop() && - client->isOnCurrentActivity() && client->isOnScreen(screen))) + client->isOnCurrentActivity() && client->isOnOutput(output))) continue; if (client->frameGeometry().contains(Cursors::self()->mouse()->pos())) { @@ -466,7 +466,7 @@ bool Workspace::activateNextClient(AbstractClient* c) get_focus = findDesktop(true, desktop); // to not break the state if (!get_focus && options->isNextFocusPrefersMouse()) { - get_focus = clientUnderMouse(c ? c->screen() : screens()->current()); + get_focus = clientUnderMouse(c ? c->output() : screens()->currentOutput()); if (get_focus && (get_focus == c || get_focus->isDesktop())) { // should rather not happen, but it cannot get the focus. rest of usability is tested above get_focus = nullptr; diff --git a/src/useractions.cpp b/src/useractions.cpp index 30aacec8d5..fa0ee50efd 100644 --- a/src/useractions.cpp +++ b/src/useractions.cpp @@ -1419,7 +1419,7 @@ void Workspace::slotWindowLower() //activateNextClient( c ); // Doesn't work when we lower a child window if (active_client->isActive() && options->focusPolicyIsReasonable()) { if (options->isNextFocusPrefersMouse()) { - AbstractClient *next = clientUnderMouse(active_client->screen()); + AbstractClient *next = clientUnderMouse(active_client->output()); if (next && next != active_client) requestFocus(next, false); } else { diff --git a/src/workspace.h b/src/workspace.h index 9f464a5db8..c791d95ee2 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -163,7 +163,7 @@ public: */ AbstractClient* mostRecentlyActivatedClient() const; - AbstractClient* clientUnderMouse(int screen) const; + AbstractClient *clientUnderMouse(AbstractOutput *output) const; void activateClient(AbstractClient*, bool force = false); bool requestFocus(AbstractClient* c, bool force = false);