mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 任务栏仅主屏显示关联信号改用后端的信号
wayland下改变主屏后不会发出QApplication::primaryScreenChanged信号,改用后端PrimaryChanged信号 Log: 修复wayland下任务栏设置仅主屏显示后切换主屏任务栏未跟随显示的问题 Influence: 切换主屏后,任务栏显示 Bug: https://pms.uniontech.com/bug-view-129559.html Change-Id: I70e4d71916326fa6ff203b64e337075ad87bec8c
This commit is contained in:
parent
87525c9917
commit
587e3822d9
@ -31,9 +31,15 @@ DisplayManager::DisplayManager(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_gsettings(Utils::SettingsPtr("com.deepin.dde.dock.mainwindow", "/com/deepin/dde/dock/mainwindow/", this))
|
, m_gsettings(Utils::SettingsPtr("com.deepin.dde.dock.mainwindow", "/com/deepin/dde/dock/mainwindow/", this))
|
||||||
, m_onlyInPrimary(Utils::SettingValue("com.deepin.dde.dock.mainwindow", "/com/deepin/dde/dock/mainwindow/", "onlyShowPrimary", false).toBool())
|
, m_onlyInPrimary(Utils::SettingValue("com.deepin.dde.dock.mainwindow", "/com/deepin/dde/dock/mainwindow/", "onlyShowPrimary", false).toBool())
|
||||||
|
, m_displayInter(nullptr)
|
||||||
{
|
{
|
||||||
connect(qApp, &QApplication::primaryScreenChanged, this, &DisplayManager::primaryScreenChanged);
|
connect(qApp, &QApplication::primaryScreenChanged, this, &DisplayManager::primaryScreenChanged);
|
||||||
connect(qApp, &QApplication::primaryScreenChanged, this, &DisplayManager::dockInfoChanged);
|
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||||
|
m_displayInter = new DisplayInter("com.deepin.daemon.Display", "/com/deepin/daemon/Display",QDBusConnection::sessionBus(), this);
|
||||||
|
connect(m_displayInter, &__Display::PrimaryChanged, this, &DisplayManager::dockInfoChanged);
|
||||||
|
} else {
|
||||||
|
connect(qApp, &QApplication::primaryScreenChanged, this, &DisplayManager::dockInfoChanged);
|
||||||
|
}
|
||||||
connect(qApp, &QGuiApplication::screenAdded, this, &DisplayManager::screenCountChanged);
|
connect(qApp, &QGuiApplication::screenAdded, this, &DisplayManager::screenCountChanged);
|
||||||
connect(qApp, &QGuiApplication::screenRemoved, this, &DisplayManager::screenCountChanged);
|
connect(qApp, &QGuiApplication::screenRemoved, this, &DisplayManager::screenCountChanged);
|
||||||
|
|
||||||
@ -166,7 +172,7 @@ void DisplayManager::updateScreenDockInfo()
|
|||||||
// 仅显示在主屏时的处理
|
// 仅显示在主屏时的处理
|
||||||
if (m_onlyInPrimary) {
|
if (m_onlyInPrimary) {
|
||||||
for (auto s : m_screens) {
|
for (auto s : m_screens) {
|
||||||
if (s != qApp->primaryScreen()) {
|
if (Utils::IS_WAYLAND_DISPLAY ? !s->model().contains(m_displayInter->primary()) : s != qApp->primaryScreen()) {
|
||||||
QMap <Position, bool> map;
|
QMap <Position, bool> map;
|
||||||
map.insert(Position::Top, false);
|
map.insert(Position::Top, false);
|
||||||
map.insert(Position::Bottom, false);
|
map.insert(Position::Bottom, false);
|
||||||
|
@ -68,6 +68,7 @@ private:
|
|||||||
QMap<QScreen *, QMap<Position, bool>> m_screenPositionMap;
|
QMap<QScreen *, QMap<Position, bool>> m_screenPositionMap;
|
||||||
const QGSettings *m_gsettings; // 多屏配置控制
|
const QGSettings *m_gsettings; // 多屏配置控制
|
||||||
bool m_onlyInPrimary;
|
bool m_onlyInPrimary;
|
||||||
|
DisplayInter *m_displayInter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DISPLAYMANAGER_H
|
#endif // DISPLAYMANAGER_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user