Keep Windows input state per session, reject unmappable VkKeyScanA results, queue clipboard and paste reliably, and deselect the GDI bitmap before deleting it

This commit is contained in:
Viktor Liu
2026-09-23 08:12:31 +02:00
parent ff4d6928f7
commit 47c51fa3c4
3 changed files with 147 additions and 41 deletions
+14
View File
@@ -134,6 +134,13 @@ type InputInjector interface {
TypeText(text string)
}
// sessionInputFactory is implemented by injectors that keep input state per
// client. ForSession returns a view that shares the injector's resources but
// not what the client has pressed; the view must not close the injector.
type sessionInputFactory interface {
ForSession() InputInjector
}
// connectionHeader is sent by the client before the RFB handshake to specify
// the VNC session mode and authenticate.
type connectionHeader struct {
@@ -1180,6 +1187,13 @@ func (s *Server) handleConnection(conn net.Conn) {
}, conn)
defer s.removeSession(sessionID)
// An injector shared by every attach-mode session can hand each one its
// own view, so what one client holds down is not released, or completed
// into a shortcut, by another client's events.
if f, ok := injector.(sessionInputFactory); ok {
injector = f.ForSession()
}
conn = newMetricsConn(conn, s.sessionRecorder)
sess := &session{
conn: conn,