update/improve hack part of screenghostwindow

--related to KWin faulty behavior for visibility
pull/5/head
Michail Vourlakos 6 years ago
parent ebeabb1033
commit f63a0ad658

@ -82,31 +82,41 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
if (!KWindowSystem::isPlatformWayland()) {
connect(this, &QWindow::visibleChanged, this, [&]() {
//! IMPORTANT!!! ::: This fixes a bug when closing an Activity all views from all Activities are
//! disappearing! With this they reappear!!!
if (m_latteView && m_latteView->layout()) {
if (!isVisible()) {
QTimer::singleShot(100, [this]() {
if (!m_inDelete && m_latteView && m_latteView->layout() && !isVisible()) {
setVisible(true);
}
});
//! disappearing! With this code parts they reappear!!!
m_visibleHackTimer1.setInterval(400);
m_visibleHackTimer2.setInterval(2500);
m_visibleHackTimer1.setSingleShot(true);
m_visibleHackTimer2.setSingleShot(true);
QTimer::singleShot(1500, [this]() {
connectionsHack << connect(this, &QWindow::visibleChanged, this, [&]() {
if (!m_inDelete && m_latteView && m_latteView->layout() && !isVisible()) {
setVisible(true);
}
});
} else {
m_visibleHackTimer1.start();
m_visibleHackTimer2.start();
} else if (!m_inDelete) {
//! For some reason when the window is hidden in the edge under X11 afterwards
//! is losing its window flags
if (!m_inDelete) {
KWindowSystem::setType(winId(), NET::Dock);
KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
KWindowSystem::setOnAllDesktops(winId(), true);
}
});
connectionsHack << connect(&m_visibleHackTimer1, &QTimer::timeout, this, [&]() {
if (!m_inDelete && m_latteView && m_latteView->layout() && !isVisible()) {
setVisible(true);
//qDebug() << "Ghost Edge:: Enforce reshow from timer 1...";
} else {
//qDebug() << "Ghost Edge:: No needed reshow from timer 1...";
}
});
connectionsHack << connect(&m_visibleHackTimer2, &QTimer::timeout, this, [&]() {
if (!m_inDelete && m_latteView && m_latteView->layout() && !isVisible()) {
setVisible(true);
//qDebug() << "Ghost Edge:: Enforce reshow from timer 2...";
} else {
//qDebug() << "Ghost Edge:: No needed reshow from timer 2...";
}
});
}
@ -124,6 +134,13 @@ ScreenEdgeGhostWindow::~ScreenEdgeGhostWindow()
m_inDelete = true;
m_latteView = nullptr;
// clear mode
m_visibleHackTimer1.stop();
m_visibleHackTimer2.stop();
for (auto &c : connectionsHack) {
disconnect(c);
}
if (m_shellSurface) {
delete m_shellSurface;
}
@ -147,7 +164,12 @@ KWayland::Client::PlasmaShellSurface *ScreenEdgeGhostWindow::surface()
void ScreenEdgeGhostWindow::updateGeometry()
{
QRect newGeometry;
int thickness{KWindowSystem::compositingActive() ? 4 : 2};
int thickness;
if (KWindowSystem::compositingActive()) {
thickness == 4;
} else {
thickness == 2;
};
if (m_latteView->location() == Plasma::Types::BottomEdge) {
newGeometry.setX(m_latteView->absoluteGeometry().left());

@ -98,6 +98,14 @@ private:
QTimer m_delayedMouseTimer;
QTimer m_fixGeometryTimer;
//! HACK: Timers in order to handle KWin faulty
//! behavior that hides Views when closing Activities
//! with no actual reason
QTimer m_visibleHackTimer1;
QTimer m_visibleHackTimer2;
//! Connections for the KWin visibility hack
QList<QMetaObject::Connection> connectionsHack;
Latte::View *m_latteView{nullptr};
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};

@ -244,6 +244,7 @@ void VisibilityManager::updateStrutsBasedOnLayoutsAndActivities()
&& m_latteView->layout()->isCurrent());
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout || multipleLayoutsAndCurrent) {
qDebug() << "UPDATING struts for ::: " << m_latteView->layout()->name();
QRect computedStruts = acceptableStruts();
if (m_publishedStruts != computedStruts) {
@ -251,6 +252,11 @@ void VisibilityManager::updateStrutsBasedOnLayoutsAndActivities()
m_wm->setViewStruts(*m_latteView, m_publishedStruts, m_latteView->location());
}
} else {
if (m_latteView->layout()) {
qDebug() << "REMOVING struts for ::: " << m_latteView->layout()->name();
} else {
qDebug() << "REMOVING struts from NULL layout...";
}
m_publishedStruts = QRect();
m_wm->removeViewStruts(*m_latteView);
}

Loading…
Cancel
Save