Fix ExtendedClipboard auto-request by advertising all actions in Caps

This commit is contained in:
Viktor Liu
2026-05-17 16:47:53 +02:00
parent a11341f57a
commit 76add0b9b2
4 changed files with 37 additions and 17 deletions

View File

@@ -877,24 +877,32 @@ func (s *session) handleExtCutText(payloadLen uint32) error {
}
return nil
case extClipActionProvide:
if len(rest) == 0 {
return nil
}
text, err := parseExtClipProvideText(flags, rest)
if err != nil {
s.log.Debugf("parse ext clipboard provide: %v", err)
return nil
}
if text != "" {
s.injector.SetClipboard(text)
}
return nil
return s.handleExtClipProvide(flags, rest)
default:
s.log.Debugf("unknown ext clipboard action 0x%x", action)
return nil
}
}
// handleExtClipProvide decodes a Provide payload and pushes the recovered
// text into the host clipboard. Errors and other unsupported formats (RTF,
// HTML, etc.) are swallowed so a malformed message doesn't tear down the
// session.
func (s *session) handleExtClipProvide(flags uint32, payload []byte) error {
if len(payload) == 0 {
return nil
}
text, err := parseExtClipProvideText(flags, payload)
if err != nil {
s.log.Debugf("parse ext clipboard provide: %v", err)
return nil
}
if text != "" {
s.injector.SetClipboard(text)
}
return nil
}
// sendExtClipProvideText answers an inbound Request(text) with the current
// host clipboard contents, capped to extClipMaxText.
func (s *session) sendExtClipProvideText() error {