ekiga r5917 - in trunk: . lib lib/engine lib/engine/display/common lib/engine/display/dx lib/engine/display/skel lib/engine/display/x src src/devices src/endpoints src/gui



Author: mschneid
Date: Tue Jan 15 07:48:04 2008
New Revision: 5917
URL: http://svn.gnome.org/viewvc/ekiga?rev=5917&view=rev

Log:
Move video output to the engine. The X/XV output only depends
on PTLIB for tracing and PThread, and on Xlib / Xv.


Added:
   trunk/lib/engine/display/dx/display-manager-dx.cpp
   trunk/lib/engine/display/dx/display-manager-dx.h
Removed:
   trunk/lib/engine/display/dx/display-manager-x.cpp
   trunk/lib/engine/display/dx/display-manager-x.h
Modified:
   trunk/ChangeLog
   trunk/lib/Makefile.am
   trunk/lib/engine/Makefile.am
   trunk/lib/engine/display/common/display-manager-common.cpp
   trunk/lib/engine/display/common/display-manager-common.h
   trunk/lib/engine/display/dx/Makefile.am
   trunk/lib/engine/display/skel/Makefile.am
   trunk/lib/engine/display/skel/display-core.cpp
   trunk/lib/engine/display/skel/display-core.h
   trunk/lib/engine/display/skel/display-info.h
   trunk/lib/engine/display/skel/display-manager.h
   trunk/lib/engine/display/x/Makefile.am
   trunk/lib/engine/display/x/display-manager-x.cpp
   trunk/lib/engine/display/x/display-manager-x.h
   trunk/src/Makefile.am
   trunk/src/common.h
   trunk/src/devices/videooutput.cpp
   trunk/src/devices/videooutput.h
   trunk/src/endpoints/ekiga.h
   trunk/src/gui/main.cpp
   trunk/src/gui/main.h

Modified: trunk/lib/Makefile.am
==============================================================================
--- trunk/lib/Makefile.am	(original)
+++ trunk/lib/Makefile.am	Tue Jan 15 07:48:04 2008
@@ -1,9 +1,11 @@
-SUBDIRS = gmconf gui toolbox platform engine
+SUBDIRS = gmconf gui toolbox platform
 
 if !WIN32
 SUBDIRS += pixops
 endif
 
+SUBDIRS += engine
+
 
 noinst_LTLIBRARIES = libekiga.la
 

Modified: trunk/lib/engine/Makefile.am
==============================================================================
--- trunk/lib/engine/Makefile.am	(original)
+++ trunk/lib/engine/Makefile.am	Tue Jan 15 07:48:04 2008
@@ -52,7 +52,8 @@
 # XVideo/X
 if !WIN32
 libekiga_engine_la_LIBADD += \
-	$(top_builddir)/lib/engine/display/x/libgmdisplay-x.la
+	$(top_builddir)/lib/engine/display/x/libgmdisplay-x.la \
+	$(top_builddir)/lib/pixops/libpixops.la
 endif
 
 # DirectX

Modified: trunk/lib/engine/display/common/display-manager-common.cpp
==============================================================================
--- trunk/lib/engine/display/common/display-manager-common.cpp	(original)
+++ trunk/lib/engine/display/common/display-manager-common.cpp	Tue Jan 15 07:48:04 2008
@@ -61,7 +61,7 @@
   Ekiga::DisplayManager::start();
 
   /* State for last frame */
-  last_frame.display = UNSET_new;
+  last_frame.display = UNSET;
   last_frame.local_width = 0;
   last_frame.local_height = 0;
   last_frame.remote_width = 0;
@@ -82,15 +82,9 @@
   update_required.local = false;
   update_required.remote = false;
 
-  rx_frames = 0;
-  tx_frames = 0;
-
-  last_stats = PTime ();
-
 //  this->Resume ();
   this->Restart ();
   thread_sync_point.Wait ();
-printf ("Start\n");
 }
 
 void GMDisplayManager::stop () {
@@ -104,7 +98,6 @@
   rframeStore.SetSize (0);
 
   Ekiga::DisplayManager::stop();
-printf ("Stop\n");
 }
 
 void
@@ -118,7 +111,6 @@
 
   while (!end_thread) {
     frame_available_sync_point.Wait(250);
-printf ("Thread\n");
     var_mutex.Wait ();
       do_sync = first_frame_received;
       if (first_frame_received)
@@ -144,8 +136,6 @@
 
   get_display_info(local_display_info);
 
-printf ("SetFrameData\n");
-
   var_mutex.Wait();
 
   /* If there is only one device open, ignore the setting, and 
@@ -154,11 +144,11 @@
   if (devices_nbr <= 1) {
 
     if (!local)
-      local_display_info.display = REMOTE_VIDEO_new;
+      local_display_info.display = REMOTE_VIDEO;
     else 
-      local_display_info.display = LOCAL_VIDEO_new;
+      local_display_info.display = LOCAL_VIDEO;
 
-    runtime.run_in_main (sigc::bind (display_type_changed.make_slot (), local_display_info.display));
+    runtime.run_in_main (sigc::bind (display_mode_changed.make_slot (), local_display_info.display));
   }
 
   current_frame.display = local_display_info.display;
@@ -172,14 +162,6 @@
     current_frame.local_width = width;
     current_frame.local_height= height;
 
-    tx_frames++;
-    
-    if ((width != display_stats.tx_width) || (height != display_stats.tx_height)) {
-      display_stats.tx_width = width;
-      display_stats.tx_height = height;
-      //FIXME
-    }
-
     memcpy (lframeStore.GetPointer(), data, (width * height * 3) >> 1);
     if (update_required.local) 
       PTRACE(3, "Skipped earlier local frame");
@@ -191,14 +173,6 @@
     rframeStore.SetSize (width * height * 3);
     current_frame.remote_width = width;
     current_frame.remote_height= height;
-    
-    rx_frames++;
-
-    if ((width != display_stats.rx_width) || (height != display_stats.rx_height)) {
-      display_stats.rx_width = width;
-      display_stats.rx_height = height;
-      //FIXME
-    }
 
     memcpy (rframeStore.GetPointer(), data, (width * height * 3) >> 1);
     if (update_required.remote) 
@@ -206,30 +180,20 @@
     update_required.remote = true;
   }
 
-  PTimeInterval t = PTime () - last_stats;
-  if (t.GetMilliSeconds() > 2000) {
-    display_stats.tx_fps = round ((rx_frames * 1000) / t.GetMilliSeconds());
-    display_stats.rx_fps = round ((tx_frames * 1000) / t.GetMilliSeconds());
-    rx_frames = 0;
-    tx_frames = 0;
-    last_stats = PTime();
-    //FIXME
-  }
-
   var_mutex.Signal();
 
-  if ((local_display_info.display == UNSET_new) || (local_display_info.zoom == 0) || (!local_display_info.gconfInfoSet)) {
+  if ((local_display_info.display == UNSET) || (local_display_info.zoom == 0) || (!local_display_info.gconfInfoSet)) {
     runtime.run_in_main (display_info_update_required.make_slot ());
     PTRACE(4, "GMVideoDisplay_embedded\tDisplay and zoom variable not set yet, not opening display");
      return;
   }
 
-  if ((local_display_info.display == LOCAL_VIDEO_new) && !local)
+  if ((local_display_info.display == LOCAL_VIDEO) && !local)
       return;
 
-  if ((local_display_info.display == REMOTE_VIDEO_new) && local)
+  if ((local_display_info.display == REMOTE_VIDEO) && local)
       return;
-printf ("Signaling\n");
+
   frame_available_sync_point.Signal();
 }
 
@@ -246,36 +210,36 @@
   get_display_info(local_display_info);
 
   if ((!local_display_info.widgetInfoSet) || (!local_display_info.gconfInfoSet) ||
-      (local_display_info.display == UNSET_new) || (local_display_info.zoom == 0)) {
+      (local_display_info.display == UNSET) || (local_display_info.zoom == 0)) {
     PTRACE(4, "GMVideoDisplay_X\tWidget not yet realized or gconf info not yet set, not opening display");
     return false;
   }
   switch (display) {
-  case LOCAL_VIDEO_new:
-    return (last_frame.display != LOCAL_VIDEO_new 
+  case LOCAL_VIDEO:
+    return (last_frame.display != LOCAL_VIDEO 
             || last_frame.zoom != zoom || last_frame.local_width != lf_width || last_frame.local_height != lf_height 
             || local_display_info.x != last_frame.embedded_x || local_display_info.y != last_frame.embedded_y);
     break;
 
-  case REMOTE_VIDEO_new:
-    return (last_frame.display != REMOTE_VIDEO_new
+  case REMOTE_VIDEO:
+    return (last_frame.display != REMOTE_VIDEO
             || last_frame.zoom != zoom || last_frame.remote_width != rf_width || last_frame.remote_height != rf_height
             || local_display_info.x != last_frame.embedded_x || local_display_info.y != last_frame.embedded_y);
     break;
 
-  case PIP_new:
+  case PIP:
     return (last_frame.display != display || last_frame.zoom != zoom 
             || last_frame.remote_width != rf_width || last_frame.remote_height != rf_height
             || last_frame.local_width != lf_width || last_frame.local_height != lf_height
             || local_display_info.x != last_frame.embedded_x || local_display_info.y != last_frame.embedded_y);
     break;
-  case PIP_WINDOW_new:
-  case FULLSCREEN_new:
+  case PIP_WINDOW:
+  case FULLSCREEN:
     return (last_frame.display != display || last_frame.zoom != zoom 
             || last_frame.remote_width != rf_width || last_frame.remote_height != rf_height
             || last_frame.local_width != lf_width || last_frame.local_height != lf_height);
     break;
-  case UNSET_new:
+  case UNSET:
   default:
     break;
   }
@@ -295,24 +259,24 @@
 
     switch (current_frame.display) 
       {
-      case LOCAL_VIDEO_new:
+      case LOCAL_VIDEO:
           if (lframeStore.GetSize() > 0)
             display_frame ((char*)lframeStore.GetPointer (), current_frame.local_width, current_frame.local_height);
         break;
 
-      case REMOTE_VIDEO_new:
+      case REMOTE_VIDEO:
           if (rframeStore.GetSize() > 0)
             display_frame ((char*)rframeStore.GetPointer (), current_frame.remote_width, current_frame.remote_height);
         break;
 
-     case FULLSCREEN_new:
-     case PIP_new:
-     case PIP_WINDOW_new:
+     case FULLSCREEN:
+     case PIP:
+     case PIP_WINDOW:
           if ((lframeStore.GetSize() > 0) &&  (rframeStore.GetSize() > 0))
             display_pip_frames ((char*)lframeStore.GetPointer (), current_frame.local_width, current_frame.local_height,
                               (char*)rframeStore.GetPointer (), current_frame.remote_width, current_frame.remote_height);
        break;
-    case UNSET_new:
+    case UNSET:
     default:
        break;
     }

Modified: trunk/lib/engine/display/common/display-manager-common.h
==============================================================================
--- trunk/lib/engine/display/common/display-manager-common.h	(original)
+++ trunk/lib/engine/display/common/display-manager-common.h	Tue Jan 15 07:48:04 2008
@@ -49,8 +49,8 @@
 #include "display-manager.h"
 #include "runtime.h"
 //FIXME
-#include "../../../../../ptlib/include/ptbuildopts.h"
-#include "../../../../../ptlib/include/ptlib.h"
+#include "ptbuildopts.h"
+#include "ptlib.h"
 
 
 typedef struct {
@@ -219,9 +219,6 @@
 
   FrameInfo last_frame;
   FrameInfo current_frame;
-
-  unsigned rx_frames;
-  unsigned tx_frames;
   
   bool end_thread;
   bool first_frame_received;
@@ -235,8 +232,6 @@
   PSyncPoint frame_available_sync_point;     /* To signal a new frame has to be displayed  */
   PSyncPoint thread_sync_point;              /* To signal that the thread has been created */
 
-  PTime last_stats;
-
   Ekiga::Runtime & runtime;
   Ekiga::ServiceCore & core;
 };

