summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmevent.h
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-12-23 12:48:13 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2023-01-22 23:24:01 +0100
commitc54416a06ce25a97de463803a489762c44926cef (patch)
treebdbe65934d530bdb6a6ef491134b6c57780f6f91 /src/plugins/platforms/wasm/qwasmevent.h
parent5d356ae2bd57a92fbe041944849627ee511efc5a (diff)
Handle the wheel event in the wasm window
Align the wheel event handling with other events - move the handler to wasm window and create a C++ wrapper class for the js wheel event. Fixes: QTBUG-109622 Change-Id: I915e502de7c0784ec9a6745a90ddcda062e91b2b Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmevent.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmevent.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmevent.h b/src/plugins/platforms/wasm/qwasmevent.h
index 215d06bae5..e8aea9072e 100644
--- a/src/plugins/platforms/wasm/qwasmevent.h
+++ b/src/plugins/platforms/wasm/qwasmevent.h
@@ -24,6 +24,7 @@ enum class EventType {
PointerUp,
PointerEnter,
PointerLeave,
+ Wheel,
};
enum class PointerType {
@@ -36,6 +37,8 @@ enum class WindowArea {
Client,
};
+enum class DeltaMode { Pixel, Line, Page };
+
namespace KeyboardModifier {
namespace internal
{
@@ -203,6 +206,22 @@ struct DragEvent : public MouseEvent
emscripten::val dataTransfer;
};
+struct WheelEvent : public MouseEvent
+{
+ static std::optional<WheelEvent> fromWeb(emscripten::val webEvent);
+
+ WheelEvent(EventType type, emscripten::val webEvent);
+ ~WheelEvent();
+ WheelEvent(const WheelEvent &other);
+ WheelEvent(WheelEvent &&other);
+ WheelEvent &operator=(const WheelEvent &other);
+ WheelEvent &operator=(WheelEvent &&other);
+
+ DeltaMode deltaMode;
+ bool webkitDirectionInvertedFromDevice;
+ QPoint delta;
+};
+
QT_END_NAMESPACE
#endif // QWASMEVENT_H