From 253247f6ce7658b6b13628c7c3ef8bf6883e8ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 14 Jan 2021 16:42:33 +0100 Subject: [PATCH] gkt drag and drop remove duplicity. --- internal/desktop/gtk.go | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/internal/desktop/gtk.go b/internal/desktop/gtk.go index 451447cc..5decbd2f 100644 --- a/internal/desktop/gtk.go +++ b/internal/desktop/gtk.go @@ -17,14 +17,22 @@ func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) { go gtk.DragWindow(files) // TODO: Find a bettter way. - time.Sleep(DELAY) - manager.Move(0, 0) - manager.ButtonDown(1) - manager.Move(x, y) - time.Sleep(DELAY) - manager.Move(x, y) - time.Sleep(DELAY) - manager.Move(x, y) - time.Sleep(DELAY) - manager.ButtonUp(1) + 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) + } + } }