Introduce Toplevel::output()
This is a little helper that can be very convenient with our transition from int-based screen ids to AbstractOutput. As is, the main issue with int screen ids is that they are extremely dynamic.
This commit is contained in:
parent
77325dbb79
commit
95e5f5fc1a
8 changed files with 16 additions and 9 deletions
|
@ -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<AbstractClient*>(this)));
|
||||
return ac && (ac == this || ac->output() != output()|| ac->allMainClients().contains(const_cast<AbstractClient*>(this)));
|
||||
}
|
||||
|
||||
#define BORDER(which) \
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<X11Client *>(*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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue