We need to be more careful about activating maximized mode when in
full screen, otherwise we'll mess things up.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5003 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index fad5ad3..486daf1 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -581,11 +581,18 @@
 void DesktopWindow::maximizeWindow()
 {
 #if defined(WIN32)
-  WINDOWPLACEMENT wp;
-  wp.length = sizeof(WINDOWPLACEMENT);
-  GetWindowPlacement(fl_xid(this), &wp);
-  wp.showCmd = SW_MAXIMIZE;
-  SetWindowPlacement(fl_xid(this), &wp);
+  // We cannot use ShowWindow() in full screen mode as it will
+  // resize things implicitly. Fortunately modifying the style
+  // directly results in a maximized state once we leave full screen.
+#ifdef HAVE_FLTK_FULLSCREEN
+  if (fullscreen_active()) {
+    WINDOWINFO wi;
+    wi.cbSize = sizeof(WINDOWINFO);
+    GetWindowInfo(fl_xid(this), &wi);
+    SetWindowLongPtr(fl_xid(this), GWL_STYLE, wi.dwStyle | WS_MAXIMIZE);
+  } else
+#endif
+    ShowWindow(fl_xid(this), SW_MAXIMIZE);
 #elif defined(__APPLE__)
   // OS X is somewhat strange and does not really have a concept of a
   // maximized window, so we can simply resize the window to the workarea.