Commit 7fe1eed019 for qemu.org

commit 7fe1eed0193e9db5575d25febf32426decac7d81
Author: Lukasz Kornicki <lucas.kornicki@nutanix.com>
Date:   Fri Oct 30 15:14:41 2026 +0100

    ui/vnc-clipboard: factor out clipboard peer registration

    VNC clipboard peer is registered inline from vnc_server_cut_text_caps.

    Move the registration logic into a function so a subsequent change can
    register the peer independently of extended clipboard capability.

    No functional change.

    Signed-off-by: Lukasz Kornicki <lucas.kornicki@nutanix.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-ID: <20261030141442.264308-4-lucas.kornicki@nutanix.com>

diff --git a/ui/vnc-clipboard.c b/ui/vnc-clipboard.c
index dfe830f819..67f710f6ed 100644
--- a/ui/vnc-clipboard.c
+++ b/ui/vnc-clipboard.c
@@ -325,6 +325,16 @@ void vnc_client_cut_text(VncState *vs, size_t len, uint8_t *text)
     qemu_clipboard_info_unref(info);
 }

+void vnc_clipboard_peer_register(VncState *vs)
+{
+    if (!vs->cbpeer.notifier.notify) {
+        vs->cbpeer.name = "vnc";
+        vs->cbpeer.notifier.notify = vnc_clipboard_notify;
+        vs->cbpeer.request = vnc_clipboard_request;
+        qemu_clipboard_peer_register(&vs->cbpeer);
+    }
+}
+
 void vnc_server_cut_text_caps(VncState *vs)
 {
     uint32_t caps[2];
@@ -341,10 +351,5 @@ void vnc_server_cut_text_caps(VncState *vs)
     caps[1] = 0;
     vnc_clipboard_send(vs, 2, caps);

-    if (!vs->cbpeer.notifier.notify) {
-        vs->cbpeer.name = "vnc";
-        vs->cbpeer.notifier.notify = vnc_clipboard_notify;
-        vs->cbpeer.request = vnc_clipboard_request;
-        qemu_clipboard_peer_register(&vs->cbpeer);
-    }
+    vnc_clipboard_peer_register(vs);
 }
diff --git a/ui/vnc.h b/ui/vnc.h
index 88293ef497..d8b0070396 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -636,6 +636,7 @@ int vnc_zywrle_send_framebuffer_update(VncState *vs, VncWorker *worker,
 void vnc_zrle_clear(VncWorker *worker);

 /* vnc-clipboard.c */
+void vnc_clipboard_peer_register(VncState *vs);
 void vnc_server_cut_text_caps(VncState *vs);
 void vnc_client_cut_text(VncState *vs, size_t len, uint8_t *text);
 void vnc_client_cut_text_ext(VncState *vs, int32_t len, uint32_t flags, uint8_t *data);