fix #946,improve kwin screen edges under X11

--make sure that the kwin ghost window ends at
the correct geometry at all cases
pull/2/head
Michail Vourlakos 7 years ago
parent 9e8406c419
commit fb8063cdee

@ -45,6 +45,11 @@ 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);
connect(m_dockView, &DockView::absGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
connect(m_dockView, &DockView::screenGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
connect(m_dockView, &DockView::locationChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
@ -140,13 +145,24 @@ void ScreenEdgeGhostWindow::updateGeometry()
newGeometry.setHeight(qMin(m_dockView->absGeometry().height(), m_dockView->screenGeometry().height() - 1));
}
setMinimumSize(newGeometry.size());
setMaximumSize(newGeometry.size());
resize(newGeometry.size());
setPosition(newGeometry.x(), newGeometry.y());
m_calculatedGeometry = newGeometry;
if (m_shellSurface) {
m_shellSurface->setPosition(newGeometry.topLeft());
fixGeometry();
}
void ScreenEdgeGhostWindow::fixGeometry()
{
if (!m_calculatedGeometry.isEmpty()
&& (m_calculatedGeometry.x() != x() || m_calculatedGeometry.y() != y()
|| m_calculatedGeometry.width() != width() || m_calculatedGeometry.height() != height())) {
setMinimumSize(m_calculatedGeometry.size());
setMaximumSize(m_calculatedGeometry.size());
resize(m_calculatedGeometry.size());
setPosition(m_calculatedGeometry.x(), m_calculatedGeometry.y());
if (m_shellSurface) {
m_shellSurface->setPosition(m_calculatedGeometry.topLeft());
}
}
}

@ -76,12 +76,14 @@ protected:
private slots:
void updateGeometry();
void fixGeometry();
private:
void setupWaylandIntegration();
private:
bool m_inDelete{false};
QRect m_calculatedGeometry;
DockView *m_dockView{nullptr};

Loading…
Cancel
Save