Archived
2
0

remove unused channels.

This commit is contained in:
Miroslav Šedivý 2023-01-29 17:51:39 +01:00
parent 4094639ea9
commit 6e62b796fc
3 changed files with 11 additions and 29 deletions

View File

@ -22,6 +22,7 @@ type CaptureManagerCtx struct {
func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCtx { func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCtx {
logger := log.With().Str("module", "capture").Logger() logger := log.With().Str("module", "capture").Logger()
return &CaptureManagerCtx{ return &CaptureManagerCtx{
logger: logger, logger: logger,
desktop: desktop, desktop: desktop,

View File

@ -9,18 +9,10 @@ func (manager *DesktopManagerCtx) GetCursorChangedChannel() chan uint64 {
return xevent.CursorChangedChannel return xevent.CursorChangedChannel
} }
func (manager *DesktopManagerCtx) GetClipboardUpdatedChannel() chan bool { func (manager *DesktopManagerCtx) GetClipboardUpdatedChannel() chan struct{} {
return xevent.ClipboardUpdatedChannel 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 { func (manager *DesktopManagerCtx) GetEventErrorChannel() chan types.DesktopErrorMessage {
return xevent.EventErrorChannel return xevent.EventErrorChannel
} }

View File

@ -14,36 +14,20 @@ import (
) )
var CursorChangedChannel chan uint64 var CursorChangedChannel chan uint64
var ClipboardUpdatedChannel chan bool var ClipboardUpdatedChannel chan struct{}
var FileChooserDialogClosedChannel chan bool
var FileChooserDialogOpenedChannel chan bool
var EventErrorChannel chan types.DesktopErrorMessage var EventErrorChannel chan types.DesktopErrorMessage
func init() { func init() {
CursorChangedChannel = make(chan uint64) CursorChangedChannel = make(chan uint64)
ClipboardUpdatedChannel = make(chan bool) ClipboardUpdatedChannel = make(chan struct{})
FileChooserDialogClosedChannel = make(chan bool)
FileChooserDialogOpenedChannel = make(chan bool)
EventErrorChannel = make(chan types.DesktopErrorMessage) EventErrorChannel = make(chan types.DesktopErrorMessage)
go func() { go func() {
for { for {
// TODO: Unused. // TODO: Reserved for future use.
<-CursorChangedChannel <-CursorChangedChannel
} }
}() }()
go func() {
for {
// TODO: Unused.
<-FileChooserDialogClosedChannel
}
}()
go func() {
for {
// TODO: Unused.
<-FileChooserDialogOpenedChannel
}
}()
} }
func EventLoop(display string) { func EventLoop(display string) {
@ -53,6 +37,11 @@ func EventLoop(display string) {
C.XEventLoop(displayUnsafe) C.XEventLoop(displayUnsafe)
} }
// TODO: Shutdown function.
//close(CursorChangedChannel)
//close(ClipboardUpdatedChannel)
//close(EventErrorChannel)
//export goXEventCursorChanged //export goXEventCursorChanged
func goXEventCursorChanged(event C.XFixesCursorNotifyEvent) { func goXEventCursorChanged(event C.XFixesCursorNotifyEvent) {
CursorChangedChannel <- uint64(event.cursor_serial) CursorChangedChannel <- uint64(event.cursor_serial)
@ -60,7 +49,7 @@ func goXEventCursorChanged(event C.XFixesCursorNotifyEvent) {
//export goXEventClipboardUpdated //export goXEventClipboardUpdated
func goXEventClipboardUpdated() { func goXEventClipboardUpdated() {
ClipboardUpdatedChannel <- true ClipboardUpdatedChannel <- struct{}{}
} }
//export goXEventConfigureNotify //export goXEventConfigureNotify