1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:05:07 +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:
Andreas Kling 2021-01-09 11:01:41 +01:00
parent 3b94af2c07
commit 67b91d51a7
15 changed files with 32 additions and 26 deletions

View file

@ -589,11 +589,11 @@ String FileSystemModel::column_name(int column) const
ASSERT_NOT_REACHED();
}
bool FileSystemModel::accepts_drag(const ModelIndex& index, const StringView& data_type)
bool FileSystemModel::accepts_drag(const ModelIndex& index, const Vector<String>& mime_types)
{
if (!index.is_valid())
return false;
if (data_type != "text/uri-list")
if (!mime_types.contains_slow("text/uri-list"))
return false;
auto& node = this->node(index);
return node.is_directory();