Modified: trunk/lib/engine/display/dx/Makefile.am
==============================================================================
--- trunk/lib/engine/display/dx/Makefile.am	(original)
+++ trunk/lib/engine/display/dx/Makefile.am	Tue Jan 15 07:48:04 2008
@@ -3,7 +3,7 @@
 display_dir = $(top_srcdir)/lib/engine/display/dx
 common_dir = $(top_srcdir)/lib/engine/display/common
 
-AM_CXXFLAGS = $(SIGC_CFLAGS)
+AM_CXXFLAGS = $(SIGC_CFLAGS) $(PTLIB_CFLAGS) $(DX_CFLAGS)
 
 INCLUDES = \
 	-I$(top_srcdir)/lib/engine/include \
@@ -19,4 +19,4 @@
 	$(display_dir)/display-main-dx.cpp    \
 	$(display_dir)/display-main-dx.h
 
-libgmdisplay_dx_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS)
+libgmdisplay_dx_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(PTLIB_LIBS) $(DX_LIBS)

Added: trunk/lib/engine/display/dx/display-manager-dx.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/display/dx/display-manager-dx.cpp	Tue Jan 15 07:48:04 2008
@@ -0,0 +1,43 @@
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2007 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         display-manager-dx.cpp -  description
+ *                         ----------------------------------
+ *   begin                : Sun Nov 19 2006
+ *   copyright            : (C) 2006-2008 by Matthias Schneider
+ *                          (C) 2000-2008 by Damien Sandras
+ *   description          : Class to allow video output to a DirectX
+ *                          accelerated window
+ */
+
+#include "display-manager-dx.h"
+
+GMDisplayManager_dx::GMDisplayManager_dx (Ekiga::ServiceCore & core)
+: GMDisplayManager(core)
+{
+}

Added: trunk/lib/engine/display/dx/display-manager-dx.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/display/dx/display-manager-dx.h	Tue Jan 15 07:48:04 2008
@@ -0,0 +1,93 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2006 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+*                         display-manager-dx.h -  description
+ *                         ----------------------------------
+ *   begin                : Sun Nov 19 2006
+ *   copyright            : (C) 2006-2008 by Matthias Schneider
+ *                          (C) 2000-2008 by Damien Sandras
+ *   description          : Class to allow video output to a DirectX
+ *                          accelerated window
+ 
+ */
+
+
+#ifndef _DISPLAY_MANAGER_DX_H_
+#define _DISPLAY_MANAGER_DX_H_
+
+#include "display-manager-common.h"
+
+class GMDisplayManager_dx
+   : public  GMDisplayManager
+{
+public:
+  GMDisplayManager_dx (Ekiga::ServiceCore & core);
+  virtual void setup_frame_display (DisplayMode display, 
+                                    unsigned lf_width, 
+                                    unsigned lf_height, 
+                                    unsigned rf_width, 
+                                    unsigned rf_height, 
+                                    unsigned int zoom) {};
+
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Closes the frame display and returns FALSE 
+   *                 in case of failure.
+   * PRE          :  /
+   */
+  virtual bool close_frame_display () {return true;};
+
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Display the given frame on the correct display.
+   * PRE          :  The display needs to be initialized using 
+   *                 SetupFrameDisplay. 
+   */
+  virtual void display_frame (const char *frame,
+                             unsigned width,
+                             unsigned height) {};
+
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Display the given frames as Picture in Picture.
+   * PRE          :  The display needs to be initialized using 
+   *                 SetupFrameDisplay. 
+   */
+  virtual void display_pip_frames (const char *local_frame,
+                                 unsigned lf_width,
+                                 unsigned lf_height,
+                                 const char *remote_frame,
+                                 unsigned rf_width,
+                                 unsigned rf_height) {};
+  
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Sync the output of the frame to the display
+   * PRE          :  /
+   */
+  virtual void sync(UpdateRequired sync_required) {};
+
+};
+#endif /* VIDEODISPLAY_DX */

Modified: trunk/lib/engine/display/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/display/skel/Makefile.am	(original)
+++ trunk/lib/engine/display/skel/Makefile.am	Tue Jan 15 07:48:04 2008
@@ -2,7 +2,7 @@
 
 display_dir = $(top_srcdir)/lib/engine/display/skel
 
-AM_CXXFLAGS = $(SIGC_CFLAGS)
+AM_CXXFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS)
 
 INCLUDES = \
 	-I$(top_srcdir)/lib/engine/include \
@@ -14,4 +14,4 @@
 	$(display_dir)/display-core.h		\
 	$(display_dir)/display-core.cpp
 
-libgmdisplay_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS)
+libgmdisplay_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(GLIB_LIBS)

Modified: trunk/lib/engine/display/skel/display-core.cpp
==============================================================================
--- trunk/lib/engine/display/skel/display-core.cpp	(original)
+++ trunk/lib/engine/display/skel/display-core.cpp	Tue Jan 15 07:48:04 2008
@@ -42,18 +42,26 @@
 #include "display-core.h"
 #include "display-manager.h"
 
+#include <math.h>
 
 using namespace Ekiga;
 
+DisplayCore::DisplayCore ()
+{
+  display_stats.rx_width = display_stats.rx_height = display_stats.rx_fps = 0;
+  display_stats.tx_width = display_stats.tx_height = display_stats.tx_fps = 0;
+  display_stats.rx_frames = 0;
+  display_stats.tx_frames = 0;
+}
 
 void DisplayCore::add_manager (DisplayManager &manager)
 {
   managers.insert (&manager);
   manager_added.emit (manager);
 
-  manager.display_type_changed.connect (sigc::bind (sigc::mem_fun (this, &DisplayCore::on_display_type_changed), &manager));
+  manager.display_mode_changed.connect (sigc::bind (sigc::mem_fun (this, &DisplayCore::on_display_mode_changed), &manager));
   manager.fullscreen_mode_changed.connect (sigc::bind (sigc::mem_fun (this, &DisplayCore::on_fullscreen_mode_changed), &manager));
-  manager.size_changed.connect (sigc::bind (sigc::mem_fun (this, &DisplayCore::on_size_changed), &manager));
+  manager.display_size_changed.connect (sigc::bind (sigc::mem_fun (this, &DisplayCore::on_display_size_changed), &manager));
   manager.logo_update_required.connect (sigc::bind (sigc::mem_fun (this, &DisplayCore::on_logo_update_required), &manager));
   manager.display_info_update_required.connect (sigc::bind (sigc::mem_fun (this, &DisplayCore::on_display_info_update_required), &manager));
 }
@@ -70,6 +78,8 @@
 
 void DisplayCore::start ()
 {
+  g_get_current_time (&last_stats);
+
   for (std::set<DisplayManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++) {
@@ -84,6 +94,10 @@
        iter++) {
     (*iter)->stop ();
   }
+  display_stats.rx_width = display_stats.rx_height = display_stats.rx_fps = 0;
+  display_stats.tx_width = display_stats.tx_height = display_stats.tx_fps = 0;
+  display_stats.rx_frames = 0;
+  display_stats.tx_frames = 0;
 }
 
 void DisplayCore::set_frame_data (unsigned width,
@@ -92,6 +106,31 @@
                                   bool local,
                                   int devices_nbr)
 {
+  if (local) {
+    display_stats.tx_frames++;
+    display_stats.tx_width = width;
+    display_stats.tx_height = height;
+  }
+  else {
+    display_stats.rx_frames++;
+    display_stats.rx_width = width;
+    display_stats.rx_height = height;
+  }
+
+  GTimeVal current_time;
+  g_get_current_time (&current_time);
+
+  long unsigned milliseconds = ((current_time.tv_sec - last_stats.tv_sec) * 1000) 
+                             + ((current_time.tv_usec - last_stats.tv_usec) / 1000);
+
+  if (milliseconds > 2000) {
+    display_stats.tx_fps = round ((display_stats.rx_frames * 1000) / milliseconds);
+    display_stats.rx_fps = round ((display_stats.tx_frames * 1000) / milliseconds);
+    display_stats.rx_frames = 0;
+    display_stats.tx_frames = 0;
+    g_get_current_time (&last_stats);
+  }
+
   for (std::set<DisplayManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++) {
@@ -99,29 +138,29 @@
   }
 }
 
