From 4c99db8d118fbb5c6d68791e96059da627daeb5d Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 10 Mar 2011 09:07:15 +0000 Subject: [PATCH] Make Windows viewer behave like Unix viewer (send new FB update request immediately upon receiving FB update.) This is step 1 of working around the TLS refresh issue. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/1_1@4350 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/vncviewer/CConn.cxx | 26 ++++++++++++++++++++------ win/vncviewer/CConn.h | 5 +++-- win/vncviewer/DesktopWindow.cxx | 3 --- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx index 3585966e..d9966ee0 100644 --- a/win/vncviewer/CConn.cxx +++ b/win/vncviewer/CConn.cxx @@ -80,7 +80,7 @@ CConn::CConn() : window(0), sameMachine(false), encodingChange(false), formatChange(false), lastUsedEncoding_(encodingRaw), sock(0), sockEvent(CreateEvent(0, TRUE, FALSE, 0)), reverseConnection(false), requestUpdate(false), firstUpdate(true), - isClosed_(false) { + pendingUpdate(false), isClosed_(false) { } CConn::~CConn() { @@ -184,11 +184,6 @@ CConn::displayChanged() { calculateFullColourPF(); } -void -CConn::paintCompleted() { - // A repaint message has just completed - request next update if necessary - requestNewUpdate(); -} bool CConn::sysCommand(WPARAM wParam, LPARAM lParam) { @@ -521,6 +516,16 @@ CConn::showOptionsDialog() { } +void +CConn::framebufferUpdateStart() { + if (!formatChange) { + pendingUpdate = true; + requestNewUpdate(); + } else + pendingUpdate = false; +} + + void CConn::framebufferUpdateEnd() { if (debugDelay != 0) { @@ -571,6 +576,11 @@ CConn::framebufferUpdateEnd() { firstUpdate = false; } + // A format change prevented us from sending this before the update, + // so make sure to send it now. + if (formatChange && !pendingUpdate) + requestNewUpdate(); + if (options.autoSelect) autoSelectFormatAndEncoding(); @@ -662,6 +672,10 @@ CConn::requestNewUpdate() { if (!requestUpdate) return; if (formatChange) { + + /* Catch incorrect requestNewUpdate calls */ + assert(pendingUpdate == false); + // Select the required pixel format if (options.fullColour) { window->setPF(fullColourPF); diff --git a/win/vncviewer/CConn.h b/win/vncviewer/CConn.h index 62b131e1..d3b3b206 100644 --- a/win/vncviewer/CConn.h +++ b/win/vncviewer/CConn.h @@ -93,7 +93,7 @@ namespace rfb { // DesktopWindow::Callback interface void displayChanged(); - void paintCompleted(); + void paintCompleted() {} bool sysCommand(WPARAM wParam, LPARAM lParam); void closeWindow(); void refreshMenu(bool enableSysCommands); @@ -101,7 +101,7 @@ namespace rfb { // CConnection interface void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs); void bell(); - void framebufferUpdateStart() {} + void framebufferUpdateStart(); void framebufferUpdateEnd(); void setDesktopSize(int w, int h); void setExtendedDesktopSize(int reason, int result, int w, int h, @@ -152,6 +152,7 @@ namespace rfb { bool reverseConnection; bool requestUpdate; bool firstUpdate; + bool pendingUpdate; // Debugging/logging std::list debugRects; diff --git a/win/vncviewer/DesktopWindow.cxx b/win/vncviewer/DesktopWindow.cxx index d60ff8fe..f55eb72e 100644 --- a/win/vncviewer/DesktopWindow.cxx +++ b/win/vncviewer/DesktopWindow.cxx @@ -725,9 +725,6 @@ DesktopWindow::processFrameMessage(UINT msg, WPARAM wParam, LPARAM lParam) { } EndPaint(frameHandle, &ps); - - // - Notify the callback that a paint message has finished processing - callback->paintCompleted(); } return 0; -- 2.39.5