mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb+LibWebView+WebContent: Add IPC to send drag-and-drop events
This adds the IPC and related hooks to allow the UI to send drag-and- drop events from the UI process to the WebContent process.
This commit is contained in:
committed by
Andreas Kling
parent
4bb9168712
commit
948b6de3b1
@@ -137,6 +137,12 @@ void ViewImplementation::enqueue_input_event(Web::InputEvent event)
|
||||
},
|
||||
[this](Web::MouseEvent const& event) {
|
||||
client().async_mouse_event(m_client_state.page_index, event.clone_without_chrome_data());
|
||||
},
|
||||
[this](Web::DragEvent& event) {
|
||||
auto cloned_event = event.clone_without_chrome_data();
|
||||
cloned_event.files = move(event.files);
|
||||
|
||||
client().async_drag_event(m_client_state.page_index, move(cloned_event));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,14 +150,21 @@ void ViewImplementation::did_finish_handling_input_event(Badge<WebContentClient>
|
||||
{
|
||||
auto event = m_pending_input_events.dequeue();
|
||||
|
||||
if (!event_was_accepted && event.has<Web::KeyEvent>()) {
|
||||
auto const& key_event = event.get<Web::KeyEvent>();
|
||||
if (event_was_accepted)
|
||||
return;
|
||||
|
||||
// Here we handle events that were not consumed or cancelled by the WebContent. Propagate the event back
|
||||
// to the concrete view implementation.
|
||||
if (on_finish_handling_key_event)
|
||||
on_finish_handling_key_event(key_event);
|
||||
}
|
||||
// Here we handle events that were not consumed or cancelled by the WebContent. Propagate the event back
|
||||
// to the concrete view implementation.
|
||||
event.visit(
|
||||
[this](Web::KeyEvent const& event) {
|
||||
if (on_finish_handling_key_event)
|
||||
on_finish_handling_key_event(event);
|
||||
},
|
||||
[this](Web::DragEvent const& event) {
|
||||
if (on_finish_handling_drag_event)
|
||||
on_finish_handling_drag_event(event);
|
||||
},
|
||||
[](auto const&) {});
|
||||
}
|
||||
|
||||
void ViewImplementation::set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme)
|
||||
|
||||
Reference in New Issue
Block a user