[RFC] mac: fix open file from finder and clean ups - #18225
Conversation
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.
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.
|
Note that |
Why do we need to disect DnD? Why can't loadfile command be used? |
I prefer that too, and I have already suggested using loadfile #17921 (comment). |
because prior to the recent dnd change the mechanism was also used for other things on macOS (dnd on dock icon and open from finder, as an example). this change caused some regressions and using loadfile won't restore the same behaviour as before. see my comment here. so either we take those previous wanted/intended features away and live with that regression, or we restore to the previous behaviour. i would prefer the latter. in most cases we wouldn't remove features or change wanted behaviours like this. |
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:
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