我正在尝试使用此处找到的示例创建一个非常简单的 Wayland 合成器,如下所示:
import QtQuick 2.12
import QtQuick.Window 2.2
import QtWayland.Compositor 1.3
WaylandCompositor {
id: wlcompositor
WaylandOutput {
compositor: wlcompositor
window: Window {
width: 800
height: 480
visible: true
title: wlcompositor.socketName
Grid {
anchors.fill: parent
anchors.margins: 100
columns: 2
Repeater {
model: shellSurfaces
ShellSurfaceItem {
id: shellSurfaceItem
autoCreatePopupItems: true
shellSurface: modelData
onSurfaceDestroyed: shellSurfaces.remove(index)
}
}
}
}
}
ListModel { id: shellSurfaces }
XdgShell {
onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface})
}
}
然后我正在创建一个单独的客户端应用程序,它只创建几个矩形作为测试。
import QtQuick 2.12
import QtQuick.Window 2.12
Window
{
id: window
visible: true
width: 200
height: 200
Rectangle
{
anchors.fill: parent
color: "green"
Rectangle
{
x: 10
y: 10
width: 100
height: 100
color: "blue"
}
}
}
一切似乎都简单明了。但是当我在我的 Pi4 上运行它(使用-platform wayland
标志)时,客户端会出现疯狂的失真,如下所示:
我正在使用 Boot2Qt 对其进行测试,它是一个 yocto linux 映像。我已经尝试过 Qt 版本 5.14.2 和最新的 5.15.0,结果相同。控制台上没有错误。除了看起来很糟糕之外,没有任何迹象表明有任何问题。
我确实注意到,如果我使用 weston 而不是 QtWayland 作为我的合成器,那么该应用程序看起来很完美。所以这让我觉得 WaylandCompositor 有问题。但是我在谷歌上的搜索发现没有其他人抱怨同样的事情。
我什至不知道该尝试什么。有人有什么想法吗?