summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmwindowclientarea.h
blob: f2fd115e25b2ea45310c47d9c405f0e5e23ae5e0 (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) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef QWASMWINDOWCLIENTAREA_H
#define QWASMWINDOWCLIENTAREA_H

#include <QtCore/qnamespace.h>

#include <emscripten/val.h>

#include <memory>

QT_BEGIN_NAMESPACE

namespace qstdweb {
class EventCallback;
}

struct PointerEvent;
class QWasmScreen;
class QWasmWindow;

class ClientArea
{
public:
    ClientArea(QWasmWindow *window, QWasmScreen *screen, emscripten::val element);

private:
    bool processPointer(const PointerEvent &event);
    bool deliverEvent(const PointerEvent &event);

    std::unique_ptr<qstdweb::EventCallback> m_pointerDownCallback;
    std::unique_ptr<qstdweb::EventCallback> m_pointerMoveCallback;
    std::unique_ptr<qstdweb::EventCallback> m_pointerUpCallback;

    QWasmScreen *m_screen;
    QWasmWindow *m_window;
    emscripten::val m_element;
};

QT_END_NAMESPACE
#endif // QWASMWINDOWNONCLIENTAREA_H