cefpython
cefpython copied to clipboard
Implement CefDragHandler to allow dragging of local files into window to be cancelled
CefDragHandler::OnDragEnter() would need to be implemented: https://github.com/cztomczak/cefpython/blob/d3bb96c/cefpython/cef3/include/cef_drag_handler.h#L61 It's available in CEF Python 1, but was not yet ported in CEF Python 3. In that callback it would need to be checked whether this is a local file being dragged and false should be returned to prevent drag operation. OnDragEnter is probably broken for local files in branch 1650, so CEF would need to be updated. See upstream issue 1262: https://bitbucket.org/chromiumembedded/cef/issues/1262
Related: PR #375.
Dragging of files can be canelled also by using RequestHandler.OnBeforeBrowse
. In that callback check request.GetUrl
whether it starts with "file://" protocol and in such case return True
and this will result in drag operation being canceled. If your application loads resources from disk using the file protocol then you will have to add some more logic to detect of this is your app local file or some other file from disk dragged onto the window.
Add this info to Knowledge-Base.md document.