mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
go fmt.
This commit is contained in:
@ -16,21 +16,21 @@ import (
|
||||
var mu = sync.Mutex{}
|
||||
|
||||
type DesktopManagerCtx struct {
|
||||
logger zerolog.Logger
|
||||
wg sync.WaitGroup
|
||||
shutdown chan struct{}
|
||||
beforeScreenSizeChangeChannel chan bool
|
||||
afterScreenSizeChangeChannel chan int16
|
||||
config *config.Desktop
|
||||
logger zerolog.Logger
|
||||
wg sync.WaitGroup
|
||||
shutdown chan struct{}
|
||||
beforeScreenSizeChangeChannel chan bool
|
||||
afterScreenSizeChangeChannel chan int16
|
||||
config *config.Desktop
|
||||
}
|
||||
|
||||
func New(config *config.Desktop) *DesktopManagerCtx {
|
||||
return &DesktopManagerCtx{
|
||||
logger: log.With().Str("module", "desktop").Logger(),
|
||||
shutdown: make(chan struct{}),
|
||||
beforeScreenSizeChangeChannel: make (chan bool),
|
||||
afterScreenSizeChangeChannel: make (chan int16),
|
||||
config: config,
|
||||
logger: log.With().Str("module", "desktop").Logger(),
|
||||
shutdown: make(chan struct{}),
|
||||
beforeScreenSizeChangeChannel: make(chan bool),
|
||||
afterScreenSizeChangeChannel: make(chan int16),
|
||||
config: config,
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,13 +50,13 @@ func (manager *DesktopManagerCtx) Start() {
|
||||
|
||||
go func() {
|
||||
for {
|
||||
desktopErrorMessage := <- xevent.EventErrorChannel
|
||||
msg := <-xevent.EventErrorChannel
|
||||
manager.logger.Warn().
|
||||
Uint8("error_code", desktopErrorMessage.Error_code).
|
||||
Str("message", desktopErrorMessage.Message).
|
||||
Uint8("request_code", desktopErrorMessage.Request_code).
|
||||
Uint8("minor_code", desktopErrorMessage.Minor_code).
|
||||
Msg("X event error occurred")
|
||||
Uint8("error_code", msg.Error_code).
|
||||
Str("message", msg.Message).
|
||||
Uint8("request_code", msg.Request_code).
|
||||
Uint8("minor_code", msg.Minor_code).
|
||||
Msg("X event error occurred")
|
||||
}
|
||||
}()
|
||||
|
||||
@ -79,11 +79,11 @@ func (manager *DesktopManagerCtx) Start() {
|
||||
}()
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) GetBeforeScreenSizeChangeChannel() (chan bool) {
|
||||
func (manager *DesktopManagerCtx) GetBeforeScreenSizeChangeChannel() chan bool {
|
||||
return manager.beforeScreenSizeChangeChannel
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) GetAfterScreenSizeChangeChannel() (chan int16) {
|
||||
func (manager *DesktopManagerCtx) GetAfterScreenSizeChangeChannel() chan int16 {
|
||||
return manager.afterScreenSizeChangeChannel
|
||||
}
|
||||
|
||||
|
@ -5,22 +5,22 @@ import (
|
||||
"m1k1o/neko/internal/types"
|
||||
)
|
||||
|
||||
func (manager *DesktopManagerCtx) GetCursorChangedChannel() (chan uint64) {
|
||||
func (manager *DesktopManagerCtx) GetCursorChangedChannel() chan uint64 {
|
||||
return xevent.CursorChangedChannel
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) GetClipboardUpdatedChannel() (chan bool) {
|
||||
func (manager *DesktopManagerCtx) GetClipboardUpdatedChannel() chan bool {
|
||||
return xevent.ClipboardUpdatedChannel
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) GetFileChooserDialogOpenedChannel() (chan bool) {
|
||||
func (manager *DesktopManagerCtx) GetFileChooserDialogOpenedChannel() chan bool {
|
||||
return xevent.FileChooserDialogOpenedChannel
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) GetFileChooserDialogClosedChannel() (chan bool) {
|
||||
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
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"m1k1o/neko/internal/types"
|
||||
)
|
||||
|
||||
@ -25,20 +26,22 @@ func init() {
|
||||
FileChooserDialogOpenedChannel = make(chan bool)
|
||||
EventErrorChannel = make(chan types.DesktopErrorMessage)
|
||||
|
||||
// Dummy goroutines since there is no consumer for the channel otherwise
|
||||
go func() {
|
||||
for {
|
||||
_ = <-CursorChangedChannel
|
||||
// TODO: Unused.
|
||||
<-CursorChangedChannel
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
for {
|
||||
_ = <-FileChooserDialogClosedChannel
|
||||
// TODO: Unused.
|
||||
<-FileChooserDialogClosedChannel
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
for {
|
||||
_ = <-FileChooserDialogOpenedChannel
|
||||
// TODO: Unused.
|
||||
<-FileChooserDialogOpenedChannel
|
||||
}
|
||||
}()
|
||||
}
|
||||
@ -72,7 +75,12 @@ func goXEventUnmapNotify(window C.Window) {
|
||||
|
||||
//export goXEventError
|
||||
func goXEventError(event *C.XErrorEvent, message *C.char) {
|
||||
EventErrorChannel <- types.DesktopErrorMessage{ uint8(event.error_code), C.GoString(message), uint8(event.request_code), uint8(event.minor_code) }
|
||||
EventErrorChannel <- types.DesktopErrorMessage{
|
||||
Error_code: uint8(event.error_code),
|
||||
Message: C.GoString(message),
|
||||
Request_code: uint8(event.request_code),
|
||||
Minor_code: uint8(event.minor_code),
|
||||
}
|
||||
}
|
||||
|
||||
//export goXEventActive
|
||||
|
Reference in New Issue
Block a user