Encode one framebuffer update at a single negotiated pixel format

This commit is contained in:
Viktor Liu
2026-08-29 13:56:54 +02:00
parent dfe504c30c
commit bba7acaafa
3 changed files with 29 additions and 13 deletions
+6 -2
View File
@@ -11,13 +11,17 @@ import (
// when the client negotiated the encoding and the platform exposes a
// cursor source whose serial has changed since the last emission. A nil
// return means "do not include a cursor rect in this FramebufferUpdate".
func (s *session) pendingCursorRect() []byte {
// pf is the format the rest of this update is being encoded in, passed in
// rather than read again here: a SetPixelFormat landing mid-update would
// otherwise pack the cursor at the new shifts and the framebuffer at the old
// ones, and the client would paint a correctly coloured desktop under a cursor
// with its channels swapped.
func (s *session) pendingCursorRect(pf clientPixelFormat) []byte {
s.encMu.RLock()
supported := s.clientSupportsCursor
failed := s.cursorSourceFailed
composite := s.showRemoteCursor
lastSerial := s.lastCursorSerial
pf := s.pf
s.encMu.RUnlock()
if !supported || failed || composite {
return nil