cursor image/position from WebRTC.

This commit is contained in:
Miroslav Šedivý
2021-02-13 18:25:40 +01:00
parent 061fbe60cf
commit c9b2c93fb8
7 changed files with 82 additions and 127 deletions

View File

@ -9,16 +9,21 @@ import (
"demodesk/neko/internal/desktop/xorg"
)
var mousePosX int
var mousePosY int
// TODO: Refactor.
var cursorListeners []func(x, y int)
func (manager *DesktopManagerCtx) Move(x, y int) {
xorg.Move(x, y)
mousePosX, mousePosY = x, y
// TODO: Refactor.
for _, listener := range cursorListeners {
listener(x, y)
}
}
func (manager *DesktopManagerCtx) GetMousePositon() (x, y int) {
return mousePosX, mousePosY
// TODO: Refactor.
func (manager *DesktopManagerCtx) OnCursorPosition(listener func(x, y int)) {
cursorListeners = append(cursorListeners, listener)
}
func (manager *DesktopManagerCtx) Scroll(x, y int) {