-void DisplayCore::set_video_info (const DisplayInfo & newVideoInfo)
+void DisplayCore::set_display_info (const DisplayInfo & _display_info)
 {
   for (std::set<DisplayManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++) {
-    (*iter)->set_display_info (newVideoInfo);
+    (*iter)->set_display_info (_display_info);
   }
 }
 
 
-void DisplayCore::on_display_type_changed (DisplayMode display, DisplayManager *manager)
+void DisplayCore::on_display_mode_changed (DisplayMode display, DisplayManager *manager)
 {
-  display_type_changed.emit (*manager, display);
+  display_mode_changed.emit (*manager, display);
 }
 
-void DisplayCore::on_fullscreen_mode_changed ( FSToggle_new toggle, DisplayManager *manager)
+void DisplayCore::on_fullscreen_mode_changed ( FSToggle toggle, DisplayManager *manager)
 {
   fullscreen_mode_changed.emit (*manager, toggle);
 }
 
-void DisplayCore::on_size_changed ( unsigned width, unsigned height, DisplayManager *manager)
+void DisplayCore::on_display_size_changed ( unsigned width, unsigned height, DisplayManager *manager)
 {
-  size_changed.emit (*manager, width, height);
+  display_size_changed.emit (*manager, width, height);
 }
 
 void DisplayCore::on_logo_update_required (DisplayManager *manager)

Modified: trunk/lib/engine/display/skel/display-core.h
==============================================================================
--- trunk/lib/engine/display/skel/display-core.h	(original)
+++ trunk/lib/engine/display/skel/display-core.h	Tue Jan 15 07:48:04 2008
@@ -45,6 +45,8 @@
 #include <set>
 #include <map>
 
+#include <glib.h>
+
 namespace Ekiga {
   class DisplayManager;
 
@@ -56,7 +58,7 @@
 
       /* The constructor
       */
-      DisplayCore () {}
+      DisplayCore ();
 
       /* The destructor
       */
@@ -107,28 +109,34 @@
                            bool local,
                            int devices_nbr);
 
-      void set_video_info (const DisplayInfo & newVideoInfo);
+      void set_display_info (const DisplayInfo & _display_info);
 
       /*** Display Related Signals ***/
       
       /** See display-manager.h for the API
        */
-      sigc::signal<void, DisplayManager &, DisplayMode> display_type_changed;       /* gm_main_window_set_display_type */
-      sigc::signal<void, DisplayManager &, FSToggle_new> fullscreen_mode_changed;     /* gm_main_window_toggle_fullscreen */
-      sigc::signal<void, DisplayManager &, unsigned, unsigned> size_changed;          /* gm_main_window_set_resized_video_widget */
-      sigc::signal<void, DisplayManager &> logo_update_required;                      /* gm_main_window_update_logo  */
-      sigc::signal<void, DisplayManager &> display_info_update_required;                /* gm_main_window_update_zoom_display */
+      sigc::signal<void, DisplayManager &, DisplayMode> display_mode_changed;
+      sigc::signal<void, DisplayManager &, FSToggle> fullscreen_mode_changed;
+      sigc::signal<void, DisplayManager &, unsigned, unsigned> display_size_changed;
+      sigc::signal<void, DisplayManager &> logo_update_required;
+      sigc::signal<void, DisplayManager &> display_info_update_required;
 //      sigc::signal<void, DisplayManager &, VideoAccelStatus> update_video_accel_status; /* gm_main_window_update_video_accel_status */
 
-
+      /*** Statistics ***/
+      void get_display_stats (DisplayStats & _display_stats) {
+        _display_stats = display_stats;
+      };
   private:
-      void on_display_type_changed (DisplayMode display, DisplayManager *manager);
-      void on_fullscreen_mode_changed (FSToggle_new toggle, DisplayManager *manager);
-      void on_size_changed ( unsigned width, unsigned height, DisplayManager *manager);
+      void on_display_mode_changed (DisplayMode display, DisplayManager *manager);
+      void on_fullscreen_mode_changed (FSToggle toggle, DisplayManager *manager);
+      void on_display_size_changed ( unsigned width, unsigned height, DisplayManager *manager);
       void on_logo_update_required (DisplayManager *manager);
       void on_display_info_update_required (DisplayManager *manager);
 
       std::set<DisplayManager *> managers;
+
+      DisplayStats display_stats;
+      GTimeVal last_stats;
     };  
 };
 

Modified: trunk/lib/engine/display/skel/display-info.h
==============================================================================
--- trunk/lib/engine/display/skel/display-info.h	(original)
+++ trunk/lib/engine/display/skel/display-info.h	Tue Jan 15 07:48:04 2008
@@ -46,40 +46,41 @@
   /* Video modes */
   typedef enum {
   
-    LOCAL_VIDEO_new, 
-    REMOTE_VIDEO_new, 
-    PIP_new,
-    PIP_WINDOW_new,
-    FULLSCREEN_new,
-    UNSET_new
+    LOCAL_VIDEO, 
+    REMOTE_VIDEO, 
+    PIP,
+    PIP_WINDOW,
+    FULLSCREEN,
+    UNSET
   } DisplayMode;
   
   /* Toggle operations for Fullscreen */
   typedef enum {
   
-    ON_new,
-    OFF_new,
-    TOGGLE_new
-  } FSToggle_new;
+    ON,
+    OFF,
+    TOGGLE
+  } FSToggle;
   
   /* Video Acceleration Status */
   typedef enum {
   
-    NONE_new,
-    REMOTE_ONLY_new,
-    ALL_new,
-    NO_VIDEO_new
-  } VideoAccelStatus_new;  //FIXME
+    NONE,
+    REMOTE_ONLY,
+    ALL,
+    NO_VIDEO
+  } DisplayAccelStatus;  //FIXME
 
 
   typedef struct {
     unsigned rx_fps;
     unsigned rx_width;
     unsigned rx_height;
+    unsigned rx_frames;
     unsigned tx_fps;
     unsigned tx_width;
     unsigned tx_height;
-    VideoAccelStatus_new video_accel_status;
+    unsigned tx_frames;
   } DisplayStats;
 
   class DisplayInfo
@@ -103,7 +104,7 @@
       allowPipSwScaling = true;
       swScalingAlgorithm = 0;
   
-      display = UNSET_new;
+      display = UNSET;
       zoom = 0;
     };
     
@@ -129,7 +130,7 @@
         allowPipSwScaling = rhs.allowPipSwScaling;
         swScalingAlgorithm =  rhs.swScalingAlgorithm;
       }
-      if (rhs.display != UNSET_new) display = rhs.display;
+      if (rhs.display != UNSET) display = rhs.display;
       if (rhs.zoom != 0) zoom = rhs.zoom;
     };
   

Modified: trunk/lib/engine/display/skel/display-manager.h
==============================================================================
--- trunk/lib/engine/display/skel/display-manager.h	(original)
+++ trunk/lib/engine/display/skel/display-manager.h	Tue Jan 15 07:48:04 2008
@@ -64,11 +64,7 @@
        * @param: An uri
        * @return: true if a Ekiga::Call could be created
        */
-      virtual void start () {
-        display_stats.rx_width = display_stats.rx_height = display_stats.rx_fps = 0;
-        display_stats.tx_width = display_stats.tx_height = display_stats.tx_fps = 0;
-        display_stats.video_accel_status = NONE_new;
-      };
+      virtual void start () { };
 
       virtual void stop () { };
 
@@ -80,17 +76,15 @@
 
       virtual void set_display_info (const DisplayInfo &) { };
 
-      sigc::signal<void, DisplayMode> display_type_changed;       /* gm_main_window_set_display_type */
-      sigc::signal<void, FSToggle_new> fullscreen_mode_changed;   /* gm_main_window_toggle_fullscreen */
-      sigc::signal<void, unsigned, unsigned> size_changed;        /* gm_main_window_set_resized_video_widget */
+      sigc::signal<void, DisplayMode> display_mode_changed;       /* gm_main_window_set_display_type */
+      sigc::signal<void, FSToggle> fullscreen_mode_changed;   /* gm_main_window_toggle_fullscreen */
+      sigc::signal<void, unsigned, unsigned> display_size_changed;        /* gm_main_window_set_resized_video_widget */
       sigc::signal<void> logo_update_required;                    /* gm_main_window_update_logo  */
       sigc::signal<void> display_info_update_required;            /* gm_main_window_update_zoom_display */
 //      sigc::signal<void, DisplayManager &, VideoAccelStatus> update_video_accel_status; /* gm_main_window_update_video_accel_status */
 
   protected:  
       virtual void get_display_info (DisplayInfo &) { };
-
-      DisplayStats display_stats;
     };
 };
 

Modified: trunk/lib/engine/display/x/Makefile.am
==============================================================================
--- trunk/lib/engine/display/x/Makefile.am	(original)
+++ trunk/lib/engine/display/x/Makefile.am	Tue Jan 15 07:48:04 2008
@@ -3,7 +3,7 @@
 display_dir = $(top_srcdir)/lib/engine/display/x
 common_dir = $(top_srcdir)/lib/engine/display/common
 
-AM_CXXFLAGS = $(SIGC_CFLAGS)
+AM_CXXFLAGS = $(SIGC_CFLAGS) $(PTLIB_CFLAGS) $(GLIB_CFLAGS) $(XV_CFLAGS)
 
 INCLUDES = \
 	-I$(top_srcdir)/lib/engine/include \
