diff options
Diffstat (limited to 'examples/wayland/qwindow-compositor/compositor.h')
-rw-r--r-- | examples/wayland/qwindow-compositor/compositor.h | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/examples/wayland/qwindow-compositor/compositor.h b/examples/wayland/qwindow-compositor/compositor.h index bf52c8c7e..ddc85c480 100644 --- a/examples/wayland/qwindow-compositor/compositor.h +++ b/examples/wayland/qwindow-compositor/compositor.h @@ -47,6 +47,7 @@ #include <QtWaylandCompositor/QWaylandWlShellSurface> #include <QtWaylandCompositor/QWaylandXdgSurfaceV5> #include <QTimer> +#include <QOpenGLTextureBlitter> QT_BEGIN_NAMESPACE @@ -54,33 +55,51 @@ class QWaylandWlShell; class QWaylandWlShellSurface; class QWaylandXdgShellV5; class QOpenGLTexture; +class Compositor; class View : public QWaylandView { Q_OBJECT public: - View(); + View(Compositor *compositor); QOpenGLTexture *getTexture(); + QOpenGLTextureBlitter::Origin textureOrigin() const; QPointF position() const { return m_position; } void setPosition(const QPointF &pos) { m_position = pos; } + QSize size() const; bool isCursor() const; bool hasShell() const { return m_wlShellSurface; } void setParentView(View *parent) { m_parentView = parent; } View *parentView() const { return m_parentView; } QPointF parentPosition() const { return m_parentView ? (m_parentView->position() + m_parentView->parentPosition()) : QPointF(); } - QSize windowSize() { return m_xdgSurface ? m_xdgSurface->windowGeometry().size() : surface()->size(); } + QSize windowSize() { return m_xdgSurface ? m_xdgSurface->windowGeometry().size() : surface() ? surface()->size() : m_size; } QPoint offset() const { return m_offset; } + qreal animationFactor() const {return m_animationFactor; } + void setAnimationFactor(qreal f) {m_animationFactor = f; } + +signals: + void animationDone(); + +protected: + void timerEvent(QTimerEvent *event); + private: friend class Compositor; + Compositor *m_compositor; GLenum m_textureTarget; QOpenGLTexture *m_texture; + QOpenGLTextureBlitter::Origin m_origin; QPointF m_position; + QSize m_size; QWaylandWlShellSurface *m_wlShellSurface; QWaylandXdgSurfaceV5 *m_xdgSurface; QWaylandXdgPopupV5 *m_xdgPopup; View *m_parentView; QPoint m_offset; + qreal m_animationFactor; + QBasicTimer m_animationTimer; + bool m_animationCountUp; public slots: void onXdgSetMaximized(); @@ -88,6 +107,9 @@ public slots: void onXdgSetFullscreen(QWaylandOutput *output); void onXdgUnsetFullscreen(); void onOffsetForNextFrame(const QPoint &offset); + + void startAnimation(bool countUp); + void cancelAnimation(); }; class Compositor : public QWaylandCompositor @@ -96,7 +118,7 @@ class Compositor : public QWaylandCompositor public: Compositor(QWindow *window); ~Compositor(); - void create() Q_DECL_OVERRIDE; + void create() override; void startRender(); void endRender(); @@ -119,6 +141,9 @@ signals: void dragStarted(View *dragIcon); void frameOffset(const QPoint &offset); +public slots: + void triggerRender(); + private slots: void surfaceHasContentChanged(); void surfaceDestroyed(); @@ -129,7 +154,6 @@ private slots: void startDrag(); - void triggerRender(); void onSurfaceCreated(QWaylandSurface *surface); void onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface); @@ -143,6 +167,7 @@ private slots: void onSubsurfacePositionChanged(const QPoint &position); void updateCursor(); + void viewAnimationDone(); private: View *findView(const QWaylandSurface *s) const; QWindow *m_window; |