2023-03-06 06:38:43 +00:00
|
|
|
// SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-11-21 05:24:08 +00:00
|
|
|
#include <effect/effecthandler.h>
|
|
|
|
|
#include <effect/quickeffect.h>
|
|
|
|
|
#include <effect/effect.h>
|
|
|
|
|
#include <effect/effecttogglablestate.h>
|
2023-03-06 06:38:43 +00:00
|
|
|
|
|
|
|
|
#include <span>
|
|
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
#include <QKeySequence>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
#include <KGlobalAccel>
|
|
|
|
|
#include <KLocalizedString>
|
|
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class MobileTaskSwitcherEffect : public QuickSceneEffect
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PROPERTY(qreal partialActivationFactor READ partialActivationFactor NOTIFY partialActivationFactorChanged)
|
|
|
|
|
Q_PROPERTY(bool gestureInProgress READ gestureInProgress NOTIFY gestureInProgressChanged)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum class Status { Inactive, Activating, Deactivating, Active };
|
|
|
|
|
MobileTaskSwitcherEffect();
|
|
|
|
|
~MobileTaskSwitcherEffect() override;
|
|
|
|
|
|
|
|
|
|
int animationDuration() const;
|
|
|
|
|
void setAnimationDuration(int duration);
|
|
|
|
|
|
|
|
|
|
bool gestureInProgress() const;
|
|
|
|
|
|
|
|
|
|
qreal partialActivationFactor() const;
|
|
|
|
|
|
|
|
|
|
int requestedEffectChainPosition() const override;
|
|
|
|
|
bool borderActivated(ElectricBorder border) override;
|
|
|
|
|
void reconfigure(ReconfigureFlags flags) override;
|
|
|
|
|
void grabbedKeyboardEvent(QKeyEvent *keyEvent) override;
|
|
|
|
|
|
2023-03-25 06:29:40 +00:00
|
|
|
void setDBusState(bool active);
|
|
|
|
|
|
2023-03-06 06:38:43 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
|
void activate();
|
|
|
|
|
void realDeactivate();
|
|
|
|
|
void deactivate(bool deactivateInstantly);
|
|
|
|
|
void quickDeactivate();
|
|
|
|
|
void toggle();
|
|
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
|
void animationDurationChanged();
|
|
|
|
|
void gestureInProgressChanged();
|
|
|
|
|
void partialActivationFactorChanged();
|
|
|
|
|
|
|
|
|
|
private:
|
2023-11-16 06:45:23 +00:00
|
|
|
EffectTogglableState *const m_taskSwitcherState;
|
|
|
|
|
EffectTogglableTouchBorder *const m_border;
|
2024-04-05 16:39:30 +00:00
|
|
|
QList<int> m_borderActivate = {ElectricBorder::ElectricBottom};
|
2023-11-16 06:45:23 +00:00
|
|
|
|
2023-03-06 06:38:43 +00:00
|
|
|
QAction *m_realtimeToggleAction = nullptr;
|
|
|
|
|
QAction *m_toggleAction = nullptr;
|
|
|
|
|
QList<QKeySequence> m_toggleShortcut;
|
2023-11-16 06:45:23 +00:00
|
|
|
|
2023-03-06 06:38:43 +00:00
|
|
|
QTimer *m_shutdownTimer;
|
|
|
|
|
|
|
|
|
|
int m_animationDuration = 400;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace KWin
|