[gcompris/origin/gcomprixogoo] Initial MacOSX support using Imendio GTK. I have been able to run GCompris including the Python acti



commit df2ee751622181935b788883591946d2c251948a
Author: Bruno Coudoin <bruno ordinateur-de-bruno-coudoin local>
Date:   Tue Mar 16 01:26:46 2010 +0100

    Initial MacOSX support using Imendio GTK.
    I have been able to run GCompris including the Python activities.
    The Bundle is not yet created.

 Makefile.am               |    6 +-
 configure.ac              |   33 ++-
 install-sh                |    5 +-
 macosx/Info-gnustep.plist |    4 -
 macosx/Info.plist         |   16 +-
 macosx/Makefile.am        |   19 --
 macosx/build-gtk.sh       |  720 ---------------------------------------------
 macosx/config.h           |  495 -------------------------------
 macosx/fonts.conf         |  154 ----------
 macosx/glibconfig.h       |  222 --------------
 macosx/main.c             |  464 -----------------------------
 macosx/pangorc            |   10 -
 src/boards/python.c       |    3 +-
 src/gcompris/Makefile.am  |   16 +-
 src/gcompris/gameutil.c   |    7 +-
 src/gcompris/gcompris.c   |   55 +++-
 16 files changed, 92 insertions(+), 2137 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 70f03eb..6801f54 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,9 +12,9 @@ endif
 
 SUBDIRS = po src boards $(DOCS_SUBDIR) autopackage
 
-if OS_MACOSX
-SUBDIRS += macosx
-endif
+# if OS_MACOSX
+# SUBDIRS += macosx
+# endif
 
 
 icondir=$(datadir)/pixmaps
diff --git a/configure.ac b/configure.ac
index 44325f0..b879424 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ AM_GLIB_GNU_GETTEXT
 
 GTK_REQUIRED=2.12.0
 LIBRSVG_REQUIRED=2.26.0
-LIBXML_REQUIRED=2.7.3
+LIBXML_REQUIRED=2.6.13
 
 dnl
 dnl Start of pkg-config checks
@@ -54,9 +54,9 @@ dnl
 
 PKG_CHECK_MODULES(GCOMPRIS, \
   gtk+-2.0 >= $GTK_REQUIRED \
-  gstreamer-0.10 \
   librsvg-2.0 >= $LIBRSVG_REQUIRED \
-  libxml-2.0 >= $LIBXML_REQUIRED)
+  libxml-2.0 >= $LIBXML_REQUIRED \
+  gthread-2.0)
 
 AC_SUBST(GCOMPRIS_CFLAGS)
 AC_SUBST(GCOMPRIS_LIBS)
@@ -66,7 +66,7 @@ AC_MSG_CHECKING([for OSX])
 case "$host" in
   *-apple-darwin*)
     native_osx=yes
-    OSX_CFLAGS="$CFLAGS -arch i386 -arch ppc "
+    OSX_CFLAGS="$CFLAGS -arch i386 "
     ;;
   *)
     AC_CHECK_LIB(X11, XOpenDisplay)
@@ -78,6 +78,17 @@ AC_MSG_RESULT([$native_osx])
 
 AM_CONDITIONAL(OS_MACOSX, test "$native_osx" = yes)
 
+### --------------------------------------------------------------------------
+### Check to see if GDK uses the quartz backend and if we can use
+### MacOSX integration
+_gdk_tgt=`$PKG_CONFIG --variable=target gdk-2.0`
+AM_CONDITIONAL([GDK_TARGET_QUARTZ], [test x$_gdk_tgt = xquartz])
+if test "x$_gdk_tgt" = xquartz; then
+   PKG_CHECK_MODULES(IGE_MAC, ige-mac-integration)
+   AC_SUBST(IGE_MAC_LIBS)
+   AC_SUBST(IGE_MAC_CFLAGS)
+fi
+
 # nsbundle default is no even for osx
 nsbundle="no"
 
@@ -432,19 +443,18 @@ AM_CONDITIONAL([SUGAR], [test x$with_sugar = xyes])
 dnl check for python
 AC_ARG_WITH(python,AC_HELP_STRING(
     [--with-python=path],
-    [set the path for python]), python_path=$withval, python_path=not)
+    [set the path for python]), python_path=$withval, python_path=no)
 if test x$python_path = xno ; then
 build_python_plugin="no"
 else
 
 
-if test x$python_path != xnot ; then
+if test x$python_path != xno ; then
 PYTHON=$python_path
 fi
 
 AM_PATH_PYTHON
 AM_CHECK_PYTHON_HEADERS( [build_python_plugin="yes"], [build_python_plugin="no"] )
-
 fi
 
 dnl Finally output the required python variables and automake defines.
@@ -498,10 +508,10 @@ else
     dnl     AM_CHECK_PYMOD(gnomecanvas,,,AC_MSG_ERROR([*** gnome.canvas or gnomecanvas installed but not visible from python ]))
     dnl   fi
 
-    if test x$with_sqlite = xyes; then
-	AM_CHECK_PYMOD(pysqlite2,,,AC_MSG_ERROR([*** pysqlite2 missing ]))
-	REQUIRE_PYTHON="$REQUIRE_PYTHON python-sqlite2"
-    fi
+dnl    if test x$with_sqlite = xyes; then
+dnl	AM_CHECK_PYMOD(pysqlite2,,,AC_MSG_ERROR([*** pysqlite2 missing ]))
+dnl	REQUIRE_PYTHON="$REQUIRE_PYTHON python-sqlite2"
+dnl    fi
 
   else
     AC_MSG_WARN([py-build-only: Skipping python modules dependancies])
@@ -553,7 +563,6 @@ docs/Makefile
 docs/eu/Makefile
 docs/fr/Makefile
 gcompris-installer.nsi
-macosx/Makefile
 po/Makefile.in
 src/Makefile
 src/administration-activity/Makefile
diff --git a/install-sh b/install-sh
index 6781b98..a5897de 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2006-12-25.00
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -515,6 +515,5 @@ done
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
+# time-stamp-end: "$"
 # End:
diff --git a/macosx/Info.plist b/macosx/Info.plist
index a61a477..324f764 100644
--- a/macosx/Info.plist
+++ b/macosx/Info.plist
@@ -7,24 +7,24 @@
     <key>CFBundleExecutable</key>
     <string>GCompris</string>
     <key>CFBundleGetInfoString</key>
-    <string>8.3BETA1 200-2006 Bruno Coudoin and the GCompris Team</string>
+    <string>9.2, Copyright 2000-2010 Bruno Coudoin and Others</string>
     <key>CFBundleIconFile</key>
-    <string>GCompris.icns</string>
+    <string>Giggle.icns</string>
     <key>CFBundleIdentifier</key>
-    <string>org.gcompris.GCompris</string>
+    <string>net.gcompris</string>
     <key>CFBundleInfoDictionaryVersion</key>
     <string>6.0</string>
     <key>CFBundlePackageType</key>
     <string>APPL</string>
     <key>CFBundleShortVersionString</key>
-    <string>8.3.BETA1</string>
+    <string>9.2</string>
     <key>CFBundleSignature</key>
-    <string>GCom</string>
+    <string>????</string>
     <key>CFBundleVersion</key>
-    <string>8.3.BETA1</string>
+    <string>9.2</string>
     <key>NSHumanReadableCopyright</key>
-    <string>Copyright 2000-2007 GCompris Developers, GNU General Public Licensev2.</string>
+    <string>Copyright 2000-2010 Bruno Coudoin and Others.</string>
     <key>LSMinimumSystemVersion</key>
-    <string>10.3</string>
+    <string>10.4</string>
 </dict>
 </plist>
diff --git a/src/boards/python.c b/src/boards/python.c
index 8706e67..98ac188 100644
--- a/src/boards/python.c
+++ b/src/boards/python.c
@@ -17,7 +17,8 @@
  */
 
 #include <Python.h>
-//#define NO_IMPORT_PYGOBJECT 1
+#define NO_IMPORT_PYGOBJECT
+#define NO_IMPORT_PYGTK
 #include <pygobject.h>
 #include <pygtk/pygtk.h>
 #include "gcompris/gcompris.h"
