summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandquickitem_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/compositor_api/qwaylandquickitem_p.h')
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h78
1 files changed, 26 insertions, 52 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h
index 1be2ed8ab..0ddabc7da 100644
--- a/src/compositor/compositor_api/qwaylandquickitem_p.h
+++ b/src/compositor/compositor_api/qwaylandquickitem_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKITEM_P_H
#define QWAYLANDQUICKITEM_P_H
@@ -58,6 +22,8 @@
#include <QtWaylandCompositor/QWaylandQuickItem>
#include <QtWaylandCompositor/QWaylandOutput>
+#include <QtCore/qpointer.h>
+
QT_BEGIN_NAMESPACE
class QWaylandSurfaceTextureProvider;
@@ -70,17 +36,11 @@ class QWaylandBufferMaterialShader : public QSGMaterialShader
public:
QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format);
- void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
- char const *const *attributeNames() const override;
-
-protected:
- void initialize() override;
-
-private:
- const QWaylandBufferRef::BufferFormatEgl m_format;
- int m_id_matrix;
- int m_id_opacity;
- QVarLengthArray<int, 3> m_id_tex;
+ bool updateUniformData(RenderState &state,
+ QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
+ QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ void setupExternalOESShader(const QString &shaderFilename);
};
class QWaylandBufferMaterial : public QSGMaterial
@@ -89,19 +49,25 @@ public:
QWaylandBufferMaterial(QWaylandBufferRef::BufferFormatEgl format);
~QWaylandBufferMaterial() override;
- void setTextureForPlane(int plane, QOpenGLTexture *texture);
+ void setTextureForPlane(int plane, QOpenGLTexture *texture, QSGTexture *scenegraphTexture);
+ void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref);
void bind();
+ void updateScenegraphTextures(QRhi *rhi);
QSGMaterialType *type() const override;
- QSGMaterialShader *createShader() const override;
+ QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
private:
+ friend QWaylandBufferMaterialShader;
+
void setTextureParameters(GLenum target);
void ensureTextures(int count);
const QWaylandBufferRef::BufferFormatEgl m_format;
QVarLengthArray<QOpenGLTexture*, 3> m_textures;
+ QVarLengthArray<QSGTexture*, 3> m_scenegraphTextures;
+ QWaylandBufferRef m_bufferRef;
};
#endif // QT_CONFIG(opengl)
@@ -147,6 +113,7 @@ public:
Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
Qt::ExtraButton12 | Qt::ExtraButton13) : Qt::NoButton);
+ q->setAcceptTouchEvents(enable);
q->setAcceptHoverEvents(enable);
inputEventsEnabled = enable;
}
@@ -160,11 +127,15 @@ public:
void placeAboveParent();
void placeBelowParent();
+ virtual void raise();
+ virtual void lower();
+
static QMutex *mutex;
QScopedPointer<QWaylandView> view;
QPointer<QWaylandSurface> oldSurface;
mutable QWaylandSurfaceTextureProvider *provider = nullptr;
+ QMetaObject::Connection texProviderConnection;
bool paintEnabled = true;
bool touchEventsEnabled = true;
bool inputEventsEnabled = true;
@@ -172,6 +143,9 @@ public:
bool newTexture = false;
bool focusOnClick = true;
bool belowParent = false;
+#if QT_CONFIG(opengl)
+ bool paintByProvider = false;
+#endif
QPointF hoverPos;
QMatrix4x4 lastMatrix;
@@ -179,7 +153,7 @@ public:
QWaylandOutput *connectedOutput = nullptr;
QWaylandSurface::Origin origin = QWaylandSurface::OriginTopLeft;
QPointer<QObject> subsurfaceHandler;
- QVector<QWaylandSeat *> touchingSeats;
+ QList<QWaylandSeat *> touchingSeats;
};
QT_END_NAMESPACE