mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
WindowServer+LibGUI: Pass the set of mime types being dragged to client
Previously the client would only learn the mime type of what was being dropped on it once the drop occurred. To enable more sophisticated filtering of drag & drop, we now pass along the list of mime types being dragged to the client with each MouseMove event. (Note that MouseMove is translated to the various Drag* events in LibGUI on the client side.)
This commit is contained in:
@@ -446,14 +446,14 @@ void Window::handle_drag_move_event(DragEvent& event)
|
||||
auto result = m_main_widget->hit_test(event.position());
|
||||
ASSERT(result.widget);
|
||||
|
||||
Application::the()->set_drag_hovered_widget({}, result.widget, result.local_position, event.data_type());
|
||||
Application::the()->set_drag_hovered_widget({}, result.widget, result.local_position, event.mime_types());
|
||||
|
||||
// NOTE: Setting the drag hovered widget may have executed arbitrary code, so re-check that the widget is still there.
|
||||
if (!result.widget)
|
||||
return;
|
||||
|
||||
if (result.widget->has_pending_drop()) {
|
||||
DragEvent drag_move_event(static_cast<Event::Type>(event.type()), result.local_position, event.data_type());
|
||||
DragEvent drag_move_event(static_cast<Event::Type>(event.type()), result.local_position, event.mime_types());
|
||||
result.widget->dispatch_event(drag_move_event, this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user