From 07935033b538e18ca428588c33dab67d70e79c5b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 4 Jan 2021 13:17:40 +0100 Subject: [PATCH] Improve clipboard debug logging in viewer --- vncviewer/Viewport.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index b5466acb..d7203ea2 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -291,12 +291,8 @@ void Viewport::handleClipboardAnnounce(bool available) if (!acceptClipboard) return; - if (available) - vlog.debug("Got notification of new clipboard on server"); - else - vlog.debug("Clipboard is no longer available on server"); - if (!available) { + vlog.debug("Clipboard is no longer available on server"); pendingServerClipboard = false; return; } @@ -304,10 +300,12 @@ void Viewport::handleClipboardAnnounce(bool available) pendingClientClipboard = false; if (!hasFocus()) { + vlog.debug("Got notification of new clipboard on server whilst not focused, will request data later"); pendingServerClipboard = true; return; } + vlog.debug("Got notification of new clipboard on server, requesting data"); cc->requestClipboard(); } @@ -759,12 +757,14 @@ void Viewport::handleClipboardChange(int source, void *data) self->pendingServerClipboard = false; if (!self->hasFocus()) { + vlog.debug("Local clipboard changed whilst not focused, will notify server later"); self->pendingClientClipboard = true; // Clear any older client clipboard from the server self->cc->announceClipboard(false); return; } + vlog.debug("Local clipboard changed, notifying server"); try { self->cc->announceClipboard(true); } catch (rdr::Exception& e) { @@ -777,6 +777,7 @@ void Viewport::handleClipboardChange(int source, void *data) void Viewport::flushPendingClipboard() { if (pendingServerClipboard) { + vlog.debug("Focus regained after remote clipboard change, requesting data"); try { cc->requestClipboard(); } catch (rdr::Exception& e) { @@ -785,6 +786,7 @@ void Viewport::flushPendingClipboard() } } if (pendingClientClipboard) { + vlog.debug("Focus regained after local clipboard change, notifying server"); try { cc->announceClipboard(true); } catch (rdr::Exception& e) { -- 2.39.5