Skip to content

Commit

Permalink
fix: the personalization module load slowly
Browse files Browse the repository at this point in the history
Treeland下连接了X11下的wm的dbus

pms: BUG-293655
  • Loading branch information
mhduiy committed Dec 12, 2024
1 parent f1d2955 commit a94a217
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 45 deletions.
34 changes: 3 additions & 31 deletions src/plugin-personalization/operation/personalizationdbusproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ const QString AppearanceService = QStringLiteral("org.deepin.dde.Appearance1");
const QString AppearancePath = QStringLiteral("/org/deepin/dde/Appearance1");
const QString AppearanceInterface = QStringLiteral("org.deepin.dde.Appearance1");

const QString WMSwitcherService = QStringLiteral("org.deepin.dde.WMSwitcher1");
const QString WMSwitcherPath = QStringLiteral("/org/deepin/dde/WMSwitcher1");
const QString WMSwitcherInterface = QStringLiteral("org.deepin.dde.WMSwitcher1");

const QString WMService = QStringLiteral("com.deepin.wm");
const QString WMPath = QStringLiteral("/com/deepin/wm");
const QString WMInterface = QStringLiteral("com.deepin.wm");
Expand All @@ -32,18 +28,16 @@ DGUI_USE_NAMESPACE

PersonalizationDBusProxy::PersonalizationDBusProxy(QObject *parent)
: QObject(parent)
, m_AppearanceInter(new QDBusInterface(AppearanceService, AppearancePath, AppearanceInterface, QDBusConnection::sessionBus(), this))
, m_WMSwitcherInter(new QDBusInterface(WMSwitcherService, WMSwitcherPath, WMSwitcherInterface, QDBusConnection::sessionBus(), this))

{
m_AppearanceInter = new QDBusInterface(AppearanceService, AppearancePath, AppearanceInterface, QDBusConnection::sessionBus(), this);
if (!DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)) {
m_WMInter = new QDBusInterface(WMService, WMPath, WMInterface, QDBusConnection::sessionBus(), this);
m_EffectsInter = new QDBusInterface(EffectsService, EffectsPath, EffectsInterface, QDBusConnection::sessionBus(), this);
connect(m_WMSwitcherInter, SIGNAL(WMChanged(const QString &)), this, SIGNAL(WMChanged(const QString &)));

QDBusConnection::sessionBus().connect(WMService, WMPath, PropertiesInterface, PropertiesChanged, this, SLOT(onPropertiesChanged(QDBusMessage)));
}

QDBusConnection::sessionBus().connect(AppearanceService, AppearancePath, PropertiesInterface, PropertiesChanged, this, SLOT(onPropertiesChanged(QDBusMessage)));
QDBusConnection::sessionBus().connect(WMService, WMPath, PropertiesInterface, PropertiesChanged, this, SLOT(onPropertiesChanged(QDBusMessage)));

connect(m_AppearanceInter, SIGNAL(Changed(const QString &, const QString &)), this, SIGNAL(Changed(const QString &, const QString &)));
connect(m_AppearanceInter, SIGNAL(Refreshed(const QString &)), this, SIGNAL(Refreshed(const QString &)));
Expand Down Expand Up @@ -240,28 +234,6 @@ QString PersonalizationDBusProxy::getCurrentWorkSpaceBackgroundForMonitor(const
return QDBusPendingReply<QString>(m_AppearanceInter->asyncCall(QStringLiteral("GetCurrentWorkspaceBackgroundForMonitor"), screenName));
}

// WMSwitcher
bool PersonalizationDBusProxy::AllowSwitch()
{
return QDBusPendingReply<bool>(m_WMSwitcherInter->asyncCall(QStringLiteral("AllowSwitch")));
}

QString PersonalizationDBusProxy::CurrentWM()
{
return QDBusPendingReply<QString>(m_WMSwitcherInter->asyncCall(QStringLiteral("CurrentWM")));
}

bool PersonalizationDBusProxy::CurrentWM(QObject *receiver, const char *member)
{
QList<QVariant> args;
return m_WMSwitcherInter->callWithCallback(QStringLiteral("CurrentWM"), args, receiver, member);
}

void PersonalizationDBusProxy::RequestSwitchWM()
{
m_WMSwitcherInter->asyncCall(QStringLiteral("RequestSwitchWM"));
}

// WM
bool PersonalizationDBusProxy::compositingAllowSwitch()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ public slots:
bool Show(const QString &ty, const QStringList &names, QObject *receiver, const char *member);
QString Thumbnail(const QString &ty, const QString &name);
bool Thumbnail(const QString &ty, const QString &name, QObject *receiver, const char *member, const char *errorSlot);
// WMSwitcher
bool AllowSwitch();
QString CurrentWM();
bool CurrentWM(QObject *receiver, const char *member);
void RequestSwitchWM();
// Effects
bool loadEffect(const QString &name);
void unloadEffect(const QString &name);
Expand All @@ -139,7 +134,6 @@ private slots:

private:
QDBusInterface *m_AppearanceInter = nullptr;
QDBusInterface *m_WMSwitcherInter = nullptr;
QDBusInterface *m_WMInter = nullptr;
QDBusInterface *m_EffectsInter = nullptr;
};
Expand Down
8 changes: 1 addition & 7 deletions src/plugin-personalization/operation/x11worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void X11Worker::active()
int windowEffectType = m_kwinCompositingConfig->value(WINDOW_EFFECT_TYPE_KEY).toInt();
m_model->setWindowEffectType(windowEffectType);
m_personalizationDBusProxy->isEffectLoaded("magiclamp", this, SLOT(onMiniEffectChanged(bool)));
refreshWMState();
m_model->setIsMoveWindow(m_personalizationDBusProxy->isEffectLoaded(EffectMoveWindowArg));
}

void X11Worker::setTitleBarHeight(int value)
Expand Down Expand Up @@ -70,12 +70,6 @@ void X11Worker::onMiniEffectChanged(bool value)
m_model->setMiniEffect(value ? 1 : 0);
}

void X11Worker::refreshWMState()
{
m_personalizationDBusProxy->CurrentWM(this, SLOT(onToggleWM(const QString &)));
m_model->setIsMoveWindow(m_personalizationDBusProxy->isEffectLoaded(EffectMoveWindowArg));
}

void X11Worker::setMovedWindowOpacity(bool value)
{
if (value) {
Expand Down
1 change: 0 additions & 1 deletion src/plugin-personalization/operation/x11worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ private Q_SLOTS:

private:
void onKWinConfigChanged(const QString &key);
void refreshWMState();

private:
Dtk::Core::DConfig *m_kwinTitleBarConfig = nullptr;
Expand Down

0 comments on commit a94a217

Please sign in to comment.