When dragging files from Windows Explorer into the BBDrop application running in WSL2, the drag operation was being rejected with a “no drop” cursor (circle with line through it). The files were never reaching the dropEvent handler where WSL path conversion occurs.
The issue was in the drag event acceptance logic in src/gui/main_window.py:
dragEnterEvent (line 6562) and dragMoveEvent (line 6570) were checking if the mime data contains valid URLsdropEvent could perform WSL path conversiondropEvent (line 6592) never got a chance to runMade the drag acceptance logic MORE PERMISSIVE by:
dragEnterEvent (lines 6562-6588)dragMoveEvent (lines 6590-6602)dropEvent (lines 6607-6649)Before:
def dragEnterEvent(self, event):
if event.mimeData().hasUrls():
event.acceptProposedAction()
else:
event.ignore()
After:
def dragEnterEvent(self, event):
mime_data = event.mimeData()
# Accept URLs
if mime_data.hasUrls():
event.acceptProposedAction()
return
# Also accept text (WSL2 might pass paths as text)
if mime_data.hasText():
event.acceptProposedAction()
return
# Only reject if no URLs AND no text
event.ignore()
The fix includes extensive logging with category “drag_drop”:
To enable drag-drop debugging, ensure logging is enabled for the “drag_drop” category in the application settings.
python bbdrop.pyThe convert_to_wsl_path() function (from src/utils/system_utils.py) converts:
C:\path\to\folder -> /mnt/c/path/to/folderis_wsl2() returns TrueWindows Explorer drag
|
dragEnterEvent: Accept if hasUrls OR hasText
|
dragMoveEvent: Accept if hasUrls OR hasText
|
dropEvent:
- Extract URLs from mime data
- Convert Windows paths to WSL format
- Validate converted paths
- Add to application if valid
src/gui/main_window.py
dragEnterEvent() (lines 6562-6588): Enhanced acceptance logic + loggingdragMoveEvent() (lines 6590-6602): Accept URLs or textdropEvent() (lines 6607-6649): Enhanced logging throughoutTo verify the fix is working:
dragEnterEvent: Accepting drag with N URLs
dropEvent: Processing N URLs
dropEvent: Original path from URL: C:\...
WSL2 path conversion: C:\... -> /mnt/c/...
Path validated: /mnt/c/...
dropEvent: Adding N valid paths
src/utils/system_utils.py::is_wsl2() (line 355)src/utils/system_utils.py::convert_to_wsl_path() (line 372)src/utils/logger.py::log() with category “drag_drop”This fix is backward compatible:
Potential improvements: