@@ -30,11 +30,8 @@ LayerShellEmulation::LayerShellEmulation(QWindow* window, QObject *parent)
3030 connect (m_dlayerShellWindow, &DLayerShellWindow::layerChanged, this , &LayerShellEmulation::onLayerChanged);
3131
3232 onPositionChanged ();
33- m_positionChangedTimer.setSingleShot (true );
34- m_positionChangedTimer.setInterval (100 );
35- connect (&m_positionChangedTimer, &QTimer::timeout, this , &LayerShellEmulation::onPositionChanged);
36- connect (m_dlayerShellWindow, &DLayerShellWindow::anchorsChanged, &m_positionChangedTimer, static_cast <void (QTimer::*)()>(&QTimer::start));
37- connect (m_dlayerShellWindow, &DLayerShellWindow::marginsChanged, &m_positionChangedTimer, static_cast <void (QTimer::*)()>(&QTimer::start));
33+ connect (m_dlayerShellWindow, &DLayerShellWindow::anchorsChanged, this , &LayerShellEmulation::onPositionChanged);
34+ connect (m_dlayerShellWindow, &DLayerShellWindow::marginsChanged, this , &LayerShellEmulation::onPositionChanged);
3835
3936 onExclusionZoneChanged ();
4037 m_exclusionZoneChangedTimer.setSingleShot (true );
@@ -45,23 +42,23 @@ LayerShellEmulation::LayerShellEmulation(QWindow* window, QObject *parent)
4542
4643 // qml height or width may update later, need to update anchor postion and exclusion zone
4744 connect (m_window, &QWindow::widthChanged, &m_exclusionZoneChangedTimer, static_cast <void (QTimer::*)()>(&QTimer::start));
48- connect (m_window, &QWindow::widthChanged, &m_positionChangedTimer, static_cast < void (QTimer::*)()>(&QTimer::start) );
45+ connect (m_window, &QWindow::widthChanged, this , &LayerShellEmulation::onPositionChanged );
4946 connect (m_window, &QWindow::heightChanged, &m_exclusionZoneChangedTimer, static_cast <void (QTimer::*)()>(&QTimer::start));
50- connect (m_window, &QWindow::heightChanged, &m_positionChangedTimer, static_cast < void (QTimer::*)()>(&QTimer::start) );
51- connect (m_window, &QWindow::xChanged, &m_positionChangedTimer, static_cast < void (QTimer::*)()>(&QTimer::start) );
52- connect (m_window, &QWindow::yChanged, &m_positionChangedTimer, static_cast < void (QTimer::*)()>(&QTimer::start) );
47+ connect (m_window, &QWindow::heightChanged, this , &LayerShellEmulation::onPositionChanged );
48+ connect (m_window, &QWindow::xChanged, this , &LayerShellEmulation::onPositionChanged );
49+ connect (m_window, &QWindow::yChanged, this , &LayerShellEmulation::onPositionChanged );
5350
5451 for (auto screen : qApp->screens ()) {
55- connect (screen, &QScreen::geometryChanged, &m_positionChangedTimer, static_cast < void (QTimer::*)()>(&QTimer::start) );
52+ connect (screen, &QScreen::geometryChanged, this , &LayerShellEmulation::onPositionChanged );
5653 connect (screen, &QScreen::geometryChanged, &m_exclusionZoneChangedTimer, static_cast <void (QTimer::*)()>(&QTimer::start));
5754 }
5855 connect (qApp, &QGuiApplication::screenAdded, this , [this ] (const QScreen *newScreen) {
59- connect (newScreen, &QScreen::geometryChanged, &m_positionChangedTimer, static_cast < void (QTimer::*)()>(&QTimer::start) );
56+ connect (newScreen, &QScreen::geometryChanged, this , &LayerShellEmulation::onPositionChanged );
6057 connect (newScreen, &QScreen::geometryChanged, &m_exclusionZoneChangedTimer, static_cast <void (QTimer::*)()>(&QTimer::start));
6158 });
6259 connect (qApp, &QGuiApplication::primaryScreenChanged, &m_exclusionZoneChangedTimer, static_cast <void (QTimer::*)()>(&QTimer::start));
6360 connect (m_window, &QWindow::screenChanged, this , [this ](QScreen *nowScreen){
64- m_positionChangedTimer. start ();
61+ onPositionChanged ();
6562 m_exclusionZoneChangedTimer.start ();
6663 });
6764
0 commit comments