effects/{desktopgrid,overview,windowview}: Port to SceneView

This commit is contained in:
Vlad Zahorodnii 2023-02-13 15:00:54 +02:00
parent 0c0fb99919
commit 4bf06466f1
9 changed files with 21 additions and 45 deletions

View file

@ -85,14 +85,6 @@ DesktopGridEffect::~DesktopGridEffect()
{
}
QVariantMap DesktopGridEffect::initialProperties(EffectScreen *screen)
{
return QVariantMap{
{QStringLiteral("effect"), QVariant::fromValue(this)},
{QStringLiteral("targetScreen"), QVariant::fromValue(screen)},
};
}
void DesktopGridEffect::reconfigure(ReconfigureFlags)
{
DesktopGridConfig::self()->read();

View file

@ -82,9 +82,6 @@ public Q_SLOTS:
void deactivate(int timeout);
void toggle();
protected:
QVariantMap initialProperties(EffectScreen *screen) override;
Q_SIGNALS:
void gridRowsChanged();
void gridColumnsChanged();

View file

@ -18,8 +18,8 @@ import org.kde.plasma.components 3.0 as PC3
Rectangle {
id: container
required property QtObject effect
required property QtObject targetScreen
readonly property QtObject effect: KWinComponents.SceneView.effect
readonly property QtObject targetScreen: KWinComponents.SceneView.screen
property bool animationEnabled: false
property bool organized: false

View file

@ -80,14 +80,6 @@ OverviewEffect::~OverviewEffect()
{
}
QVariantMap OverviewEffect::initialProperties(EffectScreen *screen)
{
return QVariantMap{
{QStringLiteral("effect"), QVariant::fromValue(this)},
{QStringLiteral("targetScreen"), QVariant::fromValue(screen)},
};
}
void OverviewEffect::reconfigure(ReconfigureFlags)
{
OverviewConfig::self()->read();

View file

@ -69,9 +69,6 @@ public Q_SLOTS:
void quickDeactivate();
void toggle();
protected:
QVariantMap initialProperties(EffectScreen *screen) override;
private:
void realDeactivate();

View file

@ -19,8 +19,8 @@ FocusScope {
id: container
focus: true
required property QtObject effect
required property QtObject targetScreen
readonly property QtObject effect: KWinComponents.SceneView.effect
readonly property QtObject targetScreen: KWinComponents.SceneView.screen
readonly property bool lightBackground: Math.max(PlasmaCore.ColorScope.backgroundColor.r,
PlasmaCore.ColorScope.backgroundColor.g,

View file

@ -17,9 +17,8 @@ import org.kde.KWin.Effect.WindowView 1.0
Item {
id: container
required property QtObject effect
required property QtObject targetScreen
required property var selectedIds
readonly property QtObject effect: KWinComponents.SceneView.effect
readonly property QtObject targetScreen: KWinComponents.SceneView.screen
property bool animationEnabled: false
property bool organized: false
@ -176,7 +175,7 @@ Item {
case WindowView.ModeWindowClassCurrentDesktop:
return "activeClass";
default:
return selectedIds;
return container.effect.selectedIds;
}
}
layout.mode: effect.layout

View file

@ -137,15 +137,6 @@ WindowViewEffect::~WindowViewEffect()
QDBusConnection::sessionBus().unregisterObject(s_dbusObjectPath);
}
QVariantMap WindowViewEffect::initialProperties(EffectScreen *screen)
{
return QVariantMap{
{QStringLiteral("effect"), QVariant::fromValue(this)},
{QStringLiteral("targetScreen"), QVariant::fromValue(screen)},
{QStringLiteral("selectedIds"), QVariant::fromValue(m_windowIds)},
};
}
int WindowViewEffect::animationDuration() const
{
return m_animationDuration;
@ -333,7 +324,7 @@ void WindowViewEffect::activate(const QStringList &windowIds)
}
}
if (!internalIds.isEmpty()) {
m_windowIds = internalIds;
setSelectedIds(internalIds);
m_searchText = QString();
setRunning(true);
}
@ -346,7 +337,7 @@ void WindowViewEffect::activate()
}
m_status = Status::Active;
m_windowIds.clear();
setSelectedIds(QList<QUuid>());
setGestureInProgress(false);
setPartialActivationFactor(0);
@ -417,7 +408,7 @@ void WindowViewEffect::setMode(WindowViewEffect::PresentWindowsMode mode)
}
if (mode != ModeWindowGroup) {
m_windowIds.clear();
setSelectedIds(QList<QUuid>());
}
m_mode = mode;
@ -464,4 +455,12 @@ bool WindowViewEffect::borderActivated(ElectricBorder border)
return true;
}
void WindowViewEffect::setSelectedIds(const QList<QUuid> &ids)
{
if (m_windowIds != ids) {
m_windowIds = ids;
Q_EMIT selectedIdsChanged();
}
}
} // namespace KWin

View file

@ -25,6 +25,7 @@ class WindowViewEffect : public QuickSceneEffect
Q_PROPERTY(qreal partialActivationFactor READ partialActivationFactor NOTIFY partialActivationFactorChanged)
Q_PROPERTY(bool gestureInProgress READ gestureInProgress NOTIFY gestureInProgressChanged)
Q_PROPERTY(QString searchText MEMBER m_searchText NOTIFY searchTextChanged)
Q_PROPERTY(QList<QUuid> selectedIds MEMBER m_windowIds NOTIFY selectedIdsChanged)
public:
enum PresentWindowsMode {
@ -87,12 +88,11 @@ Q_SIGNALS:
void layoutChanged();
void ignoreMinimizedChanged();
void searchTextChanged();
protected:
QVariantMap initialProperties(EffectScreen *screen) override;
void selectedIdsChanged();
private:
void realDeactivate();
void setSelectedIds(const QList<QUuid> &ids);
QTimer *m_shutdownTimer;
QList<QUuid> m_windowIds;