diff --git a/src/internalwindow.cpp b/src/internalwindow.cpp index e810f32d59..c0cc43050d 100644 --- a/src/internalwindow.cpp +++ b/src/internalwindow.cpp @@ -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); } diff --git a/src/rules.cpp b/src/rules.cpp index bb87b33e02..38f271e2fa 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -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(); diff --git a/src/scene/decorationitem.cpp b/src/scene/decorationitem.cpp index 054d08be22..7474d9e45e 100644 --- a/src/scene/decorationitem.cpp +++ b/src/scene/decorationitem.cpp @@ -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, diff --git a/src/scripting/clientmodel.cpp b/src/scripting/clientmodel.cpp index f1ccf42488..3fe2fc1405 100644 --- a/src/scripting/clientmodel.cpp +++ b/src/scripting/clientmodel.cpp @@ -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 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: diff --git a/src/scripting/clientmodel.h b/src/scripting/clientmodel.h index 0c98876abb..fb826b47f7 100644 --- a/src/scripting/clientmodel.h +++ b/src/scripting/clientmodel.h @@ -26,7 +26,7 @@ class ClientModel : public QAbstractListModel public: enum Roles { ClientRole = Qt::UserRole + 1, - ScreenRole, + OutputRole, DesktopRole, ActivityRole }; diff --git a/src/waylandwindow.cpp b/src/waylandwindow.cpp index ae00d14615..4afb01054d 100644 --- a/src/waylandwindow.cpp +++ b/src/waylandwindow.cpp @@ -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); } diff --git a/src/window.cpp b/src/window.cpp index 740e73710e..f6cc1ace31 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -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(); } } diff --git a/src/window.h b/src/window.h index d3d1cb93a1..19b1f6abd9 100644 --- a/src/window.h +++ b/src/window.h @@ -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. diff --git a/src/x11window.cpp b/src/x11window.cpp index f821bede90..d9f1f81ca9 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -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); }