fix: 任务栏显示区域异常

任务栏会在特殊场景下(切换分辨率)收不到qt-dbus-factory的ScreenHeightChanged信号,导致任务栏的高度计算错误。

Log: 修复任务栏显示区域异常的问题。
Bug: https://pms.uniontech.com/zentao/bug-view-57569.html
Bug: https://pms.uniontech.com/zentao/bug-view-56391.html
Bug: https://pms.uniontech.com/zentao/bug-view-56388.html
Bug: https://pms.uniontech.com/zentao/bug-view-56010.html
Change-Id: I3e7c0b7cbcdc1f60faf528084222ce0f2bc9d245
This commit is contained in:
Zhang Qipeng 2020-12-11 14:53:06 +08:00
parent bae08557e8
commit 1294473e0f

View File

@ -183,19 +183,29 @@ void MultiScreenWorker::handleDbusSignal(QDBusMessage msg)
return;
// 返回的数据中,这一部分对应的是数据发送方的interfacename,可判断是否是自己需要的服务
QString interfaceName = msg.arguments().at(0).toString();
if (interfaceName != "com.deepin.dde.daemon.Dock")
return;
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
QStringList keys = changedProps.keys();
foreach (const QString &prop, keys) {
if (prop == "Position") {
onPositionChanged();
} else if (prop == "DisplayMode") {
onDisplayModeChanged();
} else if (prop == "HideMode") {
onHideModeChanged();
} else if (prop == "HideState") {
onHideStateChanged();
if (interfaceName == "com.deepin.dde.daemon.Dock") {
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
QStringList keys = changedProps.keys();
foreach (const QString &prop, keys) {
if (prop == "Position") {
onPositionChanged();
} else if (prop == "DisplayMode") {
onDisplayModeChanged();
} else if (prop == "HideMode") {
onHideModeChanged();
} else if (prop == "HideState") {
onHideStateChanged();
}
}
} else if (interfaceName == "com.deepin.daemon.Display") {
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
QStringList keys = changedProps.keys();
foreach (const QString &prop, keys) {
if (prop == "ScreenHeight") {
m_screenRawHeight = m_displayInter->screenHeight();
} else if (prop == "ScreenWidth") {
m_screenRawWidth = m_displayInter->screenWidth();
}
}
}
}
@ -942,7 +952,7 @@ void MultiScreenWorker::onRequestDelayShowDock(const QString &screenName)
void MultiScreenWorker::initMembers()
{
m_monitorUpdateTimer->setInterval(10);
m_monitorUpdateTimer->setInterval(100);
m_monitorUpdateTimer->setSingleShot(true);
m_delayTimer->setInterval(2000);
@ -976,7 +986,14 @@ void MultiScreenWorker::initGSettingConfig()
void MultiScreenWorker::initConnection()
{
//FIX: 这里关联信号有时候收不到,未查明原因,handleDbusSignal处理
/** FIXME
* qt-dbus-factory changed
* qt-dbus-factory DBusExtendedAbstractInterface::internalPropGet
* onPropertyChanged changed
* dbus changed ;
* qt-dbus-factory DBusExtendedAbstractInterface::internalPropGet
* qt-dbus-factory 广
*/
#if 0
// connect(m_dockInter, &DBusDock::PositionChanged, this, &MultiScreenWorker::onPositionChanged);
// connect(m_dockInter, &DBusDock::DisplayModeChanged, this, &MultiScreenWorker::onDisplayModeChanged);
@ -989,6 +1006,12 @@ void MultiScreenWorker::initConnection()
"PropertiesChanged",
"sa{sv}as",
this, SLOT(handleDbusSignal(QDBusMessage)));
QDBusConnection::sessionBus().connect("com.deepin.daemon.Display",
"/com/deepin/daemon/Display",
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
"sa{sv}as",
this, SLOT(handleDbusSignal(QDBusMessage)));
#endif
connect(&m_mtrInfo, &MonitorInfo::monitorChanged, this, &MultiScreenWorker::requestUpdateMonitorInfo);
@ -1450,9 +1473,7 @@ void MultiScreenWorker::checkDaemonDockService()
void MultiScreenWorker::checkDaemonDisplayService()
{
auto connectionInit = [ = ](DisplayInter * displayInter) {
connect(displayInter, &DisplayInter::ScreenWidthChanged, this, [ = ](ushort value) {m_screenRawWidth = value;});
connect(displayInter, &DisplayInter::ScreenHeightChanged, this, [ = ](ushort value) {m_screenRawHeight = value;});
auto connectionInit = [ = ](DisplayInter *displayInter) {
connect(displayInter, &DisplayInter::MonitorsChanged, this, &MultiScreenWorker::onMonitorListChanged);
connect(displayInter, &DisplayInter::MonitorsChanged, this, &MultiScreenWorker::requestUpdateRegionMonitor);
connect(displayInter, &DisplayInter::PrimaryRectChanged, this, &MultiScreenWorker::primaryScreenChanged, Qt::QueuedConnection);