1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-28 18:50:40 +03:00

x11:drop QWindow::setVisible() function

--this function creates irrelevant crashes even
under x11 environment... Dropped in favour of
show()/hide() functions that seem to not create
any issues
This commit is contained in:
Michail Vourlakos 2019-07-15 19:39:21 +03:00
parent 3a465782e1
commit c5b1e9bbf5
4 changed files with 14 additions and 45 deletions

View File

@ -105,7 +105,7 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
connectionsHack << connect(&m_visibleHackTimer1, &QTimer::timeout, this, [&]() {
if (!m_inDelete && m_latteView && m_latteView->layout() && !isVisible()) {
setVisible(true);
show();
//qDebug() << "Ghost Edge:: Enforce reshow from timer 1...";
} else {
//qDebug() << "Ghost Edge:: No needed reshow from timer 1...";
@ -114,7 +114,7 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
connectionsHack << connect(&m_visibleHackTimer2, &QTimer::timeout, this, [&]() {
if (!m_inDelete && m_latteView && m_latteView->layout() && !isVisible()) {
setVisible(true);
show();
//qDebug() << "Ghost Edge:: Enforce reshow from timer 2...";
} else {
//qDebug() << "Ghost Edge:: No needed reshow from timer 2...";
@ -136,7 +136,7 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
}
setScreen(m_latteView->screen());
setVisible(true);
show();
updateGeometry();
hideWithMask();
}

View File

@ -561,14 +561,7 @@ void PrimaryConfigView::updateShowInlineProperties()
createSecondaryWindow();
}
if (KWindowSystem::isPlatformWayland()) {
QTimer::singleShot(150, m_secConfigView, SLOT(show()));
} else {
QTimer::singleShot(150, [this]() {
m_secConfigView->setVisible(true);
});
}
QTimer::singleShot(150, m_secConfigView, SLOT(show()));
setShowInlineProperties(false);
} else {
deleteSecondaryWindow();

View File

@ -260,10 +260,6 @@ void View::init()
setSource(corona()->kPackage().filePath("lattedockui"));
m_positioner->syncGeometry();
if (!KWindowSystem::isPlatformWayland()) {
setVisible(true);
}
qDebug() << "SOURCE:" << source();
}
@ -386,42 +382,26 @@ void View::showConfigurationInterface(Plasma::Applet *applet)
if (!applet || !applet->containment())
return;
//! split x11/wayland case in order to avoid crashes under wayland
//! environment from QWindow::setVisible() function
auto setConfigViewVisibility = [this](PlasmaQuick::ConfigView *view, const bool &visible) {
if (view) {
if (KWindowSystem::isPlatformX11()) {
view->setVisible(visible);
} else {
if (visible) {
view->show();
} else {
view->hide();
}
}
}
};
Plasma::Containment *c = qobject_cast<Plasma::Containment *>(applet);
if (m_configView && c && c->isContainment() && c == this->containment()) {
if (m_configView->isVisible()) {
setConfigViewVisibility(m_configView, false);
m_configView->hide();
} else {
setConfigViewVisibility(m_configView, true);
m_configView->show();
}
return;
} else if (m_configView) {
if (m_configView->applet() == applet) {
setConfigViewVisibility(m_configView, true);
m_configView->show();
if (KWindowSystem::isPlatformX11()) {
m_configView->requestActivate();
}
return;
} else {
setConfigViewVisibility(m_configView, false);
m_configView->hide();
}
}
@ -437,18 +417,14 @@ void View::showConfigurationInterface(Plasma::Applet *applet)
m_configView.data()->init();
if (!delayConfigView) {
setConfigViewVisibility(m_configView, true);
m_configView->show();
} else {
//add a timer for showing the configuration window the first time it is
//created in order to give the containment's layouts the time to
//calculate the window's height
QTimer::singleShot(150, [this]() {
if (m_configView) {
if (KWindowSystem::isPlatformX11()) {
m_configView->setVisible(true);
} else {
m_configView->show();
}
m_configView->show();
}
});
}
@ -934,7 +910,7 @@ void View::setLayout(Layout::GenericLayout *layout)
connectionsLayout << connect(&m_visibleHackTimer1, &QTimer::timeout, this, [&]() {
if (m_layout && !inDelete() & !isVisible()) {
setVisible(true);
show();
applyActivitiesToWindows();
//qDebug() << "View:: Enforce reshow from timer 1...";
emit activitiesChanged();
@ -945,7 +921,7 @@ void View::setLayout(Layout::GenericLayout *layout)
connectionsLayout << connect(&m_visibleHackTimer2, &QTimer::timeout, this, [&]() {
if (m_layout && !inDelete() && !isVisible()) {
setVisible(true);
show();
applyActivitiesToWindows();
//qDebug() << "View:: Enforce reshow from timer 2...";
emit activitiesChanged();

View File

@ -418,14 +418,14 @@ void VisibilityManager::updateGhostWindowState()
void VisibilityManager::hide()
{
if (KWindowSystem::isPlatformX11()) {
m_latteView->setVisible(false);
m_latteView->hide();
}
}
void VisibilityManager::show()
{
if (KWindowSystem::isPlatformX11()) {
m_latteView->setVisible(true);
m_latteView->show();
}
}