5#ifndef QWAYLANDQUICKITEM_P_H
6#define QWAYLANDQUICKITEM_P_H
19#include <QtQuick/private/qquickitem_p.h>
20#include <QtQuick/QSGMaterialShader>
21#include <QtQuick/QSGMaterial>
23#include <QtWaylandCompositor/QWaylandQuickItem>
24#include <QtWaylandCompositor/QWaylandOutput>
26#include <QtCore/qpointer.h>
35class QWaylandBufferMaterialShader :
public QSGMaterialShader
38 QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format);
40 bool updateUniformData(RenderState &state,
41 QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
42 void updateSampledImage(RenderState &state,
int binding, QSGTexture **texture,
43 QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
44 void setupExternalOESShader(
const QString &shaderFilename);
47class QWaylandBufferMaterial :
public QSGMaterial
50 QWaylandBufferMaterial(QWaylandBufferRef::BufferFormatEgl format);
51 ~QWaylandBufferMaterial() override;
53 void setTextureForPlane(
int plane, QOpenGLTexture *texture, QSGTexture *scenegraphTexture);
54 void setBufferRef(QWaylandQuickItem *surfaceItem,
const QWaylandBufferRef &ref);
57 void updateScenegraphTextures(QRhi *rhi);
59 QSGMaterialType *type()
const override;
60 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode)
const override;
63 friend QWaylandBufferMaterialShader;
65 void setTextureParameters(GLenum target);
66 void ensureTextures(
int count);
68 const QWaylandBufferRef::BufferFormatEgl m_format;
69 QVarLengthArray<QOpenGLTexture*, 3> m_textures;
70 QVarLengthArray<QSGTexture*, 3> m_scenegraphTextures;
71 QWaylandBufferRef m_bufferRef;
77 Q_DECLARE_PUBLIC(QWaylandQuickItem)
83 Q_Q(QWaylandQuickItem);
87 view.reset(
new QWaylandView(q));
88 q->setFlag(QQuickItem::ItemHasContents);
95 QObject::connect(q, &QQuickItem::windowChanged, q, &QWaylandQuickItem::updateWindow);
96 QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::surfaceChanged);
97 QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::handleSurfaceChanged);
98 QObject::connect(view.data(), &QWaylandView::surfaceDestroyed, q, &QWaylandQuickItem::surfaceDestroyed);
99 QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::outputChanged);
100 QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::updateOutput);
101 QObject::connect(view.data(), &QWaylandView::bufferLockedChanged, q, &QWaylandQuickItem::bufferLockedChanged);
102 QObject::connect(view.data(), &QWaylandView::bufferLockedChanged, q, &QWaylandQuickItem::handleBufferLockedChanged);
103 QObject::connect(view.data(), &QWaylandView::allowDiscardFrontBufferChanged, q, &QWaylandQuickItem::allowDiscardFrontBufferChanged);
112 Q_Q(QWaylandQuickItem);
113 q->setAcceptedMouseButtons(enable ? (Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
114 Qt::ExtraButton1 | Qt::ExtraButton2 | Qt::ExtraButton3 | Qt::ExtraButton4 |
115 Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
116 Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
117 Qt::ExtraButton12 | Qt::ExtraButton13) : Qt::NoButton);
118 q->setAcceptTouchEvents(enable);
119 q->setAcceptHoverEvents(enable);
123 void handleDragEnded(QWaylandSeat *seat);
124 void handleDragUpdate(QWaylandSeat *seat,
const QPointF &globalPosition);
135 virtual void raise();
136 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
void reportCompositorDestroyed()
Combined button and popup list for selecting options.