From 2285679d9bda3f7376564fa1fadce782ee917a80 Mon Sep 17 00:00:00 2001 From: george82 Date: Sat, 10 Jun 2006 11:47:22 +0000 Subject: [PATCH] Fixed the bug with the main window resizing (don't take the toolbar height into calculation of the main window size). git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@636 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/vncviewer/CConn.cxx | 2 +- win/vncviewer/DesktopWindow.cxx | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx index bfac4768..9f597ed0 100644 --- a/win/vncviewer/CConn.cxx +++ b/win/vncviewer/CConn.cxx @@ -611,9 +611,9 @@ void CConn::serverInit() { // Show the window window = new DesktopWindow(this); + applyOptions(options); window->setName(cp.name()); window->setSize(cp.width, cp.height); - applyOptions(options); // Save the server's current format serverDefaultPF = cp.pf(); diff --git a/win/vncviewer/DesktopWindow.cxx b/win/vncviewer/DesktopWindow.cxx index fcf829f9..d4bc3e76 100644 --- a/win/vncviewer/DesktopWindow.cxx +++ b/win/vncviewer/DesktopWindow.cxx @@ -301,12 +301,21 @@ void DesktopWindow::setFullscreen(bool fs) { void DesktopWindow::setShowToolbar(bool st) { showToolbar = st; + RECT r; + GetWindowRect(handle, &r); + bool maximized = GetWindowLong(handle, GWL_STYLE) & WS_MAXIMIZE; - if (showToolbar && !tb.isVisible() && !fullscreenActive) { + if (showToolbar && !tb.isVisible()) { tb.show(); + if (!maximized) r.bottom += tb.getHeight(); } else if (!showToolbar && tb.isVisible()) { tb.hide(); + if (!maximized) r.bottom -= tb.getHeight(); } + // Resize the chiled windows even if the parent window size + // has not been changed (the main window is maximized) + if (maximized) SendMessage(handle, WM_SIZE, 0, 0); + else SetWindowPos(handle, NULL, 0, 0, r.right-r.left, r.bottom-r.top, SWP_NOMOVE | SWP_NOZORDER); } void DesktopWindow::setDisableWinKeys(bool dwk) { -- 2.39.5