Drop Window.screen property

Use Window.output instead.
This commit is contained in:
Vlad Zahorodnii 2023-02-08 22:17:27 +02:00
parent 37f4199b19
commit 83c38b0907
9 changed files with 17 additions and 27 deletions

View file

@ -499,7 +499,7 @@ void InternalWindow::commitGeometry(const QRectF &rect)
Q_EMIT frameGeometryChanged(this, oldFrameGeometry);
}
if (oldOutput != m_output) {
Q_EMIT screenChanged();
Q_EMIT outputChanged();
}
Q_EMIT geometryShapeChanged(this, oldFrameGeometry);
}

View file

@ -458,8 +458,9 @@ bool Rules::update(Window *c, int selection)
desktops = c->desktopIds();
}
if NOW_REMEMBER (Screen, screen) {
updated = updated || screen != c->screen();
screen = c->screen();
const int index = workspace()->outputs().indexOf(c->output());
updated = updated || screen != index;
screen = index;
}
if NOW_REMEMBER (Activity, activity) {
updated = updated || activity != c->activities();

View file

@ -134,7 +134,7 @@ DecorationItem::DecorationItem(KDecoration2::Decoration *decoration, Window *win
this, &DecorationItem::handleFrameGeometryChanged);
connect(window, &Window::windowClosed,
this, &DecorationItem::handleWindowClosed);
connect(window, &Window::screenChanged,
connect(window, &Window::outputChanged,
this, &DecorationItem::handleOutputChanged);
connect(decoration, &KDecoration2::Decoration::bordersChanged,

View file

@ -37,8 +37,8 @@ void ClientModel::setupClientConnections(Window *client)
connect(client, &Window::desktopChanged, this, [this, client]() {
markRoleChanged(client, DesktopRole);
});
connect(client, &Window::screenChanged, this, [this, client]() {
markRoleChanged(client, ScreenRole);
connect(client, &Window::outputChanged, this, [this, client]() {
markRoleChanged(client, OutputRole);
});
connect(client, &Window::activitiesChanged, this, [this, client]() {
markRoleChanged(client, ActivityRole);
@ -69,7 +69,7 @@ QHash<int, QByteArray> ClientModel::roleNames() const
return {
{Qt::DisplayRole, QByteArrayLiteral("display")},
{ClientRole, QByteArrayLiteral("client")},
{ScreenRole, QByteArrayLiteral("screen")},
{OutputRole, QByteArrayLiteral("output")},
{DesktopRole, QByteArrayLiteral("desktop")},
{ActivityRole, QByteArrayLiteral("activity")},
};
@ -86,8 +86,8 @@ QVariant ClientModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
case ClientRole:
return QVariant::fromValue(client);
case ScreenRole:
return client->screen();
case OutputRole:
return QVariant::fromValue(client->output());
case DesktopRole:
return client->desktop();
case ActivityRole:

View file

@ -26,7 +26,7 @@ class ClientModel : public QAbstractListModel
public:
enum Roles {
ClientRole = Qt::UserRole + 1,
ScreenRole,
OutputRole,
DesktopRole,
ActivityRole
};

View file

@ -326,7 +326,7 @@ void WaylandWindow::updateGeometry(const QRectF &rect)
Q_EMIT frameGeometryChanged(this, oldFrameGeometry);
}
if (oldOutput != m_output) {
Q_EMIT screenChanged();
Q_EMIT outputChanged();
}
Q_EMIT geometryShapeChanged(this, oldFrameGeometry);
}

View file

@ -400,11 +400,6 @@ void Window::setReadyForPainting()
}
}
int Window::screen() const
{
return workspace()->outputs().indexOf(m_output);
}
Output *Window::output() const
{
return m_output;
@ -414,7 +409,7 @@ void Window::setOutput(Output *output)
{
if (m_output != output) {
m_output = output;
Q_EMIT screenChanged();
Q_EMIT outputChanged();
}
}

View file

@ -122,14 +122,9 @@ class KWIN_EXPORT Window : public QObject
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
/**
* The screen where the window center is on
* The output where the window center is on
*/
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
/**
* The output (screen) where the window center is on
*/
Q_PROPERTY(KWin::Output *output READ output NOTIFY screenChanged)
Q_PROPERTY(KWin::Output *output READ output NOTIFY outputChanged)
Q_PROPERTY(QRectF rect READ rect)
Q_PROPERTY(QString resourceName READ resourceName NOTIFY windowClassChanged)
@ -635,7 +630,6 @@ public:
qreal height() const;
bool isOnOutput(Output *output) const;
bool isOnActiveOutput() const;
int screen() const;
Output *output() const;
void setOutput(Output *output);
virtual QPointF clientPos() const
@ -1465,7 +1459,7 @@ Q_SIGNALS:
* a screen being removed/added or if the Window's geometry changes.
* @since 4.11
*/
void screenChanged();
void outputChanged();
void skipCloseAnimationChanged();
/**
* Emitted whenever the window role of the window changes.

View file

@ -4234,7 +4234,7 @@ void X11Window::moveResizeInternal(const QRectF &rect, MoveResizeMode mode)
Q_EMIT frameGeometryChanged(this, oldFrameGeometry);
}
if (oldOutput != m_output) {
Q_EMIT screenChanged();
Q_EMIT outputChanged();
}
Q_EMIT geometryShapeChanged(this, oldFrameGeometry);
}