@@ -19,4 +19,4 @@
 	$(display_dir)/display-main-x.cpp    \
 	$(display_dir)/display-main-x.h
 
-libgmdisplay_x_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS)
+libgmdisplay_x_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(PTLIB_LIBS) $(GLIB_LIBS) $(XV_LIBS)

Modified: trunk/lib/engine/display/x/display-manager-x.cpp
==============================================================================
--- trunk/lib/engine/display/x/display-manager-x.cpp	(original)
+++ trunk/lib/engine/display/x/display-manager-x.cpp	Tue Jan 15 07:48:04 2008
@@ -37,7 +37,469 @@
 
 #include "display-manager-x.h"
 
+#include "../../../gui/xwindow.h"
+
+#ifdef HAVE_XV
+#include "../../../gui/xvwindow.h"
+#endif
+
 GMDisplayManager_x::GMDisplayManager_x (Ekiga::ServiceCore & core)
 : GMDisplayManager(core)
 {
+  /* Internal stuff */
+  lxWindow = NULL;
+  rxWindow = NULL;
+
+  rDisplay = XOpenDisplay (NULL);
+  lDisplay = XOpenDisplay (NULL);
+  embGC = NULL;
+
+  pipWindowAvailable = true;
 }
+
+GMDisplayManager_x::~GMDisplayManager_x ()
+{
+  if (lDisplay) 
+    XCloseDisplay (lDisplay);
+  if (rDisplay)
+    XCloseDisplay (rDisplay);
+}
+
+bool
+GMDisplayManager_x::frame_display_change_needed (DisplayMode display, 
+                                            unsigned lf_width, 
+                                            unsigned lf_height, 
+                                            unsigned rf_width, 
+                                            unsigned rf_height, 
+                                            unsigned int zoom)
+{
+    switch (display) 
+    {
+      case LOCAL_VIDEO:
+          if (!lxWindow) 
+            return true;
+          break;
+      case REMOTE_VIDEO:
+          if (!rxWindow) 
+            return true;
+          break;
+      case FULLSCREEN:
+      case PIP:
+      case PIP_WINDOW:
+          if (!rxWindow || (pipWindowAvailable && (!lxWindow)) )
+              return true;
+          break;
+     case UNSET:
+     default:
+          break;
+    }
+  return GMDisplayManager::frame_display_change_needed (display, lf_width, lf_height, rf_width, rf_height, zoom);
+
+}
+
+void
+GMDisplayManager_x::setup_frame_display (DisplayMode display, 
+                                    unsigned lf_width, 
+                                    unsigned lf_height, 
+                                    unsigned rf_width, 
+                                    unsigned rf_height, 
+                                    unsigned int zoom)
+{
+  DisplayInfo local_display_info;
+
+  if (video_disabled)
+    return;
+
+  get_display_info(local_display_info);
+
+  switch (display) {
+  case LOCAL_VIDEO:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), (unsigned) (lf_width * zoom / 100), (unsigned) (lf_height * zoom / 100)));
+    break;
+  case REMOTE_VIDEO:
+  case PIP:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), (unsigned) (rf_width * zoom / 100), (unsigned) (rf_height * zoom / 100)));
+    break;
+  case FULLSCREEN:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), 176, 144));
+    break;
+  case PIP_WINDOW:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), 176, 144));
+    break;
+  case UNSET:
+  default:
+    PTRACE (1, "GMVideoDisplay_X\tDisplay variable not set");
+    return;
+    break;
+  }
+
+  if ((!local_display_info.widgetInfoSet) || (!local_display_info.gconfInfoSet) ||
+      (local_display_info.display == UNSET) || (local_display_info.zoom == 0) || (zoom == 0)) {
+    PTRACE(4, "GMVideoDisplay_X\tWidget not yet realized or gconf info not yet set, not opening display");
+    return;
+  }
+
+  close_frame_display ();
+
+  runtime.run_in_main (sigc::bind (display_mode_changed.make_slot (), display));
+
+  pipWindowAvailable = false;
+
+  DisplayAccelStatus display_accel_status = NONE;
+
+  switch (display) {
+// LOCAL_VIDEO ------------------------------------------------------------------
+  case LOCAL_VIDEO:
+    PTRACE(4, "GMVideoDisplay_X\tOpening LOCAL_VIDEO display with image of " << lf_width << "x" << lf_height);
+#ifdef HAVE_XV
+    if (!local_display_info.disableHwAccel) {
+      lxWindow = new XVWindow ();
+      if (lxWindow->Init (local_display_info.xdisplay, 
+                            local_display_info.window, 
+                            local_display_info.gc,
+                            local_display_info.x,
+                            local_display_info.y,
+                            (int) (lf_width * zoom / 100), 
+                            (int) (lf_height * zoom / 100),
+                            lf_width, 
+                            lf_height)) {
+	display_accel_status = ALL;
+        PTRACE(4, "GMVideoDisplay_X\tLOCAL_VIDEO: Successfully opened XV Window");
+      }
+      else {
+	delete lxWindow;
+	lxWindow = NULL;
+	display_accel_status = NONE;
+        PTRACE(4, "GMVideoDisplay_X\tLOCAL_VIDEO: Could not open XV Window");
+      }
+    }
+#endif			   
+    if (display_accel_status == NONE) {
+      PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((local_display_info.disableHwAccel) 
+                                      ? " since HW acceleration was deactivated by configuration" 
+                                      : " since HW acceleration failed to initalize"));
+      lxWindow = new XWindow ();
+      if (lxWindow->Init (local_display_info.xdisplay, 
+                            local_display_info.window, 
+                            local_display_info.gc,
+                            local_display_info.x,
+                            local_display_info.y,
+                           (int) (lf_width * zoom / 100), 
+                           (int) (lf_height * zoom / 100),
+                           lf_width, 
+                           lf_height)) {
+       lxWindow->SetSwScalingAlgo(local_display_info.swScalingAlgorithm);
+       PTRACE(4, "GMVideoDisplay_X\tLOCAL_VIDEO: Successfully opened X Window");
+      }
+      else {
+        delete lxWindow;
+        lxWindow = NULL;
+        video_disabled = true;
+        display_accel_status = NO_VIDEO;
+        PTRACE(1, "GMVideoDisplay_X\tLOCAL_VIDEO: Could not open X Window - no video");
+      }
+    }
+    
+    last_frame.embedded_x = local_display_info.x;
+    last_frame.embedded_y = local_display_info.y;
+
+    last_frame.display = LOCAL_VIDEO;
+    last_frame.local_width = lf_width;
+    last_frame.local_height = lf_height;
+    last_frame.zoom = zoom;
+    break;
+
+// REMOTE_VIDEO ----------------------------------------------------------------
+  case REMOTE_VIDEO:
+    PTRACE(4, "GMVideoDisplay_X\tOpening REMOTE_VIDEO display with image of " << rf_width << "x" << rf_height);
+#ifdef HAVE_XV
+    if (!local_display_info.disableHwAccel) {
+      rxWindow = new XVWindow ();
+      if (rxWindow->Init (local_display_info.xdisplay, 
+                          local_display_info.window, 
+                          local_display_info.gc,
+                          local_display_info.x,
+                          local_display_info.y,
+                          (int) (rf_width * zoom / 100), 
+                          (int) (rf_height * zoom / 100),
+                          rf_width, 
+                          rf_height)) {
+       display_accel_status = ALL;
+       PTRACE(4, "GMVideoDisplay_X\tREMOTE_VIDEO: Successfully opened XV Window");
+     }
+     else {
+       delete rxWindow;
+       rxWindow = NULL;
+       display_accel_status = NONE;
+       PTRACE(1, "GMVideoDisplay_X\tLOCAL_VIDEO: Could not open XV Window");
+
+     }
+    }
+#endif			   
+    if (display_accel_status == NONE) {
+      PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((local_display_info.disableHwAccel) 
+                                      ? " since HW acceleration was deactivated by configuration" 
+                                      : " since HW acceleration failed to initalize"));
+      rxWindow = new XWindow ();
+      if ( rxWindow->Init (local_display_info.xdisplay, 
+                             local_display_info.window, 
+                             local_display_info.gc,
+                             local_display_info.x,
+                             local_display_info.y,
+                             (int) (rf_width * zoom / 100), 
+                             (int) (rf_height * zoom / 100),
+                             rf_width, 
+                             rf_height)) {
+        rxWindow->SetSwScalingAlgo(local_display_info.swScalingAlgorithm);
+        PTRACE(4, "GMVideoDisplay_X\tREMOTE_VIDEO: Successfully opened X Window");
+      }
+      else {
+        delete rxWindow;
+        rxWindow = NULL;
+        video_disabled = true;
+        display_accel_status = NO_VIDEO;
+        PTRACE(1, "GMVideoDisplay_X\tREMOTE_VIDEO: Could not open X Window - no video");
+      }
+    }
+
+    last_frame.embedded_x = local_display_info.x;
+    last_frame.embedded_y = local_display_info.y;
+
+    last_frame.display = REMOTE_VIDEO;
+    last_frame.remote_width = rf_width;
+    last_frame.remote_height = rf_height;
+    last_frame.zoom = zoom;
+    break;
+
+// PIP_VIDEO ------------------------------------------------------------------
+  case FULLSCREEN:
+  case PIP:
+  case PIP_WINDOW:
+    PTRACE(4, "GMVideoDisplay_X\tOpening display " << display << " with images of " 
+            << lf_width << "x" << lf_height << "(local) and " 
+	    << rf_width << "x" << rf_height << "(remote)");
+#ifdef HAVE_XV
+    if (!local_display_info.disableHwAccel) {
+      rxWindow = new XVWindow ();
+      if (rxWindow->Init ((display == PIP) ? local_display_info.xdisplay : rDisplay, 
+                             (display == PIP) ? local_display_info.window : DefaultRootWindow (rDisplay), 
+                             (display == PIP) ? local_display_info.gc : NULL,
+                             (display == PIP) ? local_display_info.x : 0,
+                             (display == PIP) ? local_display_info.y : 0,
+                             (int) (rf_width * zoom / 100), 
+                             (int) (rf_height * zoom / 100),
+                             rf_width, 
+                             rf_height)) {
+        display_accel_status = REMOTE_ONLY;
+        PTRACE(4, "GMVideoDisplay_X\tPIP: Successfully opened remote XV Window");
+      }
+      else 
+      {
+        delete rxWindow;
+	rxWindow = NULL;
+	display_accel_status = NONE;
+        PTRACE(1, "GMVideoDisplay_X\tPIP: Could not open remote XV Window");
+      }
+    }
+#endif			   
+    if (display_accel_status == NONE) {
+      PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((local_display_info.disableHwAccel) 
+                                      ? " since HW acceleration was deactivated by configuration" 
+                                      : " since HW acceleration failed to initalize"));
+      rxWindow = new XWindow ();
+      if (rxWindow->Init ((display == PIP) ? local_display_info.xdisplay : rDisplay, 
+                             (display == PIP) ? local_display_info.window : DefaultRootWindow (rDisplay), 
+                             (display == PIP) ? local_display_info.gc : NULL,
+                             (display == PIP) ? local_display_info.x : 0,
+                             (display == PIP) ? local_display_info.y : 0,
+                             (int) (rf_width * zoom / 100), 
+                             (int) (rf_height * zoom / 100),
+                             rf_width, 
+                             rf_height)) {
+        rxWindow->SetSwScalingAlgo(local_display_info.swScalingAlgorithm);
+        PTRACE(4, "GMVideoDisplay_X\tPIP: Successfully opened remote X Window");
+      }
+      else {
+        delete rxWindow;
+        rxWindow = NULL;
+        video_disabled = true;
+        display_accel_status = NO_VIDEO;
+        PTRACE(1, "GMVideoDisplay_X\tPIP: Could not open remote X Window - no video");
+      }
+    }
+
+
+#ifdef HAVE_XV
+    if (display_accel_status == REMOTE_ONLY) {
+      lxWindow = new XVWindow();
+      if (lxWindow->Init (   rxWindow->GetDisplay (), 
+                             rxWindow->GetWindowHandle (),
+                             rxWindow->GetGC (),
+                             (int) (rf_width * zoom  / 100 * 2 / 3), 
+                             (int) (rf_height * zoom  / 100 * 2 / 3), 
+                             (int) (rf_width * zoom  / 100 / 3), 
+                             (int) (rf_height * zoom  / 100 / 3),
+                             lf_width, 
+                             lf_height)) {
+        display_accel_status = ALL;
+        pipWindowAvailable = true;
+        PTRACE(4, "GMVideoDisplay_X\tPIP: Successfully opened local XV Window");
+      }
+      else {
+        delete lxWindow;
+	lxWindow = NULL;
+        pipWindowAvailable = false;
+        PTRACE(1, "GMVideoDisplay_X\tPIP: Could not open local XV Window");
+      }
+    }
+#endif
+    if ((display_accel_status != ALL) && (local_display_info.allowPipSwScaling)) {
+      PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((local_display_info.disableHwAccel) 
+                                      ? " since HW acceleration was deactivated by configuration" 
+                                      : " since HW acceleration failed to initalize"));
+      lxWindow = new XWindow ();
+      if (lxWindow->Init ((display == PIP) ? local_display_info.xdisplay : lDisplay, 
+                             rxWindow->GetWindowHandle (),
+                             (display == PIP) ? local_display_info.gc : NULL,
+                             (int) (rf_width * zoom  / 100 * 2 / 3), 
+                             (int) (rf_height * zoom  / 100 * 2 / 3), 
+                             (int) (rf_width * zoom  / 100 / 3), 
+                             (int) (rf_height * zoom  / 100 / 3),
+                             lf_width, 
+                             lf_height)) {
+       lxWindow->SetSwScalingAlgo(local_display_info.swScalingAlgorithm);
+       pipWindowAvailable = true;
+       PTRACE(4, "GMVideoDisplay_X\tPIP: Successfully opened local X Window");
+     }
+     else {
+       delete lxWindow;
+       lxWindow = NULL;
+       pipWindowAvailable = false;
+       PTRACE(4, "GMVideoDisplay_X\tPIP: Could not open local X Window - picture-in-picture disabled");
+      }
+    }
+
+    if ((display_accel_status != ALL) && (!local_display_info.allowPipSwScaling)) {
+      PTRACE(3, "GMVideoDisplay_X\tNot opening PIP window since HW acceleration is not available and SW fallback is disabled by configuration");
+      display_accel_status = ALL;
+    }
+
+    if (rxWindow && lxWindow) {
+
+      rxWindow->RegisterSlave (lxWindow);
+      lxWindow->RegisterMaster (rxWindow);
+    }	  
+
+    if (rxWindow && display == FULLSCREEN) 
+      rxWindow->ToggleFullscreen ();
+    
+    if ((display != PIP_WINDOW) && (display != FULLSCREEN)) {
+      last_frame.embedded_x = local_display_info.x;
+      last_frame.embedded_y = local_display_info.y;
+    }
+
+    last_frame.display = display;
+    last_frame.local_width = lf_width;
+    last_frame.local_height = lf_height;
+    last_frame.remote_width = rf_width;
+    last_frame.remote_height = rf_height;
+    last_frame.zoom = zoom;
+    break;
+
+  case UNSET:
+  default:
+    return;
+    break;
+  }
+
+  if (local_display_info.onTop) {
+
+    if (lxWindow)
+      lxWindow->ToggleOntop ();
+    if (rxWindow)
+      rxWindow->ToggleOntop ();
+  }
+
+//  runtime.run_in_main (sigc::bind (update_display_accel_status.make_slot (), display_accel_status));
+}
+
+bool
+GMDisplayManager_x::close_frame_display ()
+{
+//   if (runtime) { //FIXME
+//     display_accel_status = NO_VIDEO;
+//     runtime.run_in_main (sigc::bind (update_display_accel_status.make_slot (), display_accel_status));
+//   }
+
+  if (rxWindow) 
+    rxWindow->RegisterSlave (NULL);
+  if (lxWindow) 
+    lxWindow->RegisterMaster (NULL);
+
+  if (rxWindow) {
+    delete rxWindow;
+    rxWindow = NULL;
+  }
+
+  if (lxWindow) {
+    delete lxWindow;
+    lxWindow = NULL;
+  }
+
+  return true;
+}
+
+void
+GMDisplayManager_x::display_frame (const char *frame,
+                             unsigned width,
+                             unsigned height)
+{
+  if (rxWindow)
+    rxWindow->ProcessEvents();
+
+  if (lxWindow)
+    lxWindow->ProcessEvents();
+
+  if  ((current_frame.display == LOCAL_VIDEO) && (lxWindow))
+    lxWindow->PutFrame ((uint8_t *) frame, width, height);
+
+  if  ((current_frame.display == REMOTE_VIDEO) && (rxWindow))
+    rxWindow->PutFrame ((uint8_t *) frame, width, height);
+}
+
+void
+GMDisplayManager_x::display_pip_frames (const char *local_frame,
+                                 unsigned lf_width,
+                                 unsigned lf_height,
+                                 const char *remote_frame,
+                                 unsigned rf_width,
+                                 unsigned rf_height)
+{
+  if (rxWindow)
+    rxWindow->ProcessEvents();
+
+  if (lxWindow)
+    lxWindow->ProcessEvents();
+
+  if (current_frame.display == FULLSCREEN && rxWindow && !rxWindow->IsFullScreen ())
+    runtime.run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), OFF));
+
+  if (rxWindow && (update_required.remote || (!update_required.remote && !update_required.local)))
+    rxWindow->PutFrame ((uint8_t *) remote_frame, rf_width, rf_height);
+
+  if (lxWindow && (update_required.local  || (!update_required.remote && !update_required.local)))
+    lxWindow->PutFrame ((uint8_t *) local_frame, lf_width, lf_height);
+}
+
+void
+GMDisplayManager_x::sync (UpdateRequired sync_required)
+{
+  if (rxWindow && (sync_required.remote || (!sync_required.remote && !sync_required.local))) {
+    rxWindow->Sync();
+  }
+
+  if (lxWindow && (sync_required.local  || (!sync_required.remote && !sync_required.local))) {
+    lxWindow->Sync();
+  }
+}
+

