mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-03 16:59:12 +02:00
cursor position bypass desktop module.
This commit is contained in:
parent
66618b9e62
commit
663270b0f5
6 changed files with 11 additions and 27 deletions
|
@ -80,7 +80,7 @@ func (manager *ImageCtx) GetCached(serial uint64) (*ImageEntry, error) {
|
|||
return entry, nil
|
||||
}
|
||||
|
||||
func (manager *ImageCtx) GetCurrent() (*ImageEntry, error) {
|
||||
func (manager *ImageCtx) Get() (*ImageEntry, error) {
|
||||
if manager.current != nil {
|
||||
return manager.current, nil
|
||||
}
|
||||
|
|
|
@ -25,14 +25,6 @@ type PositionCtx struct {
|
|||
listeners map[uintptr]*func(x, y int)
|
||||
}
|
||||
|
||||
func (manager *PositionCtx) Start() {
|
||||
manager.desktop.OnCursorPosition(func(x, y int) {
|
||||
for _, emit := range manager.listeners {
|
||||
(*emit)(x, y)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (manager *PositionCtx) Shutdown() {
|
||||
manager.logger.Info().Msgf("shutting down")
|
||||
|
||||
|
@ -43,10 +35,16 @@ func (manager *PositionCtx) Shutdown() {
|
|||
manager.emitMu.Unlock()
|
||||
}
|
||||
|
||||
func (manager *PositionCtx) GetCurrent() (x, y int) {
|
||||
func (manager *PositionCtx) Get() (x, y int) {
|
||||
return manager.desktop.GetCursorPosition()
|
||||
}
|
||||
|
||||
func (manager *PositionCtx) Set(x, y int) {
|
||||
for _, emit := range manager.listeners {
|
||||
(*emit)(x, y)
|
||||
}
|
||||
}
|
||||
|
||||
func (manager *PositionCtx) AddListener(listener *func(x, y int)) {
|
||||
manager.emitMu.Lock()
|
||||
defer manager.emitMu.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue