diff options
Diffstat (limited to 'win/vncviewer')
-rw-r--r-- | win/vncviewer/CConn.cxx | 41 | ||||
-rw-r--r-- | win/vncviewer/CConn.h | 5 | ||||
-rw-r--r-- | win/vncviewer/DesktopWindow.cxx | 3 |
3 files changed, 31 insertions, 18 deletions
diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx index 3585966e..b067134a 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) { @@ -362,10 +357,7 @@ CConn::blockCallback() { // Wait for socket data, or a message to process DWORD result = MsgWaitForMultipleObjects(1, &sockEvent.h, FALSE, INFINITE, QS_ALLINPUT); - if (result == WAIT_OBJECT_0) { - // - Network event notification. Return control to I/O routine. - break; - } else if (result == WAIT_FAILED) { + if (result == WAIT_FAILED) { // - The wait operation failed - raise an exception throw rdr::SystemException("blockCallback wait error", GetLastError()); } @@ -380,6 +372,10 @@ CConn::blockCallback() { // ToAscii() internally). DispatchMessage(&msg); } + + if (result == WAIT_OBJECT_0) + // - Network event notification. Return control to I/O routine. + break; } // Before we return control to the InStream, reset the network event @@ -522,6 +518,16 @@ CConn::showOptionsDialog() { void +CConn::framebufferUpdateStart() { + if (!formatChange) { + requestUpdate = pendingUpdate = true; + requestNewUpdate(); + } else + pendingUpdate = false; +} + + +void CConn::framebufferUpdateEnd() { if (debugDelay != 0) { vlog.debug("debug delay %d",(int)debugDelay); @@ -571,12 +577,17 @@ CConn::framebufferUpdateEnd() { firstUpdate = false; } - if (options.autoSelect) - autoSelectFormatAndEncoding(); - // Always request the next update requestUpdate = true; + // 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(); + // Check that at least part of the window has changed if (!GetUpdateRect(window->getHandle(), 0, FALSE)) { if (!(GetWindowLong(window->getHandle(), GWL_STYLE) & WS_MINIMIZE)) @@ -662,6 +673,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<Rect> 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; |