Modified: trunk/lib/engine/display/x/display-manager-x.h
==============================================================================
--- trunk/lib/engine/display/x/display-manager-x.h	(original)
+++ trunk/lib/engine/display/x/display-manager-x.h	Tue Jan 15 07:48:04 2008
@@ -42,25 +42,47 @@
 #define _DISPLAY_MANAGER_X_H_
 
 #include "display-manager-common.h"
+#include "../../../gui/xwindow.h"
 
 class GMDisplayManager_x
    : public  GMDisplayManager
 {
 public:
   GMDisplayManager_x (Ekiga::ServiceCore & core);
+
+  ~GMDisplayManager_x ();
+
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Returns TRUE if the given settings require a
+   *                 reinitialization of the display, FALSE 
+   *                 otherwise.
+   * PRE          :  /
+   */
+  virtual bool frame_display_change_needed (DisplayMode display, 
+                                            unsigned lf_width, 
+                                            unsigned lf_height, 
+                                            unsigned rf_width, 
+                                            unsigned rf_height, 
+                                            unsigned int zoom);
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Setup the display following the display type,
+   *                 picture dimensions and zoom value.
+   *                 Returns FALSE in case of failure.
+   * PRE          :  /
+   */
   virtual void setup_frame_display (DisplayMode display, 
                                     unsigned lf_width, 
                                     unsigned lf_height, 
                                     unsigned rf_width, 
                                     unsigned rf_height, 
-                                    unsigned int zoom) {};
+                                    unsigned int zoom);
 
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Closes the frame display and returns FALSE 
    *                 in case of failure.
    * PRE          :  /
    */
