mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
cursor updates to client (WIP).
This commit is contained in:
parent
9112d99c54
commit
9782b8391d
@ -9,10 +9,10 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"demodesk/neko/internal/websocket/handler"
|
"demodesk/neko/internal/websocket/handler"
|
||||||
|
"demodesk/neko/internal/types"
|
||||||
"demodesk/neko/internal/types/event"
|
"demodesk/neko/internal/types/event"
|
||||||
"demodesk/neko/internal/types/message"
|
"demodesk/neko/internal/types/message"
|
||||||
|
"demodesk/neko/internal/utils"
|
||||||
"demodesk/neko/internal/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(
|
func New(
|
||||||
@ -107,12 +107,29 @@ func (ws *WebSocketManagerCtx) Start() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
current := ws.desktop.ReadClipboard()
|
current := ws.desktop.ReadClipboard()
|
||||||
|
cursor := uint64(0)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ws.shutdown:
|
case <-ws.shutdown:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
|
cur := ws.desktop.GetCursorImage()
|
||||||
|
if cursor != cur.Serial || cur.Serial == 0 {
|
||||||
|
cursor = cur.Serial
|
||||||
|
|
||||||
|
// TODO: Refactor.
|
||||||
|
uri, _ := utils.GetCursorImageURI(cur)
|
||||||
|
ws.sessions.Broadcast(message.Message{
|
||||||
|
Event: "cursor/image",
|
||||||
|
Payload: struct{
|
||||||
|
Xhot uint16
|
||||||
|
Yhot uint16
|
||||||
|
Uri string
|
||||||
|
}{ cur.Xhot, cur.Yhot, uri },
|
||||||
|
}, nil)
|
||||||
|
}
|
||||||
|
|
||||||
session := ws.sessions.GetHost()
|
session := ws.sessions.GetHost()
|
||||||
if session == nil {
|
if session == nil {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user