Index: /trunk/source/visualization/OpenInventor/History
===================================================================
--- /trunk/source/visualization/OpenInventor/History	(revision 1096)
+++ /trunk/source/visualization/OpenInventor/History	(revision 1097)
@@ -20,4 +20,8 @@
 History file for visualization/OpenInventor
 -------------------------------------------
+
+18 August 2009 Laurent Garnier
+ - G4OpenInventorXt/WinViewer : Fix a wrong initialization introduce by the 
+   new way of handling window size hints (January 2009)
 
 24 July 2009, Laurent Garnier
Index: /trunk/source/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh
===================================================================
--- /trunk/source/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh	(revision 1096)
+++ /trunk/source/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh	(revision 1097)
@@ -55,4 +55,6 @@
 		       const G4String& name = "");
   virtual ~G4OpenInventorWinViewer();
+  void Initialise();
+
 private:
   static LRESULT CALLBACK WindowProc(HWND,UINT,WPARAM,LPARAM);
Index: /trunk/source/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh
===================================================================
--- /trunk/source/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh	(revision 1096)
+++ /trunk/source/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh	(revision 1097)
@@ -53,4 +53,6 @@
   G4OpenInventorXtViewer(G4OpenInventorSceneHandler& scene,
 		         const G4String& name = "");
+  void Initialise();
+
   virtual ~G4OpenInventorXtViewer();
 private:
Index: /trunk/source/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc
===================================================================
--- /trunk/source/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc	(revision 1096)
+++ /trunk/source/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc	(revision 1097)
@@ -65,5 +65,4 @@
 };
 
-#define SIZE 600
 // File : 
 #define ID_FILE_POSTSCRIPT 1
@@ -98,5 +97,13 @@
   G4cout << "Window name: " << fName << G4endl;
 
+}
+
+
+void G4OpenInventorWinViewer::Initialise() {
+
   G4String wName = fName;
+
+  int width = 600;
+  int height = 600;
 
   HWND parent = (HWND)fInteractorManager->GetParentInteractor ();
@@ -122,5 +129,20 @@
       done = TRUE;
     }
-
+    
+    G4String sgeometry = fVP.GetXGeometryString();
+    if(sgeometry.empty()) {
+      G4cout << "ERROR: Geometry string \""
+             << sgeometry	   
+             << "\" is empty.  Using \"600x600\"."
+             << G4endl;
+      width = 600;
+      height = 600;  
+      sprintf(s,"%dx%d",width,height);
+      sgeometry = s;
+    } else {
+      width = fVP.GetWindowSizeHintX();
+      height = fVP.GetWindowSizeHintX();
+    }
+    
     HMENU menuBar = CreateMenu();
 
@@ -157,5 +179,5 @@
                             WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
                             CW_USEDEFAULT, CW_USEDEFAULT, 
-                            SIZE,SIZE,
+                            width,height,
                             0,menuBar,::GetModuleHandle(0),0);
     // Retreive window and client sizez :
@@ -167,6 +189,6 @@
     int cw = crect.right-crect.left;
     int ch = crect.bottom-crect.top;
-    // Compell client rect to be SIZE SIZE :
-    MoveWindow((HWND)fShell,wrect.left,wrect.top,SIZE+ww-cw,SIZE+wh-ch,TRUE);
+    // Compell client rect to be width height :
+    MoveWindow((HWND)fShell,wrect.left,wrect.top,width+ww-cw,height+wh-ch,TRUE);
     ::SetWindowLong((HWND)fShell,GWL_USERDATA,LONG(this));
     ::SetWindowText((HWND)fShell,shellName.c_str());
@@ -184,5 +206,5 @@
   fViewer->setGLRenderAction(fGL2PSAction);
 
-  fViewer->setSize(SbVec2s(SIZE,SIZE));
+  fViewer->setSize(SbVec2s(width,height));
   fViewer->setSceneGraph(fSoSelection);
   fViewer->viewAll();
Index: /trunk/source/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc
===================================================================
--- /trunk/source/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc	(revision 1096)
+++ /trunk/source/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc	(revision 1097)
@@ -76,15 +76,33 @@
 {
   G4cout << "Window name: " << fName << G4endl;
-
+}
+
+
+void G4OpenInventorXtViewer::Initialise() {
+  
   G4String wName = fName;
-
-#define SIZE 600
+  
   Widget parent = (Widget)fInteractorManager->GetParentInteractor ();
+  int width = 600;
+  int height = 600;
+
   if(!parent) {  
     // Check if user has specified an X-Windows-type geometry string...
     char s[32];
-    sprintf(s,"%dx%d",SIZE,SIZE);
+
     G4String sgeometry = fVP.GetXGeometryString();
-    if(sgeometry.empty()) sgeometry = s;
+    if(sgeometry.empty()) {
+      G4cout << "ERROR: Geometry string \""
+             << sgeometry	   
+             << "\" is empty.  Using \"600x600\"."
+             << G4endl;
+      width = 600;
+      height = 600;  
+      sprintf(s,"%dx%d",width,height);
+      sgeometry = s;
+    } else {
+      width = fVP.GetWindowSizeHintX();
+      height = fVP.GetWindowSizeHintX();
+    }
 
     //Create a shell window :
@@ -167,5 +185,5 @@
   }
 
-  fViewer->setSize(SbVec2s(SIZE,SIZE));
+  fViewer->setSize(SbVec2s(width,height));
 
   // Have a GL2PS render action :
