summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmevent.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmevent.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmevent.h43
1 files changed, 33 insertions, 10 deletions
diff --git a/src/plugins/platforms/wasm/qwasmevent.h b/src/plugins/platforms/wasm/qwasmevent.h
index 73bb28d267..bd0fb39f11 100644
--- a/src/plugins/platforms/wasm/qwasmevent.h
+++ b/src/plugins/platforms/wasm/qwasmevent.h
@@ -5,11 +5,12 @@
#define QWASMEVENT_H
#include "qwasmplatform.h"
+#include "qwasmdom.h"
#include <QtCore/qglobal.h>
#include <QtCore/qnamespace.h>
#include <QtGui/qevent.h>
-
+#include <private/qstdweb_p.h>
#include <QPoint>
#include <emscripten/html5.h>
@@ -18,8 +19,12 @@
QT_BEGIN_NAMESPACE
class QWasmDeadKeySupport;
+class QWindow;
enum class EventType {
+ DragEnd,
+ DragOver,
+ DragStart,
Drop,
KeyDown,
KeyUp,
@@ -28,11 +33,14 @@ enum class EventType {
PointerUp,
PointerEnter,
PointerLeave,
+ PointerCancel,
Wheel,
};
enum class PointerType {
Mouse,
+ Touch,
+ Pen,
Other,
};
@@ -117,15 +125,16 @@ QFlags<Qt::KeyboardModifier> getForEvent<EmscriptenKeyboardEvent>(
struct Event
{
- Event(EventType type, emscripten::val target);
+ Event(EventType type, emscripten::val webEvent);
~Event();
Event(const Event &other);
Event(Event &&other);
Event &operator=(const Event &other);
Event &operator=(Event &&other);
+ emscripten::val webEvent;
EventType type;
- emscripten::val target = emscripten::val::undefined();
+ emscripten::val target() const { return webEvent["target"]; }
};
struct KeyEvent : public Event
@@ -144,6 +153,7 @@ struct KeyEvent : public Event
QFlags<Qt::KeyboardModifier> modifiers;
bool deadKey;
QString text;
+ bool autoRepeat;
};
struct MouseEvent : public Event
@@ -190,9 +200,9 @@ struct MouseEvent : public Event
}
}
- QPoint localPoint;
- QPoint pointInPage;
- QPoint pointInViewport;
+ QPointF localPoint;
+ QPointF pointInPage;
+ QPointF pointInViewport;
Qt::MouseButton mouseButton;
Qt::MouseButtons mouseButtons;
QFlags<Qt::KeyboardModifier> modifiers;
@@ -211,21 +221,34 @@ struct PointerEvent : public MouseEvent
PointerType pointerType;
int pointerId;
+ qreal pressure;
+ qreal tiltX;
+ qreal tiltY;
+ qreal tangentialPressure;
+ qreal twist;
+ qreal width;
+ qreal height;
+ bool isPrimary;
};
struct DragEvent : public MouseEvent
{
- static std::optional<DragEvent> fromWeb(emscripten::val webEvent);
+ static std::optional<DragEvent> fromWeb(emscripten::val webEvent, QWindow *targetQWindow);
- DragEvent(EventType type, emscripten::val webEvent);
+ DragEvent(EventType type, emscripten::val webEvent, QWindow *targetQWindow);
~DragEvent();
DragEvent(const DragEvent &other);
DragEvent(DragEvent &&other);
DragEvent &operator=(const DragEvent &other);
DragEvent &operator=(DragEvent &&other);
+ void cancelDragStart();
+ void acceptDragOver();
+ void acceptDrop();
+
Qt::DropAction dropAction;
- emscripten::val dataTransfer;
+ dom::DataTransfer dataTransfer;
+ QWindow *targetWindow;
};
struct WheelEvent : public MouseEvent
@@ -241,7 +264,7 @@ struct WheelEvent : public MouseEvent
DeltaMode deltaMode;
bool webkitDirectionInvertedFromDevice;
- QPoint delta;
+ QPointF delta;
};
QT_END_NAMESPACE