Skip to content

Commit b8ee522

Browse files
ArchieMengyixinshark
authored andcommitted
fix: Remove position change timer on X11Emulation
Log:
1 parent 9d9c1a8 commit b8ee522

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

frame/layershell/x11dlayershellemulation.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

frame/layershell/x11dlayershellemulation.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ private slots:
3232
private:
3333
QWindow* m_window;
3434
DLayerShellWindow* m_dlayerShellWindow;
35-
QTimer m_positionChangedTimer;
3635
QTimer m_exclusionZoneChangedTimer;
3736
};
3837
DS_END_NAMESPACE

0 commit comments

Comments
 (0)