fix #1005,add timer to fix freeze

--make less intrusive the repositioning
of the screen edge ghost windows
pull/2/head
Michail Vourlakos 7 years ago
parent 3f4fa6699c
commit cfce12d6ed

@ -24,6 +24,7 @@
#include <QDebug>
#include <QSurfaceFormat>
#include <QQuickView>
#include <QTimer>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/surface.h>
@ -45,16 +46,21 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(DockView *view) :
| Qt::NoDropShadowWindowHint
| Qt::WindowDoesNotAcceptFocus);
connect(this, &QQuickView::xChanged, this, &ScreenEdgeGhostWindow::fixGeometry);
connect(this, &QQuickView::yChanged, this, &ScreenEdgeGhostWindow::fixGeometry);
connect(this, &QQuickView::widthChanged, this, &ScreenEdgeGhostWindow::fixGeometry);
connect(this, &QQuickView::heightChanged, this, &ScreenEdgeGhostWindow::fixGeometry);
m_fixGeometryTimer.setSingleShot(true);
m_fixGeometryTimer.setInterval(500);
connect(&m_fixGeometryTimer, &QTimer::timeout, this, &ScreenEdgeGhostWindow::fixGeometry);
connect(this, &QQuickView::xChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer);
connect(this, &QQuickView::yChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer);
connect(this, &QQuickView::widthChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer);
connect(this, &QQuickView::heightChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer);
connect(m_dockView, &DockView::absGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
connect(m_dockView, &DockView::screenGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
connect(m_dockView, &DockView::locationChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
connect(m_dockView, &QQuickView::screenChanged, this, [this]() {
setScreen(m_dockView->screen());
updateGeometry();
});
@ -169,6 +175,11 @@ void ScreenEdgeGhostWindow::fixGeometry()
}
}
void ScreenEdgeGhostWindow::startGeometryTimer()
{
m_fixGeometryTimer.start();
}
void ScreenEdgeGhostWindow::setupWaylandIntegration()
{
if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_dockView || !m_dockView->containment()) {

@ -22,6 +22,7 @@
#include <QObject>
#include <QQuickView>
#include <QTimer>
namespace KWayland {
namespace Client {
@ -75,6 +76,7 @@ protected:
bool event(QEvent *ev) override;
private slots:
void startGeometryTimer();
void updateGeometry();
void fixGeometry();
@ -85,6 +87,8 @@ private:
bool m_inDelete{false};
QRect m_calculatedGeometry;
QTimer m_fixGeometryTimer;
DockView *m_dockView{nullptr};
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};

Loading…
Cancel
Save