summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaoimhe <caoimhebyrne06@gmail.com>2023-05-23 19:40:19 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-23 22:56:36 +0200
commitbafc1193ee70de2acb417322930277d19677bc5a (patch)
treedb82ada8c95f7e085b756b433089ddc648e83ce9
parent4e47e6a3d6cc448536cafe4459cdf6887ec93af1 (diff)
downloadserenity-bafc1193ee70de2acb417322930277d19677bc5a.zip
SpiceAgent: Don't send ClipboardGrab if the shared clipboard is disabled
The spice server will ignore any clipboard-related messages if we don't have the appropriate capabilities, but I think it's better for us to do less CPU churning whenever the user copies something to their clipboard. It also stops the spice server from warning in the console about a clipboard grab message being recieved when the capability was never announced.
-rw-r--r--Userland/Services/SpiceAgent/SpiceAgent.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Services/SpiceAgent/SpiceAgent.cpp b/Userland/Services/SpiceAgent/SpiceAgent.cpp
index 895c6753d6..ff06168fef 100644
--- a/Userland/Services/SpiceAgent/SpiceAgent.cpp
+++ b/Userland/Services/SpiceAgent/SpiceAgent.cpp
@@ -53,6 +53,12 @@ ErrorOr<void> SpiceAgent::start()
ErrorOr<void> SpiceAgent::on_clipboard_update(String const& mime_type)
{
+ // NOTE: If we indicate that we don't support clipboard by demand, the spice server will ignore our messages,
+ // but it will do some ugly debug logging.. so let's just not send anything instead.
+ if (!m_capabilities.contains_slow(Capability::ClipboardByDemand)) {
+ return {};
+ }
+
// If we just copied something to the clipboard, we shouldn't do anything here.
if (m_clipboard_dirty) {
m_clipboard_dirty = false;