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() void ScreenEdgeGhostWindow::updateGeometry()
{ {
QRect newGeometry; QRect newGeometry;
int thickness{1}; int thickness{2};
if (m_latteView->location() == Plasma::Types::BottomEdge) { if (m_latteView->location() == Plasma::Types::BottomEdge) {
newGeometry.setX(m_latteView->absGeometry().left()); 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) bool ScreenEdgeGhostWindow::event(QEvent *e)
{ {
if (e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) { if (e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) {
emit containsMouseChanged(true); setContainsMouse(true);
} else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave) { } else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave) {
emit containsMouseChanged(false); setContainsMouse(false);
} }
return QQuickView::event(e); return QQuickView::event(e);

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

@ -298,18 +298,7 @@ void VisibilityManager::setIsHidden(bool isHidden)
m_isHidden = isHidden; m_isHidden = isHidden;
if (supportsKWinEdges()) { updateGhostWindowState();
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);
}
}
emit isHiddenChanged(); emit isHiddenChanged();
} }
@ -368,6 +357,22 @@ bool VisibilityManager::supportsKWinEdges() const
return (edgeGhostWindow != nullptr); 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) void VisibilityManager::raiseView(bool raise)
{ {
if (m_blockHiding) if (m_blockHiding)
@ -721,7 +726,10 @@ void VisibilityManager::createEdgeGhostWindow()
connect(edgeGhostWindow, &ScreenEdgeGhostWindow::containsMouseChanged, this, [ = ](bool contains) { connect(edgeGhostWindow, &ScreenEdgeGhostWindow::containsMouseChanged, this, [ = ](bool contains) {
if (contains) { if (contains) {
emit mustBeShown(); raiseView(true);
} else {
m_timerShow.stop();
updateGhostWindowState();
} }
}); });

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

Loading…
Cancel
Save