1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-27 14:50:21 +03:00

fix major protocol fatal error on startup

This commit is contained in:
Michail Vourlakos 2021-12-18 21:41:09 +02:00
parent cdfbe6ecd1
commit 11550cd36d
6 changed files with 27 additions and 10 deletions

View File

@ -106,12 +106,11 @@ Corona::Corona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp, QString
//! create the window manager
if (KWindowSystem::isPlatformWayland()) {
m_wm = new WindowSystem::WaylandInterface(this);
setupWaylandIntegration();
} else {
m_wm = new WindowSystem::XWindowInterface(this);
}
setupWaylandIntegration();
KPackage::Package package(new Latte::Package(this));
m_screenPool->load();
@ -313,9 +312,9 @@ void Corona::setupWaylandIntegration()
Registry *registry{new Registry(this)};
registry->create(connection);
/* connect(registry, &Registry::plasmaShellAnnounced, this
/*connect(registry, &Registry::plasmaShellAnnounced, this
, [this, registry](quint32 name, quint32 version) {
m_waylandCorona = registry->createPlasmaShell(name, version, this);
m_waylandCorona = registry->createPlasmaShell(name, version, this);
});*/
QObject::connect(registry, &KWayland::Client::Registry::plasmaWindowManagementAnnounced,
@ -325,6 +324,7 @@ void Corona::setupWaylandIntegration()
WindowSystem::WaylandInterface *wI = qobject_cast<WindowSystem::WaylandInterface *>(m_wm);
if (wI) {
qDebug() << "org.kde.pwm ::: created...";
wI->initWindowManagement(pwm);
}
});

View File

@ -69,7 +69,6 @@ int main(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
}
const QByteArray oldShellIntegration = qgetenv("QT_WAYLAND_SHELL_INTEGRATION");
LayerShellQt::Shell::useLayerShell();
@ -422,12 +421,12 @@ int main(int argc, char **argv)
KCrash::setDrKonqiEnabled(true);
KCrash::setFlags(KCrash::AutoRestart | KCrash::AlwaysDirectly);
qDebug() << "Wayland Shell Integration:" << oldShellIntegration;
qputenv("QT_WAYLAND_SHELL_INTEGRATION", oldShellIntegration);
Latte::Corona corona(defaultLayoutOnStartup, layoutNameOnStartup, addViewTemplateNameOnStartup, memoryUsage);
KDBusService service(KDBusService::Unique);
qDebug() << oldShellIntegration;
qputenv("QT_WAYLAND_SHELL_INTEGRATION", oldShellIntegration);
return app.exec();
}

View File

@ -119,7 +119,8 @@ SubWindow::SubWindow(Latte::View *view, QString debugType) :
}
setScreen(m_latteView->screen());
show();
// disabled because it creates a major protocol error for Wayland::Layer Shell
// show();
hideWithMask();
}

View File

@ -25,6 +25,7 @@
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/surface.h>
#include <KWindowSystem>
#include <LayerShellQt/Window>
#define RELOCATIONSHOWINGEVENT "viewInRelocationShowing"
@ -854,6 +855,13 @@ void Positioner::updatePosition(QRect availableScreenRect)
}
}
auto layerWindow = LayerShellQt::Window::get(m_view);
layerWindow->setAnchors(LayerShellQt::Window::AnchorBottom);
layerWindow->setLayer(LayerShellQt::Window::LayerTop);
layerWindow->setMargins({0, 100, 0, 0});
qDebug() << "org.kde.layer ::: " << layerWindow->anchors() << " __ " << layerWindow->layer() << " :: " << m_validGeometry;
m_view->setPosition(position);
//if (m_view->surface()) {

View File

@ -48,6 +48,7 @@
#include <KActionCollection>
#include <KActivities/Consumer>
#include <KWindowSystem>
#include <LayerShellQt/Window>
// Plasma
#include <Plasma/Containment>
@ -74,6 +75,8 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassX11WM)
//this is disabled because under wayland breaks Views positioning
//setVisible(false);
setupWaylandIntegration();
//! needs to be created after Effects because it catches some of its signals
//! and avoid a crash from View::winId() at the same time
m_positioner = new ViewPart::Positioner(this);
@ -432,6 +435,10 @@ void View::availableScreenRectChangedFromSlot(View *origin)
void View::setupWaylandIntegration()
{
// auto layerWindow = LayerShellQt::Window::get(this);
// layerWindow->setAnchors(LayerShellQt::Window::AnchorBottom);
// layerWindow->setLayer(LayerShellQt::Window::LayerTop);
/* if (m_shellSurface)
return;
@ -1526,7 +1533,7 @@ bool View::event(QEvent *e)
case QEvent::PlatformSurface:
case QEvent::Expose:
return QQuickWindow::event(e);
// return QQuickWindow::event(e);
break;
case QEvent::Show:

View File

@ -1119,6 +1119,7 @@ void VisibilityManager::createEdgeGhostWindow()
{
if (!m_edgeGhostWindow) {
m_edgeGhostWindow = new ScreenEdgeGhostWindow(m_latteView);
m_edgeGhostWindow->show();
connect(m_edgeGhostWindow, &ScreenEdgeGhostWindow::containsMouseChanged, this, [ = ](bool contains) {
if (contains) {
@ -1173,6 +1174,7 @@ void VisibilityManager::createFloatingGapWindow()
{
if (!m_floatingGapWindow) {
m_floatingGapWindow = new FloatingGapWindow(m_latteView);
m_floatingGapWindow->show();
connect(m_floatingGapWindow, &FloatingGapWindow::asyncContainsMouseChanged, this, [ = ](bool contains) {
if (contains) {