mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
use types.Cursor.
This commit is contained in:
parent
1025eedc22
commit
28c22a254b
@ -201,16 +201,11 @@ func (manager *SessionManagerCtx) ClearHost() {
|
|||||||
// cursors
|
// cursors
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
func (manager *SessionManagerCtx) SetCursor(x, y int, session types.Session) {
|
func (manager *SessionManagerCtx) SetCursor(cursor types.Cursor, session types.Session) {
|
||||||
manager.cursorsMu.Lock()
|
manager.cursorsMu.Lock()
|
||||||
defer manager.cursorsMu.Unlock()
|
defer manager.cursorsMu.Unlock()
|
||||||
|
|
||||||
pos, ok := manager.cursors[session]
|
manager.cursors[session] = cursor
|
||||||
if ok {
|
|
||||||
pos.X, pos.Y = x, y
|
|
||||||
} else {
|
|
||||||
manager.cursors[session] = types.Cursor{X: x, Y: y}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *SessionManagerCtx) PopCursors() map[types.Session]types.Cursor {
|
func (manager *SessionManagerCtx) PopCursors() map[types.Session]types.Cursor {
|
||||||
|
@ -53,8 +53,8 @@ func (session *SessionCtx) IsHost() bool {
|
|||||||
return session.manager.GetHost() == session
|
return session.manager.GetHost() == session
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *SessionCtx) SetCursor(x, y int) {
|
func (session *SessionCtx) SetCursor(cursor types.Cursor) {
|
||||||
session.manager.SetCursor(x, y, session)
|
session.manager.SetCursor(cursor, session)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
|
@ -29,7 +29,7 @@ type Session interface {
|
|||||||
IsHost() bool
|
IsHost() bool
|
||||||
|
|
||||||
// cursor
|
// cursor
|
||||||
SetCursor(x, y int)
|
SetCursor(cursor Cursor)
|
||||||
|
|
||||||
// websocket
|
// websocket
|
||||||
SetWebSocketPeer(websocketPeer WebSocketPeer)
|
SetWebSocketPeer(websocketPeer WebSocketPeer)
|
||||||
@ -55,7 +55,7 @@ type SessionManager interface {
|
|||||||
GetHost() Session
|
GetHost() Session
|
||||||
ClearHost()
|
ClearHost()
|
||||||
|
|
||||||
SetCursor(x, y int, session Session)
|
SetCursor(cursor Cursor, session Session)
|
||||||
PopCursors() map[Session]Cursor
|
PopCursors() map[Session]Cursor
|
||||||
|
|
||||||
Broadcast(event string, payload interface{}, exclude interface{})
|
Broadcast(event string, payload interface{}, exclude interface{})
|
||||||
|
@ -52,7 +52,10 @@ func (manager *WebRTCManagerCtx) handle(data []byte, session types.Session) erro
|
|||||||
|
|
||||||
// handle inactive cursor movement
|
// handle inactive cursor movement
|
||||||
if session.Profile().CanHost {
|
if session.Profile().CanHost {
|
||||||
session.SetCursor(x, y)
|
session.SetCursor(types.Cursor{
|
||||||
|
X: x,
|
||||||
|
Y: y,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user