Skip to content

[RFC] mac: fix open file from finder and clean ups#18225

Open
Akemi wants to merge 5 commits into
mpv-player:masterfrom
Akemi:mac_open_file
Open

[RFC] mac: fix open file from finder and clean ups#18225
Akemi wants to merge 5 commits into
mpv-player:masterfrom
Akemi:mac_open_file

Conversation

@Akemi

@Akemi Akemi commented Jul 5, 2026

Copy link
Copy Markdown
Member

this exposes the handle_dnd function. i am not sure if this is the best way to expose it and it might also cause deadlocks like this(?). @na-na-hi @kasper93 it would be nice to have your input on this, how it should be exposed and where it might reside in the end.

clean up the discrepancies between dnd and file open events. there are 4 cases that open files that use the dnd function:

  • open file/url menu entry
  • d'n'd various types on the window (string, urls, files, etc)
  • opening via finder/open with
  • d'n'd on dock icon (when already open, when still closed)

the latter two can not be distinguished since they are handled by the same internal mechanism without any reference from where the event was started. hence why the dnd on dock icon won't/can't be handled as a dnd event anymore. the menu items where moved to the new open file function and only the dnd on the window is now handled by the internal dnd function.

consequently, all dnd options only influence the dnd on windows case from the future and how it was intended.

Fixes #17921

expose this function so it can be reused internally without the need
of the dnd option handling and as a generic file open function with some
special file type handling.

similar to the mp_input_drop_files function.
@Akemi Akemi added this to the Release v0.42.0 milestone Jul 5, 2026
Akemi added 4 commits July 5, 2026 12:41
make it reusable so the generic file logic can be reused, but handled by
different underlying similar function, like dnd or just open file.
the old dnd open file mechanism was reworked with 81611b4
and isn't ready to handle open file events as early as needed anymore.
additionally it also handles dnd options that would prevent loading
of files in the case of not dnded files, which doesn't make much sense.

sadly the macOS system file event exposes two different cases, open from
finder and dnd on the dock icon. this can't be distinguished in any way.
hence it was decided that dnd on the dock icon will be handled like a
generic file open event now and only dnd on the window will be a proper
dnd action.

use the newly added open file function to circumvent the dnd option
handling in those cases.

Fixes mpv-player#17921
the open file menu items aren't dnd events and should not be treated
as such.
rename this function to represent better what it does. dnd events should
be handled by this one. generic open file events should be handled by
the newly introduced function in the apphub, with the same old name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

won't play when launched from Finder

1 participant