aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/Win32PixelBuffer.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2011-07-15 14:20:30 +0000
committerPierre Ossman <ossman@cendio.se>2011-07-15 14:20:30 +0000
commit4333220effbf75b39b9b740acb9c050b959dc427 (patch)
tree7c6271ca18cf84abd971916d6c7d1dc692f9bbd3 /vncviewer/Win32PixelBuffer.cxx
parentfba3e869e0b81ac10e78c58a768fb77136c64b3d (diff)
downloadtigervnc-4333220effbf75b39b9b740acb9c050b959dc427.tar.gz
tigervnc-4333220effbf75b39b9b740acb9c050b959dc427.zip
Implement hacky workaround for rendering errors on XP and newer when the screen
is locked. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4597 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/Win32PixelBuffer.cxx')
-rw-r--r--vncviewer/Win32PixelBuffer.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/vncviewer/Win32PixelBuffer.cxx b/vncviewer/Win32PixelBuffer.cxx
index 71e18c47..8f9bf024 100644
--- a/vncviewer/Win32PixelBuffer.cxx
+++ b/vncviewer/Win32PixelBuffer.cxx
@@ -77,8 +77,15 @@ void PlatformPixelBuffer::draw(int src_x, int src_y, int x, int y, int w, int h)
if (!SelectObject(dc, bitmap))
throw rdr::SystemException("SelectObject failed", GetLastError());
- if (!BitBlt(fl_gc, x, y, w, h, dc, src_x, src_y, SRCCOPY))
- throw rdr::SystemException("BitBlt failed", GetLastError());
+ if (!BitBlt(fl_gc, x, y, w, h, dc, src_x, src_y, SRCCOPY)) {
+ // If the desktop we're rendering to is inactive (like when the screen
+ // is locked or the UAC is active), then GDI calls will randomly fail.
+ // This is completely undocumented so we have no idea how best to deal
+ // with it. For now, we've only seen this error and for this function
+ // so only ignore this combination.
+ if (GetLastError() != ERROR_INVALID_HANDLE)
+ throw rdr::SystemException("BitBlt failed", GetLastError());
+ }
DeleteDC(dc);
}