4#ifndef QWAYLANDQUICKITEM_P_H
5#define QWAYLANDQUICKITEM_P_H
18#include <QtQuick/private/qquickitem_p.h>
19#include <QtQuick/QSGMaterialShader>
20#include <QtQuick/QSGMaterial>
22#include <QtWaylandCompositor/QWaylandQuickItem>
23#include <QtWaylandCompositor/QWaylandOutput>
25#include <QtCore/qpointer.h>
34class QWaylandBufferMaterialShader :
public QSGMaterialShader
37 QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format);
39 bool updateUniformData(RenderState &state,
40 QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
41 void updateSampledImage(RenderState &state,
int binding, QSGTexture **texture,
42 QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
43 void setupExternalOESShader(
const QString &shaderFilename);
46class QWaylandBufferMaterial :
public QSGMaterial
49 QWaylandBufferMaterial(QWaylandBufferRef::BufferFormatEgl format);
50 ~QWaylandBufferMaterial() override;
52 void setTextureForPlane(
int plane, QOpenGLTexture *texture, QSGTexture *scenegraphTexture);
53 void setBufferRef(QWaylandQuickItem *surfaceItem,
const QWaylandBufferRef &ref);
56 void updateScenegraphTextures(QRhi *rhi);
58 QSGMaterialType *type()
const override;
59 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode)
const override;
62 friend QWaylandBufferMaterialShader;
64 void setTextureParameters(GLenum target);
65 void ensureTextures(
int count);
67 const QWaylandBufferRef::BufferFormatEgl m_format;
68 QVarLengthArray<QOpenGLTexture*, 3> m_textures;
69 QVarLengthArray<QSGTexture*, 3> m_scenegraphTextures;
70 QWaylandBufferRef m_bufferRef;
76 Q_DECLARE_PUBLIC(QWaylandQuickItem)
82 Q_Q(QWaylandQuickItem);
86 view.reset(
new QWaylandView(q));
87 q->setFlag(QQuickItem::ItemHasContents);
94 QObject::connect(q, &QQuickItem::windowChanged, q, &QWaylandQuickItem::updateWindow);
95 QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::surfaceChanged);
96 QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::handleSurfaceChanged);
97 QObject::connect(view.data(), &QWaylandView::surfaceDestroyed, q, &QWaylandQuickItem::surfaceDestroyed);
98 QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::outputChanged);
99 QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::updateOutput);
100 QObject::connect(view.data(), &QWaylandView::bufferLockedChanged, q, &QWaylandQuickItem::bufferLockedChanged);
101 QObject::connect(view.data(), &QWaylandView::allowDiscardFrontBufferChanged, q, &QWaylandQuickItem::allowDiscardFrontBuffer);
110 Q_Q(QWaylandQuickItem);
111 q->setAcceptedMouseButtons(enable ? (Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
112 Qt::ExtraButton1 | Qt::ExtraButton2 | Qt::ExtraButton3 | Qt::ExtraButton4 |
113 Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
114 Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
115 Qt::ExtraButton12 | Qt::ExtraButton13) : Qt::NoButton);
116 q->setAcceptTouchEvents(enable);
117 q->setAcceptHoverEvents(enable);
121 void handleDragEnded(QWaylandSeat *seat);
122 void handleDragUpdate(QWaylandSeat *seat,
const QPointF &globalPosition);
133 virtual void raise();
134 virtual void lower();
QWaylandQuickItem * findSibling(QWaylandSurface *surface) const
qreal scaleFactor() const
void setInputEventsEnabled(bool enable)
QQuickWindow * connectedWindow
QWaylandSurface::Origin origin
QScopedPointer< QWaylandView > view
QWaylandOutput * connectedOutput
QPointer< QObject > subsurfaceHandler
QMetaObject::Connection texProviderConnection
bool shouldSendInputEvents() const
void placeBelowSibling(QWaylandQuickItem *sibling)
void placeAboveSibling(QWaylandQuickItem *sibling)
QWaylandSurfaceTextureProvider * provider
QList< QWaylandSeat * > touchingSeats
static const QWaylandQuickItemPrivate * get(const QWaylandQuickItem *item)
QPointer< QWaylandSurface > oldSurface
QWaylandSurfaceTextureProvider()
QSGTexture * texture() const override
Returns a pointer to the texture object.
void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &buffer)
void setSmooth(bool smooth)
~QWaylandSurfaceTextureProvider() override
Combined button and popup list for selecting options.