diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index 2e7609b121..f5b877c56f 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -2047,7 +2047,7 @@ bool AbstractClient::isActiveFullScreen() const // according to NETWM spec implementation notes suggests // "focused windows having state _NET_WM_STATE_FULLSCREEN" to be on the highest layer. // we'll also take the screen into account - return ac && (ac == this || ac->screen() != screen()|| ac->allMainClients().contains(const_cast(this))); + return ac && (ac == this || ac->output() != output()|| ac->allMainClients().contains(const_cast(this))); } #define BORDER(which) \ diff --git a/src/activation.cpp b/src/activation.cpp index a81f87d82e..cc4bc2ef79 100644 --- a/src/activation.cpp +++ b/src/activation.cpp @@ -244,7 +244,7 @@ void Workspace::setActiveClient(AbstractClient* c) // activating a client can cause a non active fullscreen window to loose the ActiveLayer status on > 1 screens if (screens()->count() > 1) { for (auto it = m_allClients.begin(); it != m_allClients.end(); ++it) { - if (*it != active_client && (*it)->layer() == ActiveLayer && (*it)->screen() == active_client->screen()) { + if (*it != active_client && (*it)->layer() == ActiveLayer && (*it)->output() == active_client->output()) { (*it)->updateLayer(); } } diff --git a/src/layers.cpp b/src/layers.cpp index 661bff9151..b83c36f71c 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -486,7 +486,7 @@ static Layer layerForClient(const X11Client *client) for (const X11Client *member : members) { if (member == client) { continue; - } else if (member->screen() != client->screen()) { + } else if (member->output() != client->output()) { continue; } if (member->layer() == ActiveLayer) { @@ -709,7 +709,7 @@ void X11Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource X11Client *c = qobject_cast(*it); if (!c || !( (*it)->isNormalWindow() && c->isShown(true) && - (*it)->isOnCurrentDesktop() && (*it)->isOnCurrentActivity() && (*it)->isOnScreen(screen()) )) + (*it)->isOnCurrentDesktop() && (*it)->isOnCurrentActivity() && (*it)->isOnOutput(output()) )) continue; // irrelevant clients if (*(it - 1) == other) diff --git a/src/scripting/v3/clientmodel.cpp b/src/scripting/v3/clientmodel.cpp index 456cfc051e..58525f1a0b 100644 --- a/src/scripting/v3/clientmodel.cpp +++ b/src/scripting/v3/clientmodel.cpp @@ -6,7 +6,7 @@ #include "clientmodel.h" #include "abstract_client.h" -#include "screens.h" +#include "abstract_output.h" #include "virtualdesktops.h" #include "workspace.h" @@ -257,7 +257,7 @@ bool ClientFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourc } if (m_screenName.has_value()) { - if (screens()->name(client->screen()) != m_screenName) { + if (client->output()->name() != m_screenName) { return false; } } diff --git a/src/toplevel.cpp b/src/toplevel.cpp index ea2e8458b3..16a88aeca8 100644 --- a/src/toplevel.cpp +++ b/src/toplevel.cpp @@ -17,6 +17,7 @@ #include "client_machine.h" #include "composite.h" #include "effects.h" +#include "platform.h" #include "screens.h" #include "shadow.h" #include "shadowitem.h" @@ -403,6 +404,11 @@ int Toplevel::screen() const return m_screen; } +AbstractOutput *Toplevel::output() const +{ + return kwinApp()->platform()->findOutput(screen()); +} + qreal Toplevel::screenScale() const { return m_screenScale; diff --git a/src/toplevel.h b/src/toplevel.h index 17ab3c776f..bf01e7bc56 100644 --- a/src/toplevel.h +++ b/src/toplevel.h @@ -345,6 +345,7 @@ public: bool isOnOutput(AbstractOutput *output) const; bool isOnActiveScreen() const; int screen() const; // the screen where the center is + AbstractOutput *output() const; /** * The scale of the screen this window is currently on * @note The buffer scale can be different. diff --git a/src/workspace.cpp b/src/workspace.cpp index 8176e6f154..6561be99d7 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -2207,7 +2207,7 @@ void Workspace::updateClientArea() } } StrutRects strutRegion = client->strutRects(); - const QRect clientsScreenRect = KWin::screens()->geometry(client->screen()); + const QRect clientsScreenRect = client->output()->geometry(); for (auto strut = strutRegion.begin(); strut != strutRegion.end(); strut++) { *strut = StrutRect((*strut).intersected(clientsScreenRect), (*strut).area()); } @@ -2344,7 +2344,7 @@ QRect Workspace::clientArea(clientAreaOption opt, const QPoint& p, int desktop) QRect Workspace::clientArea(clientAreaOption opt, const Toplevel *window) const { - return clientArea(opt, window->frameGeometry().center(), window->desktop()); + return clientArea(opt, window, window->output()); } QRect Workspace::clientArea(clientAreaOption opt, const Toplevel *window, const AbstractOutput *output) const diff --git a/src/xdgshellclient.cpp b/src/xdgshellclient.cpp index 2e2ddaaeea..a1ae060bc8 100644 --- a/src/xdgshellclient.cpp +++ b/src/xdgshellclient.cpp @@ -655,7 +655,7 @@ StrutRect XdgToplevelClient::strutRect(StrutArea area) const } const QRect windowRect = frameGeometry(); - const QRect outputRect = screens()->geometry(screen()); + const QRect outputRect = output()->geometry(); const bool left = windowRect.left() == outputRect.left(); const bool right = windowRect.right() == outputRect.right();