From 49b6910940976e09997f7b5812658c726f9b0e88 Mon Sep 17 00:00:00 2001
From: Alexander Lang <langal@cip.ifi.lmu.de>
Date: Thu, 15 Nov 2012 19:10:25 +0100
Subject: [PATCH 1/2] Added resize() to ClusterWindow()

---
 Source/System/Cluster/Window/Base/OSGClusterWindow.cpp | 16 ++++++++++++++++
 Source/System/Cluster/Window/Base/OSGClusterWindow.h   |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp b/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp
index 9ee1df9..26da48a 100644
--- a/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp
+++ b/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp
@@ -582,6 +582,15 @@ void ClusterWindow::render(RenderActionBase *action)
         _statistics->getElem(statFrameExitTime)->stop();  
 }
 
+void ClusterWindow::resize(int width, int height)
+{
+	Window::resize(width, height);
+    if(getNetwork()->getMainConnection() && getNetwork()->getAspect())
+    {
+        clientResize(width, height);
+    }	
+}
+
 void ClusterWindow::activate(void)
 {
     this->doActivate();
@@ -780,6 +789,13 @@ void ClusterWindow::clientSwap( void )
 #endif
 }
 
+void ClusterWindow::clientResize(int width, int height)
+{
+	if(getClientWindow() != NULL)
+	{
+		getClientWindow()->resize(width, height);
+	}
+}
 /*-------------------------------------------------------------------------*/
 /*                         server methods                                  */
 
diff --git a/Source/System/Cluster/Window/Base/OSGClusterWindow.h b/Source/System/Cluster/Window/Base/OSGClusterWindow.h
index b79585e..6c3f429 100644
--- a/Source/System/Cluster/Window/Base/OSGClusterWindow.h
+++ b/Source/System/Cluster/Window/Base/OSGClusterWindow.h
@@ -104,6 +104,8 @@ class OSG_CLUSTER_DLLMAPPING ClusterWindow : public ClusterWindowBase
     virtual void  init(GLInitFunctor oFunc = GLInitFunctor());
 
     virtual void  render            (RenderActionBase *action);
+	virtual void  resize(int width,
+                         int height);  
 
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
@@ -185,6 +187,8 @@ class OSG_CLUSTER_DLLMAPPING ClusterWindow : public ClusterWindowBase
 
     virtual void clientRender (RenderActionBase *action);
     virtual void clientSwap   (void                    );
+	virtual void clientResize (int width,
+	                           int height              );
 
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
-- 
1.7.11.msysgit.1


From 57ede4a4f2dbda2365a10e5ad75cc5804fa15769 Mon Sep 17 00:00:00 2001
From: Alexander Lang <langal@cip.ifi.lmu.de>
Date: Thu, 15 Nov 2012 20:44:48 +0100
Subject: [PATCH 2/2] ClusterWindow: use boost::function for connection
 callback

---
 .../System/Cluster/Window/Base/OSGClusterWindow.cpp   | 19 +++++++------------
 Source/System/Cluster/Window/Base/OSGClusterWindow.h  | 10 ++++++----
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp b/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp
index 26da48a..7b30f15 100644
--- a/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp
+++ b/Source/System/Cluster/Window/Base/OSGClusterWindow.cpp
@@ -243,10 +243,7 @@ void ClusterWindow::init(GLInitFunctor)
                 // update progress
                 if(_connectionFP != NULL)
                 {
-                    std::string message;
-                    message += "Starting:" + (*getMFServers())[id]; 
-
-                    if(!_connectionFP(message, progress))
+                    if(!_connectionFP("Starting:", (*getMFServers())[id], progress))
                     {
                         // abort, cleanup remaining pipes
                         for( ; id<getMFServers()->size() ; ++id)
@@ -331,9 +328,7 @@ void ClusterWindow::init(GLInitFunctor)
                 // update progress
                 if(_connectionFP != NULL)
                 {
-                    std::string message;
-                    message += "Connecting:" + *s; 
-                    if(!_connectionFP(message, progress))
+                    if(!_connectionFP("Connecting:", *s, progress))
                     {
                         serviceSock.close();
                         throw AsyncCancel();
@@ -423,7 +418,7 @@ void ClusterWindow::init(GLInitFunctor)
                         if(pointSock != NULL)
                         {
                             /* for all socket connections ignore the
-                               incomming host and use the host from
+                               incoming host and use the host from
                                the last response. */
 
                             char port[16];
@@ -495,13 +490,13 @@ void ClusterWindow::init(GLInitFunctor)
 
     // inform connection finished
     if(_connectionFP != NULL)
-        _connectionFP("ok", 1.0);
+        _connectionFP("ClusterWindow initialization completed.", "", 1.0f);
 }
 
-bool ClusterWindow::initAsync(connectioncbfp fp)
+bool ClusterWindow::initAsync(const ConnectionCB& fp)
 {
     bool result;
-    connectioncbfp saveFP = _connectionFP;
+    ConnectionCB saveFP(_connectionFP);
 
     _connectionFP = fp;
 
@@ -519,7 +514,7 @@ bool ClusterWindow::initAsync(connectioncbfp fp)
     return result;
 }
 
-void ClusterWindow::setConnectionCB(connectioncbfp fp)
+void ClusterWindow::setConnectionCB(const ConnectionCB& fp)
 {
     _connectionFP = fp;
 }
diff --git a/Source/System/Cluster/Window/Base/OSGClusterWindow.h b/Source/System/Cluster/Window/Base/OSGClusterWindow.h
index 6c3f429..040f440 100644
--- a/Source/System/Cluster/Window/Base/OSGClusterWindow.h
+++ b/Source/System/Cluster/Window/Base/OSGClusterWindow.h
@@ -46,6 +46,8 @@
 #include "OSGStatElemTypes.h"
 #include "OSGImageComposer.h"
 
+#include <boost/function.hpp>
+
 OSG_BEGIN_NAMESPACE
 
 class StatCollector;
@@ -123,10 +125,10 @@ class OSG_CLUSTER_DLLMAPPING ClusterWindow : public ClusterWindowBase
     /*! \name            asynchronous initialization                       */
     /*! \{                                                                 */
 
-    typedef bool (*connectioncbfp)(std::string server, Real32 progress);
+    typedef boost::function<bool (const std::string& msg, const std::string& server, Real32 progress)> ConnectionCB;
 
-    bool initAsync      (connectioncbfp fp);
-    void setConnectionCB(connectioncbfp fp);
+    bool initAsync      (const ConnectionCB& fp);
+    void setConnectionCB(const ConnectionCB& fp);
 
     /*! \}                                                                 */
     /*---------------------------------------------------------------------*/
@@ -253,7 +255,7 @@ class OSG_CLUSTER_DLLMAPPING ClusterWindow : public ClusterWindowBase
     /*! \name               private members                                */
     /*! \{                                                                 */
 
-    connectioncbfp       _connectionFP;
+    ConnectionCB         _connectionFP;
     ClusterNetworkRefPtr _network;
 
     /*! \}                                                                 */
-- 
1.7.11.msysgit.1

