restore Show Timer behavior for KWin Edges

pull/5/head
Michail Vourlakos 6 years ago
parent ff77bc3485
commit 9bdd58ee3f

@ -135,7 +135,7 @@ KWayland::Client::PlasmaShellSurface *ScreenEdgeGhostWindow::surface()
void ScreenEdgeGhostWindow::updateGeometry()
{
QRect newGeometry;
int thickness{1};
int thickness{2};
if (m_latteView->location() == Plasma::Types::BottomEdge) {
newGeometry.setX(m_latteView->absGeometry().left());
@ -216,12 +216,27 @@ void ScreenEdgeGhostWindow::setupWaylandIntegration()
}
}
bool ScreenEdgeGhostWindow::containsMouse() const
{
return m_containsMouse;
}
void ScreenEdgeGhostWindow::setContainsMouse(bool contains)
{
if (m_containsMouse == contains) {
return;
}
m_containsMouse = contains;
emit containsMouseChanged(contains);
}
bool ScreenEdgeGhostWindow::event(QEvent *e)
{
if (e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) {
emit containsMouseChanged(true);
setContainsMouse(true);
} else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave) {
emit containsMouseChanged(false);
setContainsMouse(false);
}
return QQuickView::event(e);

@ -63,6 +63,8 @@ public:
ScreenEdgeGhostWindow(Latte::View *view);
~ScreenEdgeGhostWindow() override;
bool containsMouse() const;
int location();
void hideWithMask();
@ -84,9 +86,11 @@ private slots:
void fixGeometry();
private:
void setContainsMouse(bool contains);
void setupWaylandIntegration();
private:
bool m_containsMouse{false};
bool m_inDelete{false};
QRect m_calculatedGeometry;

@ -298,18 +298,7 @@ void VisibilityManager::setIsHidden(bool isHidden)
m_isHidden = isHidden;
if (supportsKWinEdges()) {
bool inCurrentLayout = (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout ||
(m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts
&& m_latteView->managedLayout() && !m_latteView->positioner()->inLocationChangeAnimation()
&& m_latteView->managedLayout()->name() == m_corona->layoutManager()->currentLayoutName()));
if (inCurrentLayout) {
wm->setEdgeStateFor(edgeGhostWindow, m_isHidden);
} else {
wm->setEdgeStateFor(edgeGhostWindow, false);
}
}
updateGhostWindowState();
emit isHiddenChanged();
}
@ -368,6 +357,22 @@ bool VisibilityManager::supportsKWinEdges() const
return (edgeGhostWindow != nullptr);
}
void VisibilityManager::updateGhostWindowState()
{
if (supportsKWinEdges()) {
bool inCurrentLayout = (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout ||
(m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts
&& m_latteView->managedLayout() && !m_latteView->positioner()->inLocationChangeAnimation()
&& m_latteView->managedLayout()->name() == m_corona->layoutManager()->currentLayoutName()));
if (inCurrentLayout) {
wm->setEdgeStateFor(edgeGhostWindow, m_isHidden);
} else {
wm->setEdgeStateFor(edgeGhostWindow, false);
}
}
}
void VisibilityManager::raiseView(bool raise)
{
if (m_blockHiding)
@ -721,7 +726,10 @@ void VisibilityManager::createEdgeGhostWindow()
connect(edgeGhostWindow, &ScreenEdgeGhostWindow::containsMouseChanged, this, [ = ](bool contains) {
if (contains) {
emit mustBeShown();
raiseView(true);
} else {
m_timerShow.stop();
updateGhostWindowState();
}
});

@ -137,6 +137,7 @@ private:
void createEdgeGhostWindow();
void deleteEdgeGhostWindow();
void updateKWinEdgesSupport();
void updateGhostWindowState();
void setViewGeometry(const QRect &rect);

Loading…
Cancel
Save