From a6afccd0797b599150cbf3b1d2907edbb1fcdec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 8 Jan 2021 22:03:50 +0100 Subject: [PATCH] desktop single mutex shared gtk. --- internal/desktop/gtk.go | 3 +++ internal/desktop/manager.go | 3 +++ internal/desktop/xorg.go | 4 ---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/desktop/gtk.go b/internal/desktop/gtk.go index 70e1a714..4d009b9e 100644 --- a/internal/desktop/gtk.go +++ b/internal/desktop/gtk.go @@ -10,6 +10,9 @@ const ( ) func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) { + mu.Lock() + defer mu.Unlock() + go gtk.DragWindow(files) // TODO: Find a bettter way. diff --git a/internal/desktop/manager.go b/internal/desktop/manager.go index 2a1cde0d..62e5e3df 100644 --- a/internal/desktop/manager.go +++ b/internal/desktop/manager.go @@ -3,6 +3,7 @@ package desktop import ( "fmt" "time" + "sync" "github.com/kataras/go-events" "github.com/rs/zerolog" @@ -12,6 +13,8 @@ import ( "demodesk/neko/internal/desktop/xorg" ) +var mu = sync.Mutex{} + type DesktopManagerCtx struct { logger zerolog.Logger cleanup *time.Ticker diff --git a/internal/desktop/xorg.go b/internal/desktop/xorg.go index e4564624..90faa4a2 100644 --- a/internal/desktop/xorg.go +++ b/internal/desktop/xorg.go @@ -1,14 +1,10 @@ package desktop import ( - "sync" - "demodesk/neko/internal/types" "demodesk/neko/internal/desktop/xorg" ) -var mu = sync.Mutex{} - func (manager *DesktopManagerCtx) Move(x, y int) { xorg.Move(x, y) }