wayland: Adapt to subsurface changes in kwayland-server
parent
e8162aa79b
commit
b9cbf3647e
|
@ -1320,7 +1320,7 @@ QModelIndex SurfaceTreeModel::index(int row, int column, const QModelIndex &pare
|
|||
if (SurfaceInterface *surface = static_cast<SurfaceInterface*>(parent.internalPointer())) {
|
||||
const auto &children = surface->childSubSurfaces();
|
||||
if (row < children.count()) {
|
||||
return createIndex(row, column, children.at(row)->surface().data());
|
||||
return createIndex(row, column, children.at(row)->surface());
|
||||
}
|
||||
}
|
||||
return QModelIndex();
|
||||
|
@ -1346,11 +1346,11 @@ QModelIndex SurfaceTreeModel::parent(const QModelIndex &child) const
|
|||
using namespace KWaylandServer;
|
||||
if (SurfaceInterface *surface = static_cast<SurfaceInterface*>(child.internalPointer())) {
|
||||
const auto &subsurface = surface->subSurface();
|
||||
if (subsurface.isNull()) {
|
||||
if (!subsurface) {
|
||||
// doesn't reference a subsurface, this is a top-level window
|
||||
return QModelIndex();
|
||||
}
|
||||
SurfaceInterface *parent = subsurface->parentSurface().data();
|
||||
SurfaceInterface *parent = subsurface->parentSurface();
|
||||
if (!parent) {
|
||||
// something is wrong
|
||||
return QModelIndex();
|
||||
|
@ -1358,13 +1358,13 @@ QModelIndex SurfaceTreeModel::parent(const QModelIndex &child) const
|
|||
// is the parent a subsurface itself?
|
||||
if (parent->subSurface()) {
|
||||
auto grandParent = parent->subSurface()->parentSurface();
|
||||
if (grandParent.isNull()) {
|
||||
if (!grandParent) {
|
||||
// something is wrong
|
||||
return QModelIndex();
|
||||
}
|
||||
const auto &children = grandParent->childSubSurfaces();
|
||||
for (int row = 0; row < children.count(); row++) {
|
||||
if (children.at(row).data() == parent->subSurface().data()) {
|
||||
if (children.at(row) == parent->subSurface()) {
|
||||
return createIndex(row, 0, parent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1600,7 +1600,7 @@ OpenGLWindowPixmap::OpenGLWindowPixmap(Scene::Window *window, SceneOpenGL* scene
|
|||
{
|
||||
}
|
||||
|
||||
OpenGLWindowPixmap::OpenGLWindowPixmap(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface, WindowPixmap *parent, SceneOpenGL *scene)
|
||||
OpenGLWindowPixmap::OpenGLWindowPixmap(KWaylandServer::SubSurfaceInterface *subSurface, WindowPixmap *parent, SceneOpenGL *scene)
|
||||
: WindowPixmap(subSurface, parent)
|
||||
, m_texture(scene->createTexture())
|
||||
, m_scene(scene)
|
||||
|
@ -1640,7 +1640,7 @@ bool OpenGLWindowPixmap::bind()
|
|||
// mipmaps need to be updated
|
||||
m_texture->setDirty();
|
||||
}
|
||||
if (subSurface().isNull()) {
|
||||
if (!subSurface()) {
|
||||
toplevel()->resetDamage();
|
||||
}
|
||||
// also bind all children
|
||||
|
@ -1659,7 +1659,7 @@ bool OpenGLWindowPixmap::bind()
|
|||
bool success = m_texture->load(this);
|
||||
|
||||
if (success) {
|
||||
if (subSurface().isNull()) {
|
||||
if (!subSurface()) {
|
||||
toplevel()->resetDamage();
|
||||
}
|
||||
} else
|
||||
|
@ -1667,7 +1667,7 @@ bool OpenGLWindowPixmap::bind()
|
|||
return success;
|
||||
}
|
||||
|
||||
WindowPixmap *OpenGLWindowPixmap::createChild(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface)
|
||||
WindowPixmap *OpenGLWindowPixmap::createChild(KWaylandServer::SubSurfaceInterface *subSurface)
|
||||
{
|
||||
return new OpenGLWindowPixmap(subSurface, this, m_scene);
|
||||
}
|
||||
|
|
|
@ -210,9 +210,9 @@ public:
|
|||
bool bind();
|
||||
bool isValid() const override;
|
||||
protected:
|
||||
WindowPixmap *createChild(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface) override;
|
||||
WindowPixmap *createChild(KWaylandServer::SubSurfaceInterface *subSurface) override;
|
||||
private:
|
||||
explicit OpenGLWindowPixmap(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface, WindowPixmap *parent, SceneOpenGL *scene);
|
||||
explicit OpenGLWindowPixmap(KWaylandServer::SubSurfaceInterface *subSurface, WindowPixmap *parent, SceneOpenGL *scene);
|
||||
QScopedPointer<SceneOpenGLTexture> m_texture;
|
||||
SceneOpenGL *m_scene;
|
||||
};
|
||||
|
|
|
@ -376,7 +376,7 @@ QPainterWindowPixmap::QPainterWindowPixmap(Scene::Window *window)
|
|||
{
|
||||
}
|
||||
|
||||
QPainterWindowPixmap::QPainterWindowPixmap(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface, WindowPixmap *parent)
|
||||
QPainterWindowPixmap::QPainterWindowPixmap(KWaylandServer::SubSurfaceInterface *subSurface, WindowPixmap *parent)
|
||||
: WindowPixmap(subSurface, parent)
|
||||
{
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ void QPainterWindowPixmap::create()
|
|||
}
|
||||
}
|
||||
|
||||
WindowPixmap *QPainterWindowPixmap::createChild(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface)
|
||||
WindowPixmap *QPainterWindowPixmap::createChild(KWaylandServer::SubSurfaceInterface *subSurface)
|
||||
{
|
||||
return new QPainterWindowPixmap(subSurface, this);
|
||||
}
|
||||
|
|
|
@ -72,9 +72,9 @@ public:
|
|||
const QImage &image();
|
||||
|
||||
protected:
|
||||
WindowPixmap *createChild(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface) override;
|
||||
WindowPixmap *createChild(KWaylandServer::SubSurfaceInterface *subSurface) override;
|
||||
private:
|
||||
explicit QPainterWindowPixmap(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface, WindowPixmap *parent);
|
||||
explicit QPainterWindowPixmap(KWaylandServer::SubSurfaceInterface *subSurface, WindowPixmap *parent);
|
||||
QImage m_image;
|
||||
};
|
||||
|
||||
|
|
13
scene.cpp
13
scene.cpp
|
@ -1198,7 +1198,7 @@ WindowPixmap::WindowPixmap(Scene::Window *window)
|
|||
{
|
||||
}
|
||||
|
||||
WindowPixmap::WindowPixmap(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface, WindowPixmap *parent)
|
||||
WindowPixmap::WindowPixmap(KWaylandServer::SubSurfaceInterface *subSurface, WindowPixmap *parent)
|
||||
: m_window(parent->m_window)
|
||||
, m_pixmap(XCB_PIXMAP_NONE)
|
||||
, m_discarded(false)
|
||||
|
@ -1291,7 +1291,7 @@ void WindowPixmap::update()
|
|||
QVector<WindowPixmap*> children;
|
||||
const auto subSurfaces = s->childSubSurfaces();
|
||||
for (const auto &subSurface : subSurfaces) {
|
||||
if (subSurface.isNull()) {
|
||||
if (!subSurface) {
|
||||
continue;
|
||||
}
|
||||
auto it = std::find_if(oldTree.begin(), oldTree.end(), [subSurface] (WindowPixmap *p) { return p->m_subSurface == subSurface; });
|
||||
|
@ -1323,7 +1323,7 @@ void WindowPixmap::update()
|
|||
}
|
||||
}
|
||||
|
||||
WindowPixmap *WindowPixmap::createChild(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface)
|
||||
WindowPixmap *WindowPixmap::createChild(KWaylandServer::SubSurfaceInterface *subSurface)
|
||||
{
|
||||
Q_UNUSED(subSurface)
|
||||
return nullptr;
|
||||
|
@ -1342,10 +1342,15 @@ bool WindowPixmap::isRoot() const
|
|||
return !m_parent;
|
||||
}
|
||||
|
||||
KWaylandServer::SubSurfaceInterface *WindowPixmap::subSurface() const
|
||||
{
|
||||
return m_subSurface;
|
||||
}
|
||||
|
||||
KWaylandServer::SurfaceInterface *WindowPixmap::surface() const
|
||||
{
|
||||
if (!m_subSurface.isNull()) {
|
||||
return m_subSurface->surface().data();
|
||||
return m_subSurface->surface();
|
||||
} else {
|
||||
return toplevel()->surface();
|
||||
}
|
||||
|
|
8
scene.h
8
scene.h
|
@ -566,9 +566,7 @@ public:
|
|||
/**
|
||||
* @returns the subsurface this WindowPixmap is for if it is not for a root window
|
||||
*/
|
||||
QPointer<KWaylandServer::SubSurfaceInterface> subSurface() const {
|
||||
return m_subSurface;
|
||||
}
|
||||
KWaylandServer::SubSurfaceInterface *subSurface() const;
|
||||
|
||||
/**
|
||||
* @returns the surface this WindowPixmap references, might be @c null.
|
||||
|
@ -577,8 +575,8 @@ public:
|
|||
|
||||
protected:
|
||||
explicit WindowPixmap(Scene::Window *window);
|
||||
explicit WindowPixmap(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface, WindowPixmap *parent);
|
||||
virtual WindowPixmap *createChild(const QPointer<KWaylandServer::SubSurfaceInterface> &subSurface);
|
||||
explicit WindowPixmap(KWaylandServer::SubSurfaceInterface *subSurface, WindowPixmap *parent);
|
||||
virtual WindowPixmap *createChild(KWaylandServer::SubSurfaceInterface *subSurface);
|
||||
/**
|
||||
* @return The Window this WindowPixmap belongs to
|
||||
*/
|
||||
|
|
|
@ -483,7 +483,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags
|
|||
|
||||
m_xdgOutputManagerV1 = m_display->createXdgOutputManagerV1(m_display);
|
||||
|
||||
m_display->createSubCompositor(m_display)->create();
|
||||
m_display->createSubCompositor(m_display);
|
||||
|
||||
m_XdgForeign = m_display->createXdgForeignV2Interface(m_display);
|
||||
|
||||
|
|
Loading…
Reference in New Issue