[v2] Files DragAndDrop bugs
Open
Nobody has claimed this yet.
Bug
P1
v2
Windows
- Dominant language
- Go
- Stars
- 36.3k
- Forks
- 1.9k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 33
Description
Description
- When only
EnableFileDrop: true, every time D'n'D happens anOnDomReadyis triggered.
INF | drop files: []string{"/abs/path/file.txt"}
WTF?
main.(*App).onFileDrop
.../app.go:125
github.com/wailsapp/wails/v2/pkg/runtime.OnFileDrop.func1
github.com/wailsapp/wails/v2@v2.9.1/pkg/runtime/draganddrop.go:30
runtime.goexit
$GOROOT/src/runtime/asm_amd64.s:1598
INF | DOM READY -------------------------------
WTF?
main.(*App).domReady
.../app.go:104
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.(*Frontend).processMessage
github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/linux/frontend.go:411
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.(*Frontend).startMessageProcessor
github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/linux/frontend.go:215
runtime.goexit
$GOROOT/src/runtime/asm_amd64.s:1598
- When
EnableFileDrop: true, DisableWebViewDrop: true, D'n'D don't work for files ever. Not sure how this option should be used. I hoped it should prevent p.1 above to happen. (enhance usage documentation)
To Reproduce
import "github.com/pkg/errors"
func (a *App) domReady(ctx context.Context) {
runtime.OnFileDropOff(ctx)
runtime.LogInfof(ctx, "DOM READY -------------------------------\n%+v", errors.New("WTF?"))
runtime.OnFileDrop(ctx, a.onFileDrop)
}
func (a *App) onFileDrop(x, y int, paths []string) {
runtime.LogInfof(a.ctx, "drop files: %#v\n%+v", paths, errors.New("WTF?"))
}
Expected behaviour
- No extra OnDomReady triggering
- Better documentation how these options works at they own and together.
Screenshots
No response
Attempted Fixes
No response
System Details
# Wails
Version | v2.9.1
Package Manager | apt
(v2.9.2 as well - UPD 2024-10-05)
System
┌──────────────────────────────────────────────────────────────────────────────────┐
| OS | Ubuntu |
| Version | 22.04 |
| ID | ubuntu |
| Go Version | go1.20.5 |
| Platform | linux |
| Architecture | amd64 |
| CPU | AMD Ryzen 9 7950X 16-Core Processor |
| GPU | unknown (Advanced Micro Devices, Inc. [AMD/ATI]) - Driver: amdgpu |
| Memory | 59GB |
└──────────────────────────────────────────────────────────────────────────────────┘
Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version |
| *docker | docker.io | Available | 24.0.7-0ubuntu2~22.04.1 |
| gcc | build-essential | Installed | 12.9ubuntu3 |
| libgtk-3 | libgtk-3-dev | Installed | 3.24.33-1ubuntu2.1 |
| libwebkit | libwebkit2gtk-4.0-dev | Installed | 2.44.2-0ubuntu0.22.04.1 |
| npm | npm | Installed | 10.2.4 |
| *nsis | nsis | Installed | v3.08-2 |
| pkg-config | pkg-config | Installed | 0.29.2 |
└──────────────────────── * - Optional Dependency ─────────────────────────┘
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read pkg/runtime/draganddrop.go and the Linux message handling in internal/frontend/desktop/linux/frontend.go, then reproduce both configurations from the issue. Trace how EnableFileDrop and DisableWebViewDrop interact with OnFileDrop and OnDomReady; done means file drops work without an extra DOM-ready event and the option behavior is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100