-  virtual bool close_frame_display () {return true;};
+  virtual bool close_frame_display ();
 
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Display the given frame on the correct display.
@@ -69,7 +91,7 @@
    */
   virtual void display_frame (const char *frame,
                              unsigned width,
-                             unsigned height) {};
+                             unsigned height);
 
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Display the given frames as Picture in Picture.
@@ -81,13 +103,25 @@
                                  unsigned lf_height,
                                  const char *remote_frame,
                                  unsigned rf_width,
-                                 unsigned rf_height) {};
+                                 unsigned rf_height);
   
+protected:
+
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Sync the output of the frame to the display
    * PRE          :  /
    */
-  virtual void sync(UpdateRequired sync_required) {};
+  virtual void sync(UpdateRequired sync_required);
+
+  XWindow *lxWindow;
+  XWindow *rxWindow;
+
+  Display *lDisplay;
+  Display *rDisplay;
+
+  GC* embGC;
+
+  bool pipWindowAvailable;
 
 };
 #endif /* DISPLAY_MANAGER_X */

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Jan 15 07:48:04 2008
@@ -79,23 +79,8 @@
 	devices/videoinput.h		\
 	devices/videoinput.cpp		\
 	devices/videooutput.h           \
-	devices/videooutput.cpp         \
-	devices/videodisplay.h          \
-	devices/videodisplay.cpp
-
-# XVideo/X
-if !WIN32
-ekiga_SOURCES +=                        \
-	devices/videodisplay_x.h        \
-	devices/videodisplay_x.cpp
-endif
+	devices/videooutput.cpp
 
-# DirectX
-if HAVE_DX
-ekiga_SOURCES +=                        \
-	devices/videodisplay_dx.h       \
-	devices/videodisplay_dx.cpp
-endif
 
 # Endpoints 
 ekiga_SOURCES +=			\
@@ -171,7 +156,7 @@
 	clients/avahi.cpp 	
 endif
 
-AM_CXXFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) $(GNOME_CFLAGS) $(AVAHI_CFLAGS) $(DBUS_CFLAGS) $(BONOBO_CFLAGS) $(OPAL_CFLAGS) $(PTLIB_CFLAGS) $(SIGC_CFLAGS) $(XV_CFLAGS) $(DX_CFLAGS) $(XML_CFLAGS)
+AM_CXXFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) $(GNOME_CFLAGS) $(AVAHI_CFLAGS) $(DBUS_CFLAGS) $(BONOBO_CFLAGS) $(OPAL_CFLAGS) $(PTLIB_CFLAGS) $(SIGC_CFLAGS) $(XML_CFLAGS)
 AM_LIBS = $(GTK_LIBS) $(GLIB_LIBS) $(GNOME_LIBS) $(AVAHI_LIBS) $(DBUS_LIBS) $(BONOBO_LIBS) $(OPAL_LIBS) $(PTLIB_LIBS) $(SIGC_LIBS) $(XML_LIBS)
 
 ekiga_LDADD = \

Modified: trunk/src/common.h
==============================================================================
--- trunk/src/common.h	(original)
+++ trunk/src/common.h	Tue Jan 15 07:48:04 2008
@@ -53,15 +53,6 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
-#ifdef WIN32
-#include <gdk/gdkwin32.h>
-#else
-#include <gdk/gdkx.h>
-#ifdef BadRequest
-#undef BadRequest
-#endif /*BadRequest */
-#endif /* WIN32 */
-
 #define GENERAL_KEY         "/apps/" PACKAGE_NAME "/general/"
 #define USER_INTERFACE_KEY "/apps/" PACKAGE_NAME "/general/user_interface/"
 #define VIDEO_DISPLAY_KEY USER_INTERFACE_KEY "video_display/"
@@ -131,34 +122,6 @@
 } PanelSection;
 
 
-/* Video modes */
-typedef enum {
-
-  LOCAL_VIDEO, 
-  REMOTE_VIDEO, 
-  PIP,
-  PIP_WINDOW,
-  FULLSCREEN,
-  UNSET
-} VideoMode;
-
-/* Toggle operations for Fullscreen */
-typedef enum {
-
-  ON,
-  OFF,
-  TOGGLE
-} FSToggle;
-
-/* Video Acceleration Status */
-typedef enum {
-
-  NONE,
-  REMOTE_ONLY,
-  ALL,
-  NO_VIDEO
-} VideoAccelStatus;
-
 #define NB_VIDEO_SIZES 5
 
 const static struct { 
@@ -173,89 +136,4 @@
     {  GM_4SIF_WIDTH,  GM_4SIF_HEIGHT },
 };
 
-class VideoInfo
-{
-public:
-  VideoInfo() {
-    widgetInfoSet = FALSE;
-    x = 0;
-    y = 0;
-#ifdef WIN32
-    hwnd = 0;
-#else
-    gc = 0;
-    window = 0;
-    xdisplay = NULL;
-#endif
-
-    gconfInfoSet = FALSE;
-    onTop = FALSE;
-    disableHwAccel = FALSE;
-    allowPipSwScaling = TRUE;
-    swScalingAlgorithm = 0;
-
-    display = UNSET;
-    zoom = 0;
-  };
-  
-  void operator= ( const VideoInfo& rhs) {
-
-  if (rhs.widgetInfoSet) {
-      widgetInfoSet = rhs.widgetInfoSet;
-      x = rhs.x;
-      y = rhs.y;
-#ifdef WIN32
-      hwnd = rhs.hwnd;
-#else
-      gc = rhs.gc;
-      window = rhs.window;
-      xdisplay = rhs.xdisplay;
-#endif
-    }
-
-    if (rhs.gconfInfoSet) {
-      gconfInfoSet = rhs.gconfInfoSet;
-      onTop = rhs.onTop;
-      disableHwAccel = rhs.disableHwAccel;
-      allowPipSwScaling = rhs.allowPipSwScaling;
-      swScalingAlgorithm =  rhs.swScalingAlgorithm;
-    }
-    if (rhs.display != UNSET) display = rhs.display;
-    if (rhs.zoom != 0) zoom = rhs.zoom;
-  };
-
-  bool widgetInfoSet;
-  int x;
-  int y;
-	    
-#ifdef WIN32
-  HWND hwnd;
-#else
-  GC gc;
-  Window window;
-  Display* xdisplay;
-#endif
-
-  bool gconfInfoSet;
-  bool onTop;
-  bool disableHwAccel;
-  bool allowPipSwScaling;
-  unsigned int swScalingAlgorithm;
-
-  VideoMode display;
-  unsigned int zoom;
-  
-};
-
-//will be moved at a later stage
-typedef struct {
-  unsigned rxFPS;
-  unsigned rxWidth;
-  unsigned rxHeight;
-  unsigned txFPS;
-  unsigned txWidth;
-  unsigned txHeight;
-  VideoAccelStatus videoAccelStatus;
-} VideoStats;
-
 #endif /* GM_COMMON_H */

Modified: trunk/src/devices/videooutput.cpp
==============================================================================
--- trunk/src/devices/videooutput.cpp	(original)
+++ trunk/src/devices/videooutput.cpp	Tue Jan 15 07:48:04 2008
@@ -48,7 +48,6 @@
 
 int PVideoOutputDevice_EKIGA::devices_nbr = 0;
 
-GMVideoDisplay* PVideoOutputDevice_EKIGA::videoDisplay = NULL;
 
 PMutex PVideoOutputDevice_EKIGA::videoDisplay_mutex;
 /* Plugin definition */
@@ -87,14 +86,6 @@
   
   /* Used to distinguish between input and output device. */
   device_id = 0; 
-
-  if (!videoDisplay) {
-#ifdef WIN32
-     videoDisplay = new GMVideoDisplay_DX(core);
-#else
-     videoDisplay = new GMVideoDisplay_X(core);
-#endif
-  }
 }
 
 
@@ -105,9 +96,6 @@
   if (is_active)
     devices_nbr = PMAX (0, devices_nbr-1);
   if (devices_nbr == 0) {
-     if (videoDisplay)
-       delete videoDisplay;
-     videoDisplay = NULL;
     display_core.stop();
   }
 }
@@ -168,7 +156,6 @@
     devices_nbr = PMIN (2, devices_nbr+1);
   }
   display_core.set_frame_data(width, height, (char*) data, (device_id == LOCAL), devices_nbr);
-  videoDisplay->SetFrameData (width, height, data, (device_id == LOCAL), devices_nbr);
 
   return TRUE;
 }

Modified: trunk/src/devices/videooutput.h
==============================================================================
--- trunk/src/devices/videooutput.h	(original)
+++ trunk/src/devices/videooutput.h	Tue Jan 15 07:48:04 2008
@@ -42,13 +42,6 @@
 
 #include "display-core.h"
 #include "common.h"
-#include "videodisplay.h"
-
-#ifdef WIN32
-#include "videodisplay_dx.h"
-#else
-#include "videodisplay_x.h"
-#endif
 
 class GMManager;
 
@@ -138,8 +131,6 @@
 
  protected:
 
-  static GMVideoDisplay* videoDisplay;
-
   static int devices_nbr; /* The number of devices opened */
   int device_id;          /* The current device : local or remote */
 

Modified: trunk/src/endpoints/ekiga.h
==============================================================================
--- trunk/src/endpoints/ekiga.h	(original)
+++ trunk/src/endpoints/ekiga.h	Tue Jan 15 07:48:04 2008
@@ -50,7 +50,6 @@
 #include "statusicon.h"
 
 #include <ptlib/ipsock.h>
-#include <sigc++/sigc++.h>
 
 
 /**
@@ -265,9 +264,6 @@
    */
   PStringArray GetVideoPlugins ();
 