diff --git a/src/gcompris/Makefile.am b/src/gcompris/Makefile.am
index 2f3944c..92acc86 100644
--- a/src/gcompris/Makefile.am
+++ b/src/gcompris/Makefile.am
@@ -23,13 +23,13 @@ no_undefined =
 shared =
 endif
 
-if WITH_NSBUNDLE
-gcompris_nsbundle_m = gcompris-nsbundle.m
-gcompris_nsbundle_h = gcompris-nsbundle.h
-else
+#if WITH_NSBUNDLE
+#gcompris_nsbundle_m = gcompris-nsbundle.m
+#gcompris_nsbundle_h = gcompris-nsbundle.h
+#else
 gcompris_nsbundle_m =
 gcompris_nsbundle_h =
-endif
+#endif
 
 bin_PROGRAMS = gcompris
 
@@ -47,7 +47,8 @@ INCLUDES = \
 	$(DBUS_CFLAGS) \
 	$(AUDIO_CFLAGS) \
 	$(cairo_cflags) \
-	$(NSBUNDLE_CPPFLAGS)
+	$(NSBUNDLE_CPPFLAGS) \
+	${IGE_MAC_CFLAGS}
 
 gcompris_SOURCES = \
 	$(cairo_c) \
@@ -126,7 +127,8 @@ gcompris_LDADD = \
 	$(GCOMPRIS_LIBS) $(sqlite_ldadd) $(XML_LIBS) $(GNET_LIBS) \
 	$(DBUS_LIBS) \
 	$(AUDIO_LIBS) \
-        $(INTLLIBS) $(NSBUNDLE_LDFLAGS)
+        $(INTLLIBS) $(NSBUNDLE_LDFLAGS) \
+	${IGE_MAC_LIBS}
 
 marshal_sources =				\
 	gc-marshal.c				\
diff --git a/src/gcompris/gameutil.c b/src/gcompris/gameutil.c
index 3d460be..f849bfe 100644
--- a/src/gcompris/gameutil.c
+++ b/src/gcompris/gameutil.c
@@ -654,9 +654,10 @@ gc_file_find_absolute(const gchar *format, ...)
 
  FOUND:
   g_free(filename);
-  char *abs_name = realpath(absolute_filename, NULL);
-  g_free(absolute_filename);
-  return abs_name;
+  //  printf("absolute_filename=%s\n", absolute_filename);
+  //  char *abs_name = realpath(absolute_filename, NULL);
+  //g_free(absolute_filename);
+  return absolute_filename;
 }
 
 gchar*
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index f84c719..7d1770f 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -24,13 +24,24 @@
 #include <time.h>
 #include <string.h>
 
-#ifndef WIN32
+#include "gcompris.h"
+
+#ifdef WIN32
+// WIN32
+#elif NSBUNDLE
+// MACOSX
+#else WIN32
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #include <gdk/gdkx.h>
 #endif
 
+// Include Mac OS X menu synchronization on native OSX build
+#ifdef  MAC_INTEGRATION
+#include "ige-mac-menu.h"
+#endif
+
 #include <glib/gstdio.h>
 
 #include "gcompris.h"
@@ -44,7 +55,7 @@
 
 /* for NSBUNDLE */
 #ifdef NSBUNDLE
-#include "gcompris-nsbundle.h"
+//#include "gcompris-nsbundle.h"
 #endif
 
 /* get the default database name */
@@ -65,7 +76,9 @@ gchar * exec_prefix = NULL;
 //static gint pause_board_cb (GtkWidget *widget, gpointer data);
 static void quit_cb (GtkWidget *widget, gpointer data);
 static void map_cb  (GtkWidget *widget, gpointer data);
-#ifndef WIN32
+#ifdef WIN32
+#elif NSBUNDLE
+#else WIN32
 static gboolean _realize_callback (GtkWidget *widget, GdkEventExpose *event,
 				   gpointer data);
 #endif
