mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
fix: 任务栏开机几率无法显示
startdde启动过快导致任务栏还没启动时callshow被调用,调用失败导致任务栏不显示。延迟RegisterDdeSession解决 Log: 解决任务栏开机几率无法显示问题 Bug: https://pms.uniontech.com/zentao/bug-view-52917.html Change-Id: I19fc19607160e66d294dbf63211fe3da84f7b890
This commit is contained in:
parent
52b13f8b19
commit
306f321307
@ -36,7 +36,6 @@
|
||||
|
||||
#include <DApplication>
|
||||
#include <DLog>
|
||||
#include <DDBusSender>
|
||||
#include <DGuiApplicationHelper>
|
||||
|
||||
#include <unistd.h>
|
||||
@ -60,27 +59,6 @@ const QString g_cfgPath = QStandardPaths::standardLocations(QStandardPaths::Conf
|
||||
|
||||
using namespace std;
|
||||
|
||||
// let startdde know that we've already started.
|
||||
void RegisterDdeSession()
|
||||
{
|
||||
QString envName("DDE_SESSION_PROCESS_COOKIE_ID");
|
||||
|
||||
QByteArray cookie = qgetenv(envName.toUtf8().data());
|
||||
qunsetenv(envName.toUtf8().data());
|
||||
|
||||
if (!cookie.isEmpty()) {
|
||||
QDBusPendingReply<bool> r = DDBusSender()
|
||||
.interface("com.deepin.SessionManager")
|
||||
.path("/com/deepin/SessionManager")
|
||||
.service("com.deepin.SessionManager")
|
||||
.method("Register")
|
||||
.arg(QString(cookie))
|
||||
.call();
|
||||
|
||||
qDebug() << Q_FUNC_INFO << r.value();
|
||||
}
|
||||
}
|
||||
|
||||
bool IsSaveMode()
|
||||
{
|
||||
QSettings settings(g_cfgPath, QSettings::IniFormat);
|
||||
@ -250,9 +228,6 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
qDebug() << "\n\ndde-dock startup";
|
||||
RegisterDdeSession();
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
QDir::setCurrent(QApplication::applicationDirPath());
|
||||
#endif
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <DPlatformWindowHandle>
|
||||
#include <DSysInfo>
|
||||
#include <DPlatformTheme>
|
||||
#include <DDBusSender>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
@ -75,6 +76,27 @@ const QPoint scaledPos(const QPoint &rawXPos)
|
||||
: rawXPos;
|
||||
}
|
||||
|
||||
// let startdde know that we've already started.
|
||||
void RegisterDdeSession()
|
||||
{
|
||||
QString envName("DDE_SESSION_PROCESS_COOKIE_ID");
|
||||
|
||||
QByteArray cookie = qgetenv(envName.toUtf8().data());
|
||||
qunsetenv(envName.toUtf8().data());
|
||||
|
||||
if (!cookie.isEmpty()) {
|
||||
QDBusPendingReply<bool> r = DDBusSender()
|
||||
.interface("com.deepin.SessionManager")
|
||||
.path("/com/deepin/SessionManager")
|
||||
.service("com.deepin.SessionManager")
|
||||
.method("Register")
|
||||
.arg(QString(cookie))
|
||||
.call();
|
||||
|
||||
qDebug() << Q_FUNC_INFO << r.value();
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: DBlurEffectWidget(parent)
|
||||
, m_mainPanel(new MainPanelControl(this))
|
||||
@ -157,6 +179,12 @@ void MainWindow::callShow()
|
||||
qApp->setProperty("CANSHOW", true);
|
||||
|
||||
launch();
|
||||
|
||||
// 预留200ms提供给窗口初始化再通知startdde,不影响启动速度
|
||||
QTimer::singleShot(200, this, []{
|
||||
qDebug() << "\n\ndde-dock startup RegisterDdeSession";
|
||||
RegisterDdeSession();
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent *e)
|
||||
|
@ -234,7 +234,7 @@ protected:
|
||||
/// \brief m_proxyInter
|
||||
/// NEVER delete this object.
|
||||
///
|
||||
PluginProxyInterface *m_proxyInter;
|
||||
PluginProxyInterface *m_proxyInter = nullptr;
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user