neko/internal/desktop/gtk.go

39 lines
547 B
Go
Raw Normal View History

2021-01-07 06:57:50 +13:00
package desktop
import (
"time"
2021-01-10 04:40:24 +13:00
2021-01-08 06:27:50 +13:00
"demodesk/neko/internal/desktop/gtk"
2021-01-07 06:57:50 +13:00
)
const (
DELAY = 100 * time.Millisecond
)
func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) {
2021-01-09 10:03:50 +13:00
mu.Lock()
defer mu.Unlock()
2021-01-08 06:27:50 +13:00
go gtk.DragWindow(files)
2021-01-07 06:57:50 +13:00
// TODO: Find a bettter way.
2021-01-15 04:42:33 +13:00
for step := 1; step <= 6; step++ {
time.Sleep(DELAY)
switch step {
case 1:
manager.Move(0, 0)
case 2:
manager.ButtonDown(1)
case 3:
fallthrough
case 4:
fallthrough
case 5:
manager.Move(x, y)
case 6:
manager.ButtonUp(1)
}
}
2021-01-07 06:57:50 +13:00
}