LibWeb+UI+WebContent: Pipe pinch events from AppKit UI to WebContent

This commit is contained in:
Aliaksandr Kalenik 2025-10-08 23:59:50 +02:00 committed by Alexander Kalenik
parent e6831003c6
commit c630de17ab
Notes: github-actions[bot] 2025-10-10 13:39:44 +00:00
10 changed files with 86 additions and 1 deletions

View file

@ -105,3 +105,19 @@ ErrorOr<Web::DragEvent> IPC::decode(Decoder& decoder)
return Web::DragEvent { type, position, screen_position, button, buttons, modifiers, move(files), nullptr };
}
template<>
WEB_API ErrorOr<void> IPC::encode(Encoder& encoder, Web::PinchEvent const& event)
{
TRY(encoder.encode(event.position));
TRY(encoder.encode(event.scale_delta));
return {};
}
template<>
WEB_API ErrorOr<Web::PinchEvent> IPC::decode(Decoder& decoder)
{
auto position = TRY(decoder.decode<Web::DevicePixelPoint>());
auto scale_delta = TRY(decoder.decode<double>());
return Web::PinchEvent { position, scale_delta };
}

View file

@ -85,7 +85,12 @@ struct WEB_API DragEvent {
OwnPtr<BrowserInputData> browser_data;
};
using InputEvent = Variant<KeyEvent, MouseEvent, DragEvent>;
struct WEB_API PinchEvent {
Web::DevicePixelPoint position;
double scale_delta;
};
using InputEvent = Variant<KeyEvent, MouseEvent, DragEvent, PinchEvent>;
struct QueuedInputEvent {
u64 page_id { 0 };
@ -115,4 +120,10 @@ WEB_API ErrorOr<void> encode(Encoder&, Web::DragEvent const&);
template<>
WEB_API ErrorOr<Web::DragEvent> decode(Decoder&);
template<>
WEB_API ErrorOr<void> encode(Encoder&, Web::PinchEvent const&);
template<>
WEB_API ErrorOr<Web::PinchEvent> decode(Decoder&);
}