@@ -290,7 +303,7 @@ _gc_size_allocate_event_callback (GtkWidget   *widget,
 {
   double xratio, yratio;
   double canvas_width, canvas_height;
-
+  printf("gc_size_allocate\n");
   yratio=allocation->height/(float)(BOARDHEIGHT);
   xratio=allocation->width/(float)BOARDWIDTH;
   zoom_factor = MIN(xratio, yratio);
@@ -636,7 +649,9 @@ gc_set_default_background(GooCanvasItem *parent)
 /*
  * Sugar requires properties to be set before the windows is realized
  */
-#ifndef WIN32
+#ifdef WIN32
+#elif NSBUNDLE
+#else
 static gboolean
 _realize_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 {
@@ -685,6 +700,17 @@ init_workspace()
 			 BOARDWIDTH,
 			 BOARDHEIGHT);
   g_object_set (G_OBJECT(canvas), "background-color", "#000", NULL);
+
+#ifdef MAC_INTEGRATION
+  GtkWidget *quit_item;
+  quit_item = gtk_menu_item_new();
+  ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM (quit_item));
+  gtk_signal_connect(GTK_OBJECT (quit_item),
+		     "activate", GTK_SIGNAL_FUNC (quit_cb), NULL);
+  gtk_widget_show (quit_item);
+
+#endif
+
 }
 
 static GcomprisBoard *get_board_to_start()
@@ -781,7 +807,7 @@ static void setup_window ()
                    GDK_HINT_BASE_SIZE;
   if (!popt_sugar_look)
       geom_mask |= GDK_HINT_ASPECT;
-  gtk_window_set_geometry_hints (GTK_WINDOW (window), NULL, &hints, geom_mask);
+  //  gtk_window_set_geometry_hints (GTK_WINDOW (window), NULL, &hints, geom_mask);
 
   /*
    * Set the main window
@@ -790,7 +816,9 @@ static void setup_window ()
 
   gtk_window_set_default_size(GTK_WINDOW(window), BOARDWIDTH, BOARDHEIGHT);
   gtk_window_set_wmclass(GTK_WINDOW(window), "gcompris", "GCompris");
-#ifndef WIN32
+#ifdef WIN32
+#elif NSBUNDLE
+#else WIN32
   g_signal_connect (GTK_OBJECT (window), "realize",
 		    G_CALLBACK (_realize_callback), NULL);
 #endif
@@ -1061,16 +1089,18 @@ void gc_fullscreen_set(gboolean state)
   static gint window_w = BOARDWIDTH;
   static gint window_h = BOARDHEIGHT;
 
+  printf("fullscreen_set %d\n", state);
   fullscreen = state;
   if(state)
     {
       gtk_window_get_position ( (GtkWindow*)( window ), &window_x, &window_y );
       gtk_window_get_size ( GTK_WINDOW ( window ), &window_w, &window_h );
-#ifdef WIN32
+#ifdef WIN32 || NSBUNDLE
       // WARNING: Doing this is required on Windows
       //          but keep the window hidden on GNU/Linux
       gtk_widget_hide ( window );
 #endif
+      gtk_widget_hide ( window );
       gtk_window_set_decorated ( GTK_WINDOW ( window ), FALSE );
       gtk_window_set_type_hint ( GTK_WINDOW ( window ),
 				 GDK_WINDOW_TYPE_HINT_DESKTOP );
@@ -1082,6 +1112,7 @@ void gc_fullscreen_set(gboolean state)
       gtk_window_move ( GTK_WINDOW ( window ), 0, 0 );
 
       GdkScreen *screen = gtk_window_get_screen ( GTK_WINDOW ( window ) );
+      printf("%d // %d\n", gdk_screen_get_width (screen), gdk_screen_get_height (screen) );
       gtk_window_resize ( GTK_WINDOW ( window ),
 			  gdk_screen_get_width (screen),
 			  gdk_screen_get_height (screen) );
@@ -1199,11 +1230,11 @@ static void load_properties ()
   /* usefull for OSX bundle app */
   /* FIXME exec_prefix should be put in properties */
   /* usefull for OSX bundle app */
-#ifdef NSBUNDLE
-  exec_prefix = gcompris_nsbundle_resource ();
-#else
+  //#ifdef NSBUNDLE
+  //  exec_prefix = gcompris_nsbundle_resource ();
+  //#else
   exec_prefix = gbr_find_exe_dir(NULL);
-#endif
+  //#endif
   g_warning("exec_prefix %s\n", (exec_prefix==NULL ? "NONE" : exec_prefix));
 
   {



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