mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
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:
parent
bae08557e8
commit
1294473e0f
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user