diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2020-03-20 22:34:51 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2020-03-20 22:34:51 +0000 |
commit | 543ddcd795ba2fa44676b59135a745f51f28a8da (patch) | |
tree | 5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /wx+/file_drop.cpp | |
parent | Merge branch '10.20' into 'master' (diff) | |
parent | add upstream 10.21 (diff) | |
download | FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.gz FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.bz2 FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.zip |
Merge branch '10.21' into 'master'10.21
add upstream 10.21
See merge request opensource-tracking/FreeFileSync!18
Diffstat (limited to 'wx+/file_drop.cpp')
-rw-r--r-- | wx+/file_drop.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/wx+/file_drop.cpp b/wx+/file_drop.cpp index 65d5d861..938f9dbd 100644 --- a/wx+/file_drop.cpp +++ b/wx+/file_drop.cpp @@ -23,9 +23,23 @@ namespace class WindowDropTarget : public wxFileDropTarget { public: - WindowDropTarget(wxWindow& dropWindow) : dropWindow_(dropWindow) {} + WindowDropTarget(const wxWindow& dropWindow) : dropWindow_(dropWindow) {} private: + wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) override + { + //why the FUCK I is drag & drop still working while showing another modal dialog!??? + //why the FUCK II is drag & drop working even when dropWindow is disabled!?? [Windows] => we can fix this + //why the FUCK III is dropWindow NOT disabled while showing another modal dialog!??? [macOS, Linux] => we CANNOT fix this: FUUUUUUUUUUUUUU... + if (!dropWindow_.IsEnabled()) + return wxDragNone; + + return wxFileDropTarget::OnDragOver(x, y, def); + } + + //"bool wxDropTarget::GetData() [...] This method may only be called from within OnData()." + //=> FUUUUUUUUUUUUUU........ a.k.a. no support for DragDropValidator during mouse hover! >:( + bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& fileArray) override { /*Linux, MTP: we get an empty file array @@ -35,6 +49,9 @@ private: /run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C002%5D/Telefonspeicher/Folder/file.txt */ + if (!dropWindow_.IsEnabled()) + return false; + //wxPoint clientDropPos(x, y) std::vector<Zstring> filePaths; for (const wxString& file : fileArray) @@ -46,12 +63,12 @@ private: return true; } - wxWindow& dropWindow_; + const wxWindow& dropWindow_; }; } -void zen::setupFileDrop(wxWindow& wnd) +void zen::setupFileDrop(wxWindow& dropWindow) { - wnd.SetDropTarget(new WindowDropTarget(wnd)); /*takes ownership*/ + dropWindow.SetDropTarget(new WindowDropTarget(dropWindow)); /*takes ownership*/ } |