summaryrefslogtreecommitdiff
path: root/tests/manual/wip-cpp-compositor/window.h
blob: 5d49aa1baaaf0cb8d43676d46d950b7684fd9221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef WINDOW_H
#define WINDOW_H

#include <QOpenGLWindow>
#include <QOpenGLTextureBlitter>

QT_BEGIN_NAMESPACE

class Compositor;
class QWaylandOutput;

class Window : public QOpenGLWindow
{
public:
    explicit Window(Compositor *compositor);

protected:
    void initializeGL() override;
    void paintGL() override;

    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
#if QT_CONFIG(wheelevent)
    void wheelEvent(QWheelEvent *event) override;
#endif

    void keyPressEvent(QKeyEvent *event) override;
    void keyReleaseEvent(QKeyEvent *event) override;

private:
    QOpenGLTextureBlitter m_textureBlitter;
    Compositor *m_compositor = nullptr;
    QWaylandOutput *m_output = nullptr;
};

QT_END_NAMESPACE

#endif //WINDOW_H