Port Workspace::clientUnderMouse() to AbstractOutput

This commit is contained in:
Vlad Zahorodnii 2021-08-28 17:52:02 +03:00 committed by Aleix Pol Gonzalez
parent e0c941109c
commit 02a9457bbc
4 changed files with 6 additions and 6 deletions

View file

@ -1748,7 +1748,7 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint
// used to be activateNextClient(this), then topClientOnDesktop // used to be activateNextClient(this), then topClientOnDesktop
// since this is a mouseOp it's however safe to use the client under the mouse instead // since this is a mouseOp it's however safe to use the client under the mouse instead
if (isActive() && options->focusPolicyIsReasonable()) { if (isActive() && options->focusPolicyIsReasonable()) {
AbstractClient *next = workspace()->clientUnderMouse(screen()); AbstractClient *next = workspace()->clientUnderMouse(output());
if (next && next != this) if (next && next != this)
workspace()->requestFocus(next, false); workspace()->requestFocus(next, false);
} }

View file

@ -411,7 +411,7 @@ void Workspace::clientHidden(AbstractClient* c)
activateNextClient(c); activateNextClient(c);
} }
AbstractClient *Workspace::clientUnderMouse(int screen) const AbstractClient *Workspace::clientUnderMouse(AbstractOutput *output) const
{ {
auto it = stackingOrder().constEnd(); auto it = stackingOrder().constEnd();
while (it != stackingOrder().constBegin()) { while (it != stackingOrder().constBegin()) {
@ -423,7 +423,7 @@ AbstractClient *Workspace::clientUnderMouse(int screen) const
// rule out clients which are not really visible. // 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 // the screen test is rather superfluous for xrandr & twinview since the geometry would differ -> TODO: might be dropped
if (!(client->isShown(false) && client->isOnCurrentDesktop() && if (!(client->isShown(false) && client->isOnCurrentDesktop() &&
client->isOnCurrentActivity() && client->isOnScreen(screen))) client->isOnCurrentActivity() && client->isOnOutput(output)))
continue; continue;
if (client->frameGeometry().contains(Cursors::self()->mouse()->pos())) { 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 get_focus = findDesktop(true, desktop); // to not break the state
if (!get_focus && options->isNextFocusPrefersMouse()) { 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())) { 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 // should rather not happen, but it cannot get the focus. rest of usability is tested above
get_focus = nullptr; get_focus = nullptr;

View file

@ -1419,7 +1419,7 @@ void Workspace::slotWindowLower()
//activateNextClient( c ); // Doesn't work when we lower a child window //activateNextClient( c ); // Doesn't work when we lower a child window
if (active_client->isActive() && options->focusPolicyIsReasonable()) { if (active_client->isActive() && options->focusPolicyIsReasonable()) {
if (options->isNextFocusPrefersMouse()) { if (options->isNextFocusPrefersMouse()) {
AbstractClient *next = clientUnderMouse(active_client->screen()); AbstractClient *next = clientUnderMouse(active_client->output());
if (next && next != active_client) if (next && next != active_client)
requestFocus(next, false); requestFocus(next, false);
} else { } else {

View file

@ -163,7 +163,7 @@ public:
*/ */
AbstractClient* mostRecentlyActivatedClient() const; AbstractClient* mostRecentlyActivatedClient() const;
AbstractClient* clientUnderMouse(int screen) const; AbstractClient *clientUnderMouse(AbstractOutput *output) const;
void activateClient(AbstractClient*, bool force = false); void activateClient(AbstractClient*, bool force = false);
bool requestFocus(AbstractClient* c, bool force = false); bool requestFocus(AbstractClient* c, bool force = false);