From 6e62b796fc704ab7975e67f5513563cf31194541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 29 Jan 2023 17:51:39 +0100 Subject: [PATCH] remove unused channels. --- server/internal/capture/manager.go | 1 + server/internal/desktop/xevent.go | 10 +------- server/internal/desktop/xevent/xevent.go | 29 ++++++++---------------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/server/internal/capture/manager.go b/server/internal/capture/manager.go index cfea2ab8..9bb88af0 100644 --- a/server/internal/capture/manager.go +++ b/server/internal/capture/manager.go @@ -22,6 +22,7 @@ type CaptureManagerCtx struct { func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCtx { logger := log.With().Str("module", "capture").Logger() + return &CaptureManagerCtx{ logger: logger, desktop: desktop, diff --git a/server/internal/desktop/xevent.go b/server/internal/desktop/xevent.go index e90f5516..b38a9e4e 100644 --- a/server/internal/desktop/xevent.go +++ b/server/internal/desktop/xevent.go @@ -9,18 +9,10 @@ func (manager *DesktopManagerCtx) GetCursorChangedChannel() chan uint64 { return xevent.CursorChangedChannel } -func (manager *DesktopManagerCtx) GetClipboardUpdatedChannel() chan bool { +func (manager *DesktopManagerCtx) GetClipboardUpdatedChannel() chan struct{} { return xevent.ClipboardUpdatedChannel } -func (manager *DesktopManagerCtx) GetFileChooserDialogOpenedChannel() chan bool { - return xevent.FileChooserDialogOpenedChannel -} - -func (manager *DesktopManagerCtx) GetFileChooserDialogClosedChannel() chan bool { - return xevent.FileChooserDialogClosedChannel -} - func (manager *DesktopManagerCtx) GetEventErrorChannel() chan types.DesktopErrorMessage { return xevent.EventErrorChannel } diff --git a/server/internal/desktop/xevent/xevent.go b/server/internal/desktop/xevent/xevent.go index 5b30a0a2..8c3553a7 100644 --- a/server/internal/desktop/xevent/xevent.go +++ b/server/internal/desktop/xevent/xevent.go @@ -14,36 +14,20 @@ import ( ) var CursorChangedChannel chan uint64 -var ClipboardUpdatedChannel chan bool -var FileChooserDialogClosedChannel chan bool -var FileChooserDialogOpenedChannel chan bool +var ClipboardUpdatedChannel chan struct{} var EventErrorChannel chan types.DesktopErrorMessage func init() { CursorChangedChannel = make(chan uint64) - ClipboardUpdatedChannel = make(chan bool) - FileChooserDialogClosedChannel = make(chan bool) - FileChooserDialogOpenedChannel = make(chan bool) + ClipboardUpdatedChannel = make(chan struct{}) EventErrorChannel = make(chan types.DesktopErrorMessage) go func() { for { - // TODO: Unused. + // TODO: Reserved for future use. <-CursorChangedChannel } }() - go func() { - for { - // TODO: Unused. - <-FileChooserDialogClosedChannel - } - }() - go func() { - for { - // TODO: Unused. - <-FileChooserDialogOpenedChannel - } - }() } func EventLoop(display string) { @@ -53,6 +37,11 @@ func EventLoop(display string) { C.XEventLoop(displayUnsafe) } +// TODO: Shutdown function. +//close(CursorChangedChannel) +//close(ClipboardUpdatedChannel) +//close(EventErrorChannel) + //export goXEventCursorChanged func goXEventCursorChanged(event C.XFixesCursorNotifyEvent) { CursorChangedChannel <- uint64(event.cursor_serial) @@ -60,7 +49,7 @@ func goXEventCursorChanged(event C.XFixesCursorNotifyEvent) { //export goXEventClipboardUpdated func goXEventClipboardUpdated() { - ClipboardUpdatedChannel <- true + ClipboardUpdatedChannel <- struct{}{} } //export goXEventConfigureNotify