mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
x11, input: move mime type drag&drop negotiation to common code
Drag&drop mechanisms typically support multiple types for the drop data. Move most of the logic which types are accepted and preferred to event.c, where the data is also interpreted. (Maybe sorting the types by assigning scores is over-engineered, since they're already sorted by preference, but it's actually not much more code.) Not very interesting/meaningful yet, but preparation for the next commit.
This commit is contained in:
@@ -32,3 +32,8 @@ void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files,
|
||||
// Returns <0 on error, ==0 if data was ok but empty, >0 on success.
|
||||
int mp_event_drop_mime_data(struct input_ctx *ictx, const char *mime_type,
|
||||
bstr data, enum mp_dnd_action append);
|
||||
|
||||
// Many drag & drop APIs support multiple mime types, and this function returns
|
||||
// whether a type is preferred (higher integer score), or supported (scores
|
||||
// below 0 indicate unsupported types).
|
||||
int mp_event_get_mime_type_score(struct input_ctx *ictx, const char *mime_type);
|
||||
|
||||
Reference in New Issue
Block a user