desktop single mutex shared gtk.

This commit is contained in:
Miroslav Šedivý 2021-01-08 22:03:50 +01:00
parent d3340ad085
commit a6afccd079
3 changed files with 6 additions and 4 deletions

View File

@ -10,6 +10,9 @@ const (
) )
func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) { func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) {
mu.Lock()
defer mu.Unlock()
go gtk.DragWindow(files) go gtk.DragWindow(files)
// TODO: Find a bettter way. // TODO: Find a bettter way.

View File

@ -3,6 +3,7 @@ package desktop
import ( import (
"fmt" "fmt"
"time" "time"
"sync"
"github.com/kataras/go-events" "github.com/kataras/go-events"
"github.com/rs/zerolog" "github.com/rs/zerolog"
@ -12,6 +13,8 @@ import (
"demodesk/neko/internal/desktop/xorg" "demodesk/neko/internal/desktop/xorg"
) )
var mu = sync.Mutex{}
type DesktopManagerCtx struct { type DesktopManagerCtx struct {
logger zerolog.Logger logger zerolog.Logger
cleanup *time.Ticker cleanup *time.Ticker

View File

@ -1,14 +1,10 @@
package desktop package desktop
import ( import (
"sync"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/desktop/xorg" "demodesk/neko/internal/desktop/xorg"
) )
var mu = sync.Mutex{}
func (manager *DesktopManagerCtx) Move(x, y int) { func (manager *DesktopManagerCtx) Move(x, y int) {
xorg.Move(x, y) xorg.Move(x, y)
} }