diff options
author | Pierre Ossman <ossman@cendio.se> | 2009-03-24 12:29:50 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2009-03-24 12:29:50 +0000 |
commit | d6d1994cff97bda9602b02e4161aec8774be2d64 (patch) | |
tree | 7ef2e5a44378633485878c9ecc7e5c58243aee13 | |
parent | b7c034a7e31024da7538c86b618ac223763d6ca3 (diff) | |
download | tigervnc-d6d1994cff97bda9602b02e4161aec8774be2d64.tar.gz tigervnc-d6d1994cff97bda9602b02e4161aec8774be2d64.zip |
Support for ExtendedDesktopSize and -DesktopSize in the Windows client.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3716 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | win/vncviewer/CConn.cxx | 59 | ||||
-rw-r--r-- | win/vncviewer/CConn.h | 3 | ||||
-rw-r--r-- | win/vncviewer/CConnOptions.cxx | 5 | ||||
-rw-r--r-- | win/vncviewer/CConnOptions.h | 1 |
4 files changed, 67 insertions, 1 deletions
diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx index 41b3aa3d..aa4ba75d 100644 --- a/win/vncviewer/CConn.cxx +++ b/win/vncviewer/CConn.cxx @@ -75,7 +75,8 @@ RegKey CConn::userConfigKey; CConn::CConn() : window(0), sameMachine(false), encodingChange(false), formatChange(false), lastUsedEncoding_(encodingRaw), sock(0), sockEvent(CreateEvent(0, TRUE, FALSE, 0)), - reverseConnection(false), requestUpdate(false), isClosed_(false) { + reverseConnection(false), requestUpdate(false), firstUpdate(true), + isClosed_(false) { } CConn::~CConn() { @@ -134,6 +135,7 @@ CConn::applyOptions(CConnOptions& opt) { // - Set optional features in ConnParams cp.supportsLocalCursor = options.useLocalCursor; cp.supportsDesktopResize = options.useDesktopResize; + cp.supportsExtendedDesktopSize = options.useDesktopResize; cp.supportsDesktopRename = true; cp.customCompressLevel = options.customCompressLevel; cp.compressLevel = options.compressLevel; @@ -447,6 +449,24 @@ CConn::setDesktopSize(int w, int h) { CConnection::setDesktopSize(w, h); } + +void +CConn::setExtendedDesktopSize(int reason, int result, int w, int h, + const rfb::ScreenSet& layout) { + if ((reason == reasonClient) && (result != resultSuccess)) { + vlog.error("SetDesktopSize failed: %d", result); + return; + } + + // Resize the window's buffer + if (window) + window->setSize(w, h); + + // Tell the underlying CConnection + CConnection::setExtendedDesktopSize(reason, result, w, h, layout); +} + + void CConn::setCursor(int w, int h, const Point& hotspot, void* data, void* mask) { if (!options.useLocalCursor) return; @@ -491,6 +511,43 @@ CConn::framebufferUpdateEnd() { } debugRects.clear(); } + + if (firstUpdate) { + int width, height; + + if (cp.supportsSetDesktopSize && + sscanf(options.desktopSize.buf, "%dx%d", &width, &height) == 2) { + ScreenSet layout; + + layout = cp.screenLayout; + + if (layout.num_screens() == 0) + layout.add_screen(rfb::Screen()); + else if (layout.num_screens() != 1) { + ScreenSet::iterator iter; + + while (true) { + iter = layout.begin(); + ++iter; + + if (iter == layout.end()) + break; + + layout.remove_screen(iter->id); + } + } + + layout.begin()->dimensions.tl.x = 0; + layout.begin()->dimensions.tl.y = 0; + layout.begin()->dimensions.br.x = width; + layout.begin()->dimensions.br.y = height; + + writer()->writeSetDesktopSize(width, height, layout); + } + + firstUpdate = false; + } + if (options.autoSelect) autoSelectFormatAndEncoding(); diff --git a/win/vncviewer/CConn.h b/win/vncviewer/CConn.h index 5dacb1ee..726a6e86 100644 --- a/win/vncviewer/CConn.h +++ b/win/vncviewer/CConn.h @@ -99,6 +99,8 @@ namespace rfb { void bell(); void framebufferUpdateEnd(); void setDesktopSize(int w, int h); + void setExtendedDesktopSize(int reason, int result, int w, int h, + const rfb::ScreenSet& layout); void setCursor(int w, int h, const Point& hotspot, void* data, void* mask); void setName(const char* name); void serverInit(); @@ -144,6 +146,7 @@ namespace rfb { Handle sockEvent; bool reverseConnection; bool requestUpdate; + bool firstUpdate; // Debugging/logging std::list<Rect> debugRects; diff --git a/win/vncviewer/CConnOptions.cxx b/win/vncviewer/CConnOptions.cxx index cb561930..2f889dd0 100644 --- a/win/vncviewer/CConnOptions.cxx +++ b/win/vncviewer/CConnOptions.cxx @@ -65,6 +65,10 @@ static BoolParameter sharedConnection("Shared", "(Default is to disconnect all other clients)", false); +StringParameter desktopSize("DesktopSize", + "Reconfigure desktop size on the server on " + "connect (if possible)", ""); + static BoolParameter sendPtrEvents("SendPointerEvents", "Send pointer (mouse) events to the server.", true); static BoolParameter sendKeyEvents("SendKeyEvents", @@ -133,6 +137,7 @@ lowColourLevel(::lowColourLevel), preferredEncoding(encodingTight), autoSelect(::autoSelect), shared(::sharedConnection), +desktopSize(::desktopSize.getData()), sendPtrEvents(::sendPtrEvents), sendKeyEvents(::sendKeyEvents), showToolbar(::showToolbar), diff --git a/win/vncviewer/CConnOptions.h b/win/vncviewer/CConnOptions.h index 51ab78af..d010d172 100644 --- a/win/vncviewer/CConnOptions.h +++ b/win/vncviewer/CConnOptions.h @@ -56,6 +56,7 @@ namespace rfb { int preferredEncoding; bool autoSelect; bool shared; + CharArray desktopSize; bool sendPtrEvents; bool sendKeyEvents; bool showToolbar; |