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

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

Loading…
Cancel
Save