-  sigc::signal<void,
-	       VideoInfo*> set_video_info;
-
  private:
   
   Ekiga::ServiceCore *service_core;

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Tue Jan 15 07:48:04 2008
@@ -274,6 +274,8 @@
 static void gm_mw_zooms_menu_update_sensitivity (GtkWidget *,
 			      			 unsigned int);
 
+void gm_main_window_toggle_fullscreen (FSToggle toggle,
+                                       GtkWidget   *main_window);
 
 /* Callbacks */
 
@@ -579,14 +581,18 @@
   GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
   
   if (mw->current_call) {
+
+    DisplayStats display_stats;
+    Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+    display_core->get_display_stats(display_stats);
   
     msg = g_strdup_printf (_("A:%.1f/%.1f   V:%.1f/%.1f   FPS:%d/%d"), 
                            mw->current_call->get_transmitted_audio_bandwidth (),
                            mw->current_call->get_received_audio_bandwidth (),
                            mw->current_call->get_transmitted_video_bandwidth (),
                            mw->current_call->get_received_video_bandwidth (),
-                           0,
-                           0);
+                           display_stats.tx_fps,
+                           display_stats.rx_fps);
     gdk_threads_enter ();
     gm_main_window_push_info_message (GTK_WIDGET (self), msg);
     if (mw->current_call)
@@ -2187,7 +2193,6 @@
             		G_GNUC_UNUSED gpointer data)
 {
   GmMainWindow *mw = NULL;
-  VideoInfo videoInfo;
 
   if (!main_window) 
     return FALSE;
@@ -2202,11 +2207,12 @@
 
   if (!GDK_IS_WINDOW(mw->main_video_image->window))
     return FALSE;
-    
-  videoInfo.x = mw->main_video_image->allocation.x;
-  videoInfo.y = mw->main_video_image->allocation.y;
+
+  DisplayInfo display_info;
+  display_info.x = mw->main_video_image->allocation.x;
+  display_info.y = mw->main_video_image->allocation.y;
 #ifdef WIN32  
-  videoInfo.hwnd = ((HWND)GDK_WINDOW_HWND (mw->main_video_image->window));
+  display_info.hwnd = ((HWND)GDK_WINDOW_HWND (mw->main_video_image->window));
 #else 
   if (!mw->videoWidgetGC) { 
     GdkGC* gc = gdk_gc_new(mw->main_video_image->window);
@@ -2217,15 +2223,16 @@
     if (mw->videoWidgetGC == NULL)
       return FALSE;
   }
-  videoInfo.gc = mw->videoWidgetGC;
-  videoInfo.window = GDK_WINDOW_XWINDOW (mw->main_video_image->window); // None
-  if (videoInfo.window == 0)  //FIXME
+  display_info.gc = mw->videoWidgetGC;
+  display_info.window = GDK_WINDOW_XWINDOW (mw->main_video_image->window); // None
+  if (display_info.window == 0)  //FIXME
     return FALSE;
-  videoInfo.xdisplay = GDK_DISPLAY ();
+  display_info.xdisplay = GDK_DISPLAY ();
 #endif
-  videoInfo.widgetInfoSet = TRUE;
+  display_info.widgetInfoSet = TRUE;
 
-  GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+  Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+  display_core->set_display_info(display_info);
 
   return FALSE;
 }
@@ -2405,23 +2412,26 @@
 zoom_in_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 		    gpointer data)
 {
-  GtkWidget *main_window = NULL;
-  VideoInfo videoInfo;
-  
-  main_window = GnomeMeeting::Process ()->GetMainWindow ();
-
+  GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
   g_return_if_fail (main_window != NULL);
+
+  GmMainWindow *mw = gm_mw_get_mw (main_window);
+  g_return_if_fail (mw != NULL);
+
   g_return_if_fail (data != NULL);
 
-  videoInfo.zoom = gm_conf_get_int ((char *) data);
+  DisplayInfo display_info;
+
+  display_info.zoom = gm_conf_get_int ((char *) data);
 
-  if (videoInfo.zoom < 200)
-    videoInfo.zoom = videoInfo.zoom * 2;
+  if (display_info.zoom < 200)
+    display_info.zoom = display_info.zoom * 2;
 
-  gm_conf_set_int ((char *) data, videoInfo.zoom);
-  gm_mw_zooms_menu_update_sensitivity (main_window, videoInfo.zoom);
+  gm_conf_set_int ((char *) data, display_info.zoom);
+  gm_mw_zooms_menu_update_sensitivity (main_window, display_info.zoom);
 
-  GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+  Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+  display_core->set_display_info(display_info);
 }
 
 
@@ -2429,23 +2439,28 @@
 zoom_out_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 		     gpointer data)
 {
-  GtkWidget *main_window = NULL;
-  VideoInfo videoInfo;
+  GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
+  g_return_if_fail (main_window != NULL);
 
-  main_window = GnomeMeeting::Process ()->GetMainWindow ();
+  GmMainWindow *mw = gm_mw_get_mw (main_window);
+  g_return_if_fail (mw != NULL);
 
-  g_return_if_fail (main_window != NULL);
   g_return_if_fail (data != NULL);
 
-  videoInfo.zoom  = gm_conf_get_int ((char *) data);
+  DisplayInfo display_info;
+
+  display_info.zoom = gm_conf_get_int ((char *) data);
+
+  if (display_info.zoom  > 50)
+    display_info.zoom  = (unsigned int) (display_info.zoom  / 2);
 
-  if (videoInfo.zoom  > 50)
-    videoInfo.zoom  = (unsigned int) (videoInfo.zoom  / 2);
+  gm_conf_set_int ((char *) data, display_info.zoom);
+  gm_mw_zooms_menu_update_sensitivity (main_window, display_info.zoom);
+
+  Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+  display_core->set_display_info(display_info);
 
-  gm_conf_set_int ((char *) data, videoInfo.zoom );
-  gm_mw_zooms_menu_update_sensitivity (main_window, videoInfo.zoom );
 
-  GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
 }
 
 
@@ -2453,20 +2468,23 @@
 zoom_normal_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 			gpointer data)
 {
-  GtkWidget *main_window = NULL;
-  VideoInfo videoInfo;
-  videoInfo.zoom = 100;
+  GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
+  g_return_if_fail (main_window != NULL);
 
-  main_window = GnomeMeeting::Process ()->GetMainWindow ();
+  GmMainWindow *mw = gm_mw_get_mw (main_window);
+  g_return_if_fail (mw != NULL);
 
-  g_return_if_fail (main_window != NULL);
   g_return_if_fail (data != NULL);
 
-  gm_conf_set_int ((char *) data, videoInfo.zoom);
+  DisplayInfo display_info;
+
+  display_info.zoom  = 100;
 
-  gm_mw_zooms_menu_update_sensitivity (main_window, videoInfo.zoom);
+  gm_conf_set_int ((char *) data, display_info.zoom);
+  gm_mw_zooms_menu_update_sensitivity (main_window, display_info.zoom);
 
-  GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+  Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+  display_core->set_display_info(display_info);
 }
 
 
@@ -2474,15 +2492,19 @@
 display_changed_cb (GtkWidget *widget,
 		       gpointer data)
 {
-  GSList *group = NULL;
+  GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
+  g_return_if_fail (main_window != NULL);
+
+  GmMainWindow *mw = gm_mw_get_mw (main_window);
+  g_return_if_fail (mw != NULL);
 
+  g_return_if_fail (data != NULL);
+
+  GSList *group = NULL;
   int group_last_pos = 0;
   int active = 0;
+  DisplayInfo display_info;
 
-  VideoInfo videoInfo;
-
-  g_return_if_fail (data != NULL);
-  
   group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (widget));
   group_last_pos = g_slist_length (group) - 1; /* If length 1, last pos is 0 */
 
@@ -2501,10 +2523,10 @@
 
     gm_conf_set_int ((gchar *) data, group_last_pos - active);
 
-    videoInfo.display = (VideoMode) (group_last_pos - active);
-
-    GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+    display_info.display = (DisplayMode) (group_last_pos - active);
 
+    Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+    display_core->set_display_info(display_info);
   }
 }
 
@@ -2513,7 +2535,9 @@
 fullscreen_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 		       G_GNUC_UNUSED gpointer data)
 {
-  gm_main_window_toggle_fullscreen (TOGGLE);
+  GtkWidget* main_window = GnomeMeeting::Process()->GetMainWindow ();
+  g_return_if_fail (main_window != NULL);
+  gm_main_window_toggle_fullscreen (TOGGLE, main_window);
 }
 
 
@@ -2642,18 +2666,10 @@
   return mw->main_video_image;
 }
 
-void
-gm_main_window_set_resized_video_widget (int width,
-                                         int height)
+void 
+on_display_size_changed_cb (Ekiga::DisplayManager & /* manager */, unsigned width, unsigned height,  gpointer self)  // FIXME new
 {
-  GtkWidget *main_window = NULL;
-  GmMainWindow *mw = NULL;
- 
-  main_window = GnomeMeeting::Process ()->GetMainWindow ();
-  g_return_if_fail (main_window != NULL);
-    
-  mw = gm_mw_get_mw (main_window);
-  g_return_if_fail (mw != NULL);
+  GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
 
   gtk_widget_set_size_request (mw->main_video_image, width, height);
 
@@ -2663,7 +2679,13 @@
   rect.width = mw->main_video_image->allocation.width;
   rect.height = mw->main_video_image->allocation.height;
 
-  gdk_window_invalidate_rect (GDK_WINDOW (main_window->window), &rect , TRUE);
+  gdk_window_invalidate_rect (GDK_WINDOW (GTK_WIDGET (self)->window), &rect , TRUE); //FIXME check
+}
+
+void
+on_logo_update_required_cb (Ekiga::DisplayManager & /* manager */, gpointer self)  //FIXME new
+{
+  gm_main_window_update_logo_have_window (GTK_WIDGET (self));
 }
 
 void 
@@ -2694,50 +2716,43 @@
 }
 
 void 
-gm_main_window_update_logo ()
+on_display_info_update_required_cb(Ekiga::DisplayManager & /* manager */, gpointer self)  // FIXME new
 {
-  GtkWidget* main_window = NULL;
-  main_window = GnomeMeeting::Process()->GetMainWindow ();
-  gm_main_window_update_logo_have_window (main_window);
-}
-
+  GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
 
-void 
-gm_main_window_update_zoom_display ()
-{
-  VideoInfo videoInfo;
+  DisplayInfo display_info;
 
   if (( gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") < 0) || ( gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") > 4))
     gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", 0);
 
-  videoInfo.display = (VideoMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
+  display_info.display = (DisplayMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
 
-  videoInfo.zoom = gm_conf_get_int (VIDEO_DISPLAY_KEY "zoom");
-  if ((videoInfo.zoom != 100) && (videoInfo.zoom != 50) && (videoInfo.zoom != 200)) {
-    videoInfo.zoom = 100;
+  display_info.zoom = gm_conf_get_int (VIDEO_DISPLAY_KEY "zoom");
+  if ((display_info.zoom != 100) && (display_info.zoom != 50) && (display_info.zoom != 200)) {
+    display_info.zoom = 100;
     gm_conf_set_int (VIDEO_DISPLAY_KEY "zoom", 100);
   }
   
-  videoInfo.onTop = gm_conf_get_bool (VIDEO_DISPLAY_KEY "stay_on_top");
-  videoInfo.disableHwAccel = gm_conf_get_bool (VIDEO_DISPLAY_KEY "disable_hw_accel");
-  videoInfo.allowPipSwScaling = gm_conf_get_bool (VIDEO_DISPLAY_KEY "allow_pip_sw_scaling");
-  videoInfo.swScalingAlgorithm = gm_conf_get_int (VIDEO_DISPLAY_KEY "sw_scaling_algorithm");
-  if (videoInfo.swScalingAlgorithm > 3) {
-    videoInfo.swScalingAlgorithm = 0;
+  display_info.onTop = gm_conf_get_bool (VIDEO_DISPLAY_KEY "stay_on_top");
+  display_info.disableHwAccel = gm_conf_get_bool (VIDEO_DISPLAY_KEY "disable_hw_accel");
+  display_info.allowPipSwScaling = gm_conf_get_bool (VIDEO_DISPLAY_KEY "allow_pip_sw_scaling");
+  display_info.swScalingAlgorithm = gm_conf_get_int (VIDEO_DISPLAY_KEY "sw_scaling_algorithm");
+  if (display_info.swScalingAlgorithm > 3) {
+    display_info.swScalingAlgorithm = 0;
     gm_conf_set_int (VIDEO_DISPLAY_KEY "sw_scaling_algorithm", 0);
   }
-  videoInfo.gconfInfoSet = TRUE;
+  display_info.gconfInfoSet = TRUE;
 
-  GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
-
-  gm_main_window_set_resized_video_widget (176,144); //FIXME: is this necessary
+  Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+  display_core->set_display_info(display_info);
 
+//   gm_main_window_set_resized_video_widget (176,144); //FIXME: is this necessary (call on_display_size_changed_cb)
 }
 
-void 
-gm_main_window_update_video_accel_status (VideoAccelStatus status) {
-  PTRACE(4, "MAIN: Update Accel status to " << status);
-}
+// void 
+// gm_main_window_update_video_accel_status (VideoAccelStatus status) {
+//   PTRACE(4, "MAIN: Update Accel status to " << status);
+// }
 
 void 
 gm_main_window_set_call_hold (GtkWidget *main_window,
@@ -3060,28 +3075,39 @@
   gtk_menu_section_set_sensitive (mw->main_menu, "fullscreen", FSMenu);
 }
 
+void 
+on_fullscreen_mode_changed_cb (Ekiga::DisplayManager & /* manager */, FSToggle toggle,  gpointer self)  // FIXME new
+{
+  gm_main_window_toggle_fullscreen (toggle, GTK_WIDGET (self)); // FIXME new
+}
 
 void
-gm_main_window_toggle_fullscreen (FSToggle toggle)
+gm_main_window_toggle_fullscreen (FSToggle toggle,
+                                  GtkWidget   *main_window)
 {
-  VideoInfo videoInfo;
+  GmMainWindow *mw = gm_mw_get_mw (main_window);
+  g_return_if_fail (mw != NULL);
+
+  DisplayInfo display_info;
+  Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+
   switch (toggle) {
     case OFF:
       if (gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") == FULLSCREEN) {
 
-        videoInfo.display = (VideoMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen");
-        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", videoInfo.display);
-        GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+        display_info.display = (DisplayMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen");
+        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", display_info.display);
+        display_core->set_display_info(display_info);
       }
       break;
     case ON:
       if (gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") != FULLSCREEN) {
 
-        videoInfo.display = (VideoMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
-        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen", videoInfo.display);
+        display_info.display = (DisplayMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
+        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen", display_info.display);
         gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", FULLSCREEN);
-        videoInfo.display = FULLSCREEN;
-        GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+        display_info.display = FULLSCREEN;
+        display_core->set_display_info(display_info);
       }
       break;
 
@@ -3089,17 +3115,17 @@
     default:
       if (gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") == FULLSCREEN) {
 
-        videoInfo.display = (VideoMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen");
-        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", videoInfo.display);
-        GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+        display_info.display = (DisplayMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen");
+        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", display_info.display);
+        display_core->set_display_info(display_info);
       }
       else {
 
-        videoInfo.display =  (VideoMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
-        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen", videoInfo.display);
+        display_info.display =  (DisplayMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
+        gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen", display_info.display);
         gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", FULLSCREEN);
-        videoInfo.display = FULLSCREEN;
-        GnomeMeeting::Process ()->set_video_info.emit (&videoInfo);
+        display_info.display = FULLSCREEN;
+        display_core->set_display_info(display_info);
       }
       break;
   }
@@ -3290,24 +3316,14 @@
   gtk_combo_box_set_active (GTK_COMBO_BOX (mw->status_option_menu), status);
 }
 
-
 void 
-gm_main_window_set_display_type (VideoMode display)
+on_display_mode_changed_cb (Ekiga::DisplayManager & /* manager */, DisplayMode display,  gpointer self) //FIXME new
 {
-  GtkWidget* main_window = NULL;
-  GmMainWindow *mw = NULL;
-
-  main_window = GnomeMeeting::Process()->GetMainWindow ();
-  g_return_if_fail (main_window != NULL);
-
-  mw = gm_mw_get_mw (main_window);
-
-  g_return_if_fail (mw != NULL);
+  GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
 
   gtk_radio_menu_select_with_id (mw->main_menu, "local_video", display);
 }
 
-
 void 
 gm_main_window_set_call_info (GtkWidget *main_window,
 			      const char *tr_audio_codec,
@@ -3732,6 +3748,21 @@
   conn = ep->registration_event.connect (sigc::bind (sigc::ptr_fun (on_registration_event_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
+  /* New Display Engine signals */
+  Ekiga::DisplayCore *display_core = dynamic_cast<Ekiga::DisplayCore *> (mw->core.get ("display-core"));
+
+  conn = display_core->display_info_update_required.connect (sigc::bind (sigc::ptr_fun (on_display_info_update_required_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = display_core->display_size_changed.connect (sigc::bind (sigc::ptr_fun (on_display_size_changed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = display_core->display_mode_changed.connect (sigc::bind (sigc::ptr_fun (on_display_mode_changed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = display_core->fullscreen_mode_changed.connect (sigc::bind (sigc::ptr_fun (on_fullscreen_mode_changed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
   /* New Call Engine signals */
   Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->core.get ("call-core"));
 

Modified: trunk/src/gui/main.h
==============================================================================
--- trunk/src/gui/main.h	(original)
+++ trunk/src/gui/main.h	Tue Jan 15 07:48:04 2008
@@ -63,13 +63,6 @@
 
 
 /* DESCRIPTION  :  /
- * BEHAVIOR     :  Set the size of the video video.
- * PRE          :  Width and height of the widget.
- */
-void gm_main_window_set_resized_video_widget (int width,
-                                              int height);
-
-/* DESCRIPTION  :  /
  * BEHAVIOR     :  Displays the gnomemeeting logo in the video window.
  * PRE          :  The main window GMObject.
  */
@@ -83,18 +76,6 @@
 void gm_main_window_update_logo ();
 
 /* DESCRIPTION  :  /
- * BEHAVIOR     :  Updates the zoom and display variable of the outputdevice.
- * PRE          :  /
- */
-void gm_main_window_update_zoom_display ();
-
-/* DESCRIPTION  :  /
- * BEHAVIOR     :  Updates the Video Acceleration status indicator.
- * PRE          :  /
- */
-void gm_main_window_update_video_accel_status (VideoAccelStatus status);
-
-/* DESCRIPTION  :  /
  * BEHAVIOR     :  Update the main window hold call menu and toolbar items
  * 		   following the call is on hold (TRUE) or not (FALSE).
  * PRE          :  The main window GMObject.
@@ -221,13 +202,6 @@
 
 
 /* DESCRIPTION  :  /
- * BEHAVIOR     :  Select the display type for the main window.
- * PRE          :  A valid display type.
- */
-void gm_main_window_set_display_type (VideoMode display);
-
-
-/* DESCRIPTION  :  /
  * BEHAVIOR     :  Updates the information displayed in the info label
  * 		   of the main window.
  * PRE          :  The main window GMObject, 
@@ -438,7 +412,7 @@
  * BEHAVIOR     :  Toggles between fullscreen mode and the other settings
  * PRE          :  -1: toggle, 0: off, 1: on
  */
-void gm_main_window_toggle_fullscreen (FSToggle toggle);
+// void gm_main_window_toggle_fullscreen (FSToggle toggle);
 
 
 /* DESCRIPTION  :  /



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]