gnomemm r1594 - in cluttermm/trunk: . clutter clutter/cluttermm clutter/src scripts



Author: arminb
Date: Tue Jul  1 16:19:23 2008
New Revision: 1594
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1594&view=rev

Log:
2008-06-30  Armin Burgmeier  <armin openismus com>

	* clutter/src/types.hg: Wrap ClutterInitError.

	* clutter/cluttermm/init.h:
	* clutter/cluttermm/init.cc: Allow reference parameters for init(),
	wrapped clutter_init_with_args, throw InitError if the initialization
	fails.

	* clutter/cluttermm/main.h:
	* clutter/cluttermm/main.cc: Wrapped clutter_main_* functions.

	* clutter/cluttermm/utility.h:
	* clutter/cluttermm/utility.cc: Wrapped clutter_get_debug_enabled,
	clutter_get_show_fps, clutter_get_timestamp, clutter_get_actor_by_gid,
	clutter_set_default_frame_rate, clutter_get_default_frame_rate,
	clutter_set_motion_events_enabled, clutter_get_motion_events_enabled,
	clutter_set_motion_events_frequency,
	clutter_get_motion_events_frequency, clutter_clear_glyph_cache,
	clutter_set_use_mipmapped_text and clutter_get_use_mipmapped_text.

	* clutter/cluttermm/threads.h:
	* clutter/cluttermm/threads.cc: Wrapped the clutter_threads_*
	functions.

	* clutter/cluttermm.h: Added the new header files.

	* clutter/cluttermm/Makefile.am: Added new files to the build.


Added:
   cluttermm/trunk/clutter/cluttermm/main.cc
   cluttermm/trunk/clutter/cluttermm/main.h
   cluttermm/trunk/clutter/cluttermm/threads.cc
   cluttermm/trunk/clutter/cluttermm/threads.h
   cluttermm/trunk/clutter/cluttermm/utility.cc
   cluttermm/trunk/clutter/cluttermm/utility.h
Modified:
   cluttermm/trunk/ChangeLog
   cluttermm/trunk/clutter/cluttermm.h
   cluttermm/trunk/clutter/cluttermm/Makefile.am
   cluttermm/trunk/clutter/cluttermm/init.cc
   cluttermm/trunk/clutter/cluttermm/init.h
   cluttermm/trunk/clutter/src/types.hg
   cluttermm/trunk/scripts/config.guess
   cluttermm/trunk/scripts/config.sub
   cluttermm/trunk/scripts/ltmain.sh

Modified: cluttermm/trunk/clutter/cluttermm.h
==============================================================================
--- cluttermm/trunk/clutter/cluttermm.h	(original)
+++ cluttermm/trunk/clutter/cluttermm.h	Tue Jul  1 16:19:23 2008
@@ -44,15 +44,18 @@
 #include <cluttermm/group.h>
 #include <cluttermm/init.h>
 #include <cluttermm/label.h>
+#include <cluttermm/main.h>
 #include <cluttermm/media.h>
 #include <cluttermm/rectangle.h>
 #include <cluttermm/stage.h>
 #include <cluttermm/texture.h>
+#include <cluttermm/threads.h>
 #include <cluttermm/timeline.h>
 #include <cluttermm/score.h>
 #include <cluttermm/shader.h>
 #include <cluttermm/script.h>
 #include <cluttermm/types.h>
+#include <cluttermm/utility.h>
 
 //#include <cluttermm/box.h>
 //#include <cluttermm/container.h>

Modified: cluttermm/trunk/clutter/cluttermm/Makefile.am
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/Makefile.am	(original)
+++ cluttermm/trunk/clutter/cluttermm/Makefile.am	Tue Jul  1 16:19:23 2008
@@ -11,8 +11,8 @@
 sublib_topdir = clutter
 
 
-files_extra_h	= init.h types.h wrap_init.h
-files_extra_cc	= init.cc
+files_extra_h	= init.h main.h utility.h threads.h wrap_init.h
+files_extra_cc	= init.cc main.cc utility.cc threads.cc
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment
 

Modified: cluttermm/trunk/clutter/cluttermm/init.cc
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/init.cc	(original)
+++ cluttermm/trunk/clutter/cluttermm/init.cc	Tue Jul  1 16:19:23 2008
@@ -17,22 +17,59 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <glibmm/init.h>
-#include <glibmm/ustring.h>
 #include <gdkmm/wrap_init.h>
 #include <cluttermmconfig.h> //For LIBCLUTTERMM_VERSION
+#include <cluttermm/init.h>
 #include <cluttermm/wrap_init.h>
 #include <clutter/clutter.h>
 
-namespace Clutter
+namespace
 {
 
-void init(int* nargs, gchar **args[])
+void common_init()
 {
   Glib::init(); //Sets up the g type system and the Glib::wrap() table.
   Gdk::wrap_init();
-  wrap_init(); //Tells the Glib::wrap() table about the libcluttermm classes.
-  clutter_init(nargs, args);
+  Clutter::wrap_init(); //Tells the Glib::wrap() table about the libcluttermm classes.
+}
+
+}
+
+namespace Clutter
+{
+
+void init(int* argc, gchar **argv[])
+{
+  common_init();
+  GError* error = NULL;
+  clutter_init_with_args(argc, argv, NULL, NULL, NULL, &error);
+  if(error != NULL) Glib::Error::throw_exception(error);
+}
+
+void init(int& argc, gchar**& argv)
+{
+  init(&argc, &argv);
+}
+
+void init(int* argc, gchar** argv[], const Glib::ustring& parameter_string, const ArrayHandle_OptionEntries& entries, const std::string& translation_domain)
+{
+  common_init();
+  GError* error = NULL;
+  clutter_init_with_args(argc, argv, const_cast<char*>(parameter_string.c_str()), const_cast<GOptionEntry*>(entries.data()), const_cast<char*>(translation_domain.c_str()), &error);
+  if(error != NULL) Glib::Error::throw_exception(error);
 }
 
+void init(int& argc, gchar**& argv, const Glib::ustring& parameter_string, const ArrayHandle_OptionEntries& entries, const std::string& translation_domain)
+{
+  init(&argc, &argv, parameter_string, entries, translation_domain);
+}
+
+void add_clutter_option_group(Glib::OptionContext& option_context)
+{
+  // This returns a newly created option group of which we take ownership
+  Glib::OptionGroup cluttergroup(clutter_get_option_group());
+  option_context.add_group(cluttergroup);
+}
+
+
 } //namespace Clutter

Modified: cluttermm/trunk/clutter/cluttermm/init.h
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/init.h	(original)
+++ cluttermm/trunk/clutter/cluttermm/init.h	Tue Jul  1 16:19:23 2008
@@ -24,7 +24,83 @@
 namespace Clutter
 {
 
-void init(int* nargs, gchar** args[]);
+/** It will initialise everything needed to operate with Clutter and parses
+ * some standard command line options. argc and argv are adjusted accordingly
+ * so your own code will never see those standard arguments.
+ *
+ * @param argc a pointer to the number of command line arguments
+ * @param argv a pointer to the array of comman line arguments
+ * @throws InitError
+ */
+void init(int* argc, gchar** argv[]);
+
+/** It will initialise everything needed to operate with Clutter and parses
+ * some standard command line options. argc and argv are adjusted accordingly
+ * so your own code will never see those standard arguments.
+ *
+ * @param argc a pointer to the number of command line arguments
+ * @param argv a pointer to the array of comman line arguments
+ * @throws InitError
+ */
+void init(int& argc, gchar**& argv);
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+struct OptionEntryTraits
+{
+  typedef Glib::OptionEntry CppType;
+  typedef GOptionEntry CType;
+
+  static CppType to_cpp_type(const CType& obj)
+  {
+    // We only convert the other way around:
+    g_assert_not_reached();
+    return CppType();
+  }
+
+  static CType to_c_type(CppType& obj) { return *obj.gobj(); }
+};
+#endif
+typedef Glib::ArrayHandle<Glib::OptionEntry, OptionEntryTraits> ArrayHandle_OptionEntries;
+
+/** This function does the same work as init(). Additionally, it
+ * allows you to add your own command line options, and it automatically
+ * generates nicely formatted --help output. Note that your program will be
+ * terminated after writing out the help output. Also note that, in case of
+ * error, the error message will be placed inside error instead of being
+ * printed on the display.
+ *
+ * @param argc a pointer to the number of command line arguments
+ * @param argv a pointer to the array of comman line arguments
+ * @param parameter_string a string which is displayed in the first line of --help output, after programname [OPTION...]
+ * @param entries an array of Glib::OptionEntrys describing the options of your program
+ * @param translation_domain a translation domain to use for translating the --help output for the options in entries with gettext()
+ * @throws InitError
+ */
+void init(int* argc, gchar** argv[], const Glib::ustring& parameter_string, const ArrayHandle_OptionEntries& entries, const std::string& translation_domain);
+
+/** This function does the same work as init(). Additionally, it
+ * allows you to add your own command line options, and it automatically
+ * generates nicely formatted --help output. Note that your program will be
+ * terminated after writing out the help output. Also note that, in case of
+ * error, the error message will be placed inside error instead of being
+ * printed on the display.
+ *
+ * @param argc a pointer to the number of command line arguments
+ * @param argv a pointer to the array of comman line arguments
+ * @param parameter_string a string which is displayed in the first line of --help output, after programname [OPTION...]
+ * @param entries an array of Glib::OptionEntrys describing the options of your program
+ * @param translation_domain a translation domain to use for translating the --help output for the options in entries with gettext()
+ * @throws InitError
+ */
+void init(int& argc, gchar**& argv, const Glib::ustring& parameter_string, const ArrayHandle_OptionEntries& entries, const std::string& translation_domain);
+
+/** Adds a Glib::OptionGroup for the command line arguments recognized by
+ * Clutter to the given context. This is useful if you are using
+ * Glib::OptionContext::parse() to parse your commandline arguments.
+ *
+ * @param option_context a Glib::OptionContext to add the clutter option group to.
+ */
+void add_clutter_option_group(Glib::OptionContext& option_context);
 
 } //namespace Clutter
 

Added: cluttermm/trunk/clutter/cluttermm/main.cc
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/main.cc	Tue Jul  1 16:19:23 2008
@@ -0,0 +1,41 @@
+// -*- c++ -*-
+/*
+ * Copyright 2008 Jonathon Jongsma
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <cluttermm/main.h>
+#include <clutter/clutter.h>
+
+namespace
+{
+
+void main()
+{
+  clutter_main();
+}
+
+void main_quit()
+{
+  clutter_main_quit();
+}
+
+int main_level()
+{
+  return clutter_main_level();
+}
+
+} //namespace Clutter

Added: cluttermm/trunk/clutter/cluttermm/main.h
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/main.h	Tue Jul  1 16:19:23 2008
@@ -0,0 +1,43 @@
+// -*- c++ -*-
+#ifndef _LIBCLUTTERMM_MAIN_H
+#define _LIBCLUTTERMM_MAIN_H
+/*
+ * Copyright 2008 Jonathon Jongsma
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm.h>
+
+namespace Clutter
+{
+
+/** Starts the Clutter mainloop.
+ */
+void main();
+
+/** Terminates the Clutter mainloop.
+ */
+void main_quit();
+
+/** Retrieves the depth of the Clutter mainloop.
+ * @return The level of the mainloop.
+ */
+int main_level();
+
+} //namespace Clutter
+
+#endif //_LIBCLUTTERMM_MAIN_H
+

Added: cluttermm/trunk/clutter/cluttermm/threads.cc
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/threads.cc	Tue Jul  1 16:19:23 2008
@@ -0,0 +1,152 @@
+// -*- c++ -*-
+/*
+ * Copyright 2008 Jonathon Jongsma
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <cluttermm/threads.h>
+#include <clutter/clutter.h>
+
+namespace
+{
+
+// Inspired by glibmm, see glibmm/main.cc
+class SourceConnectionNode
+{
+public:
+  explicit inline SourceConnectionNode(const sigc::slot_base& slot);
+
+  static void* notify(void* data);
+  static void destroy_notify_callback(void* data);
+  inline void install(guint id);
+  inline sigc::slot_base* get_slot();
+
+private:
+  sigc::slot_base slot_;
+  guint source_id_;
+};
+
+SourceConnectionNode::SourceConnectionNode(const sigc::slot_base& slot)
+:
+  slot_(slot), source_id_(0)
+{
+  slot_.set_parent(this, &SourceConnectionNode::notify);
+}
+
+void* SourceConnectionNode::notify(void* data)
+{
+  SourceConnectionNode* const self = static_cast<SourceConnectionNode*>(data);
+  if(self->source_id_)
+  {
+    g_source_remove(self->source_id_);
+    self->source_id_ = 0;
+
+    // Removing the source triggers the destroy_notify_handler, wait until
+    // that for deletion.
+  }
+}
+
+void SourceConnectionNode::destroy_notify_callback(void* data)
+{
+  SourceConnectionNode* const self = static_cast<SourceConnectionNode*>(data);
+  if(self)
+  {
+    self->source_id_ = 0;
+    delete self;
+  }
+}
+
+void SourceConnectionNode::install(guint source_id)
+{
+  source_id_ = source_id;
+}
+
+sigc::slot_base* SourceConnectionNode::get_slot()
+{
+  return &slot_;
+}
+
+gboolean source_callback(void* data)
+{
+  SourceConnectionNode* const conn_data = static_cast<SourceConnectionNode*>(data);
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
+  {
+#endif
+    // Recreate the specific slot from the generic slot node
+    return (*static_cast<sigc::slot<bool>*>(conn_data->get_slot()))();
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  }
+  catch(...)
+  {
+    Glib::exception_handlers_invoke();
+  }
+#endif // GLIBMM_EXCEPTIONS_ENABLED
+  return FALSE;
+}
+
+}
+
+namespace Clutter
+{
+
+void threads_init()
+{
+  clutter_threads_init();
+}
+
+void threads_enter()
+{
+  clutter_threads_enter();
+}
+
+void threads_leave()
+{
+  clutter_threads_leave();
+}
+
+sigc::connection threads_add_idle(const sigc::slot<bool>& callback, int priority)
+{
+  SourceConnectionNode* const conn_node = new SourceConnectionNode(callback);
+  const sigc::connection connection(*conn_node->get_slot());
+
+  guint id = clutter_threads_add_idle_full(priority, &source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback);
+  conn_node->install(id);
+  return connection;
+}
+
+sigc::connection threads_add_timeout(const sigc::slot<bool>& callback, guint interval, gint priority)
+{
+  SourceConnectionNode* const conn_node = new SourceConnectionNode(callback);
+  const sigc::connection connection(*conn_node->get_slot());
+
+  guint id = clutter_threads_add_timeout_full(priority, interval, &source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback);
+  conn_node->install(id);
+  return connection;
+}
+
+sigc::connection threads_add_frame_source(const sigc::slot<bool>& callback, guint interval, gint priority)
+{
+  SourceConnectionNode* const conn_node = new SourceConnectionNode(callback);
+  const sigc::connection connection(*conn_node->get_slot());
+
+  guint id = clutter_threads_add_frame_source_full(priority, interval, &source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback);
+  conn_node->install(id);
+  return connection;
+}
+
+} //namespace Clutter

Added: cluttermm/trunk/clutter/cluttermm/threads.h
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/threads.h	Tue Jul  1 16:19:23 2008
@@ -0,0 +1,119 @@
+// -*- c++ -*-
+#ifndef _LIBCLUTTERMM_THREADS_H
+#define _LIBCLUTTERMM_THREADS_H
+/*
+ * Copyright 2008 Jonathon Jongsma
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm.h>
+
+namespace Clutter
+{
+
+// TODO: clutter_threads_set_lock_functions ()?
+
+/** Initialises the Clutter threading mechanism, so that Clutter API can be 
+ * called by multiple threads, using threads_enter() and
+ * threads_leave() to mark the critical sections.
+ *
+ * You must call Glib::thread_init() before this function. 
+ *
+ * This function must be called before init().
+ */
+void threads_init();
+
+/** Locks the Clutter thread lock.
+ */
+void threads_enter();
+
+/** Unlocks the Clutter thread lock.
+ */
+void threads_leave();
+
+// TODO: Should there be a SignalSomething class for these, so the
+// sigc::connection makes more semantical sense?
+
+/** Adds a function to be called whenever there are no higher priority events
+ * pending. If the function returns FALSE it is automatically removed from
+ * the list of event sources and will not be called again.
+ *
+ * This variant of g_idle_add_full() calls function with the Clutter lock
+ * held. It can be thought of a MT-safe version for Clutter actors for the
+ * use case where you have to worry about idle_callback() running in thread A
+ * and accessing self after it has been finalized in thread B.
+ *
+ * @param callback function to call
+ * @param priority the priority of the timeout source. Typically this will be in the range between Glib::PRIORITY_DEFAULT_IDLE and Glib::PRIORITY_HIGH_IDLE
+ * @return A sigc::connection that can be used to disconnect the callback
+ * from the idle source.
+ */
+sigc::connection threads_add_idle(const sigc::slot<bool>& callback, int priority = Glib::PRIORITY_DEFAULT_IDLE);
+
+/** Sets a function to be called at regular intervals holding the Clutter
+ * lock, with the given priority. The function is called repeatedly until it
+ * returns false, at which point the timeout is automatically destroyed and
+ * the function will not be called again. The notify function is called when
+ * the timeout is destroyed. The first call to the function will be at the
+ * end of the first interval.
+ *
+ * Note that timeout functions may be delayed, due to the processing of other
+ * event sources. Thus they should not be relied on for precise timing. After
+ * each call to the timeout function, the time of the next timeout is
+ * recalculated based on the current time and the given interval (it does not
+ * try to 'catch up' time lost in delays).
+ *
+ * This variant of g_timeout_add_full() can be thought of a MT-safe version
+ * for Clutter actors. See also threads_add_idle().
+ *
+ * @param callback function to call
+ * @param interval the time between calls to the function, in milliseconds
+ * @param priority the priority of the timeout source. Typically this will be in the range between Glib::PRIORITY_DEFAULT and Glib::PRIORITY_HIGH.
+ * @return A sigc::connection that can be used to disconnect the callback
+ * from the timeout source.
+ */
+sigc::connection threads_add_timeout(const sigc::slot<bool>& callback, guint interval, gint priority = Glib::PRIORITY_DEFAULT);
+
+/** Sets a function to be called at regular intervals holding the Clutter
+ * lock, with the given priority. The function is called repeatedly until it
+ * returns FALSE, at which point the timeout is automatically destroyed and
+ * the function will not be called again. The notify function is called when
+ * the timeout is destroyed. The first call to the function will be at the
+ * end of the first interval.
+ *
+ * This function is similar to clutter_threads_add_timeout_full() except
+ * that it will try to compensate for delays. For example, if func takes half
+ * the interval time to execute then the function will be called again half
+ * the interval time after it finished. In contrast
+ * threads_add_timeout() would not fire until a full interval after the
+ * function completes so the delay between calls would be interval * 1.5.
+ * This function does not however try to invoke the function multiple times
+ * to catch up missing frames if func takes more than interval ms to execute.
+ *
+ * This variant of frame_source_add() can be thought of a MT-safe version for
+ * Clutter actors.
+ *
+ * @param callback function to call
+ * @param interval the time between calls to the function, in milliseconds
+ * @param the priority of the timeout source. Typically this will be in the range between Glib::PRIORITY_DEFAULT and Glib::PRIORITY_HIGH.
+ * @param A sigc::connection that can be used to disconnect the callback from the timeout source.
+ */
+sigc::connection threads_add_frame_source(const sigc::slot<bool>& callback, guint interval, gint priority = Glib::PRIORITY_DEFAULT);
+
+} //namespace Clutter
+
+#endif //_LIBCLUTTERMM_THREADS_H
+

Added: cluttermm/trunk/clutter/cluttermm/utility.cc
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/utility.cc	Tue Jul  1 16:19:23 2008
@@ -0,0 +1,92 @@
+// -*- c++ -*-
+/*
+ * Copyright 2008 Jonathon Jongsma
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <cluttermm/main.h>
+#include <cluttermm/actor.h>
+#include <clutter/clutter.h>
+
+namespace Clutter
+{
+
+bool get_debug_enabled()
+{
+  return clutter_get_debug_enabled();
+}
+
+bool get_show_fps()
+{
+  return clutter_get_show_fps();
+}
+
+gulong get_timestamp()
+{
+  return clutter_get_timestamp();
+}
+
+Glib::RefPtr<Actor> get_actor_by_gid(guint32 id)
+{
+  return Glib::wrap(clutter_get_actor_by_gid(id), true);
+}
+
+void set_default_frame_rate(guint frames_per_sec)
+{
+  clutter_set_default_frame_rate(frames_per_sec);
+}
+
+guint get_default_frame_rate()
+{
+  return clutter_get_default_frame_rate();
+}
+
+void set_motion_events_enabled(bool enable)
+{
+  clutter_set_motion_events_enabled(enable);
+}
+
+bool get_motion_events_enabled()
+{
+  return clutter_get_motion_events_enabled();
+}
+
+void set_motion_events_frequency(guint frequency)
+{
+  clutter_set_motion_events_frequency(frequency);
+}
+
+guint get_motion_events_frequency()
+{
+  return clutter_get_motion_events_frequency();
+}
+
+void clear_glyph_cache()
+{
+  clutter_clear_glyph_cache();
+}
+
+void set_use_mipmapped_text(bool value)
+{
+  clutter_set_use_mipmapped_text(value);
+}
+
+bool get_use_mipmapped_text()
+{
+  return clutter_get_use_mipmapped_text();
+}
+
+} //namespace Clutter

Added: cluttermm/trunk/clutter/cluttermm/utility.h
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/utility.h	Tue Jul  1 16:19:23 2008
@@ -0,0 +1,127 @@
+// -*- c++ -*-
+#ifndef _LIBCLUTTERMM_UTILITY_H
+#define _LIBCLUTTERMM_UTILITY_H
+/*
+ * Copyright 2008 Jonathon Jongsma
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm.h>
+
+namespace Clutter
+{
+
+/** Check if clutter has debugging turned on.
+ * @return true if debugging is turned on, false otherwise.
+ */
+bool get_debug_enabled();
+
+/** Returns whether Clutter should print out the frames per second on the
+ * console. You can enable this setting either using the CLUTTER_SHOW_FPS
+ * environment variable or passing the --clutter-show-fps command line
+ * argument.
+ * @return true if Clutter should show the FPS.
+ */
+bool get_show_fps();
+
+/** Returns the approximate number of microseconds passed since clutter was
+ * intialised.
+ * @return Number of microseconds since clutter_init() was called.
+ */
+gulong get_timestamp();
+
+/** Retrieves the Actor with id.
+ * @param id an Actor ID.
+ * @return the actor with the passed id or a NULL RefPtr.
+ */
+Glib::RefPtr<Actor> get_actor_by_gid(guint32 id);
+
+/** Sets the default frame rate to be used when creating Timeline objects.
+ * @param frames_per_sec the new default frame rate
+ */
+void set_default_frame_rate(guint frames_per_sec);
+
+/** Retrieves the default frame rate used when creating ClutterTimelines.
+ *
+ * This value is also used to compute the default frequency of motion events.
+ * @return the default frame rate
+ */
+guint get_default_frame_rate();
+
+/** Sets whether per-actor motion events should be enabled or not
+ * (the default is to enable them).
+ *
+ * If enable is false the following events will not work:
+ *
+ * <ul>
+ *  <li>ClutterActor::motion-event, unless on the ClutterStage</li>
+ *  <li>ClutterActor::enter-event</li>
+ *  <li>ClutterActor::leave-event</li>
+ * </ul>
+ *
+ * @param enable true to enable per-actor motion events
+ */
+void set_motion_events_enabled(bool enable);
+
+/** Gets whether the per-actor motion events are enabled.
+ * @return true if the motion events are enabled
+ */
+bool get_motion_events_enabled();
+
+/** Sets the motion events frequency. Setting this to a non-zero value will
+ * override the default setting, so it should be rarely used.
+ *
+ * Motion events are delivered from the default backend to the stage and are
+ * used to generate the enter/leave events pair. This might lead to a
+ * performance penalty due to the way the actors are identified. Using this
+ * function is possible to reduce the frequency of the motion events
+ * delivery to the stage.
+ *
+ * @param frequency the number of motion events per second, or 0 for the default value
+ */
+void set_motion_events_frequency(guint frequency);
+
+/** Retrieves the number of motion events per second that are delivered to
+ * the stage.
+ *
+ * See set_motion_events_frequency().
+ * @return the number of motion events per second
+ */
+guint get_motion_events_frequency();
+
+/** Clears the internal cache of glyphs used by the Pango renderer. This will
+ * free up some memory and GL texture resources. The cache will be
+ * automatically refilled as more text is drawn.
+ */
+void clear_glyph_cache();
+
+/** Sets whether subsequent text rendering operations will use mipmapped
+ * textures or not. Using mipmapped textures will improve the quality for
+ * scaled down text but will use more texture memory.
+ * @param value true to enable mipmapping or false to disable.
+ */
+void set_use_mipmapped_text(bool value);
+
+/** Gets whether mipmapped textures are used in text operations. See
+ * set_use_mipmapped_text().
+ * @return true if text operations should use mipmapped textures
+ */
+bool get_use_mipmapped_text();
+
+} //namespace Clutter
+
+#endif //_LIBCLUTTERMM_UTILITY_H
+

Modified: cluttermm/trunk/clutter/src/types.hg
==============================================================================
--- cluttermm/trunk/clutter/src/types.hg	(original)
+++ cluttermm/trunk/clutter/src/types.hg	Tue Jul  1 16:19:23 2008
@@ -18,6 +18,7 @@
 #include <clutter/clutter-types.h>
 #include <clutter/clutter-units.h>
 #include <clutter/clutter-color.h>
+#include <clutter/clutter-main.h>
 
 _DEFS(cluttermm,clutter)
 
@@ -29,6 +30,8 @@
 typedef ClutterFixed Fixed;
 typedef ClutterAngle Angle;
 
+_WRAP_GERROR(InitError, ClutterInitError, CLUTTER_INIT_ERROR, NO_GTYPE)
+
 _WRAP_ENUM(RotateDirection, ClutterRotateDirection, NO_GTYPE)
 _WRAP_ENUM(RotateAxis, ClutterRotateAxis, NO_GTYPE)
 _WRAP_ENUM(Gravity, ClutterGravity, NO_GTYPE)

Modified: cluttermm/trunk/scripts/config.guess
==============================================================================
--- cluttermm/trunk/scripts/config.guess	(original)
+++ cluttermm/trunk/scripts/config.guess	Tue Jul  1 16:19:23 2008
@@ -1 +1 @@
-link /usr/share/libtool/config.guess
\ No newline at end of file
+link /usr/share/automake-1.10/config.guess
\ No newline at end of file

Modified: cluttermm/trunk/scripts/config.sub
==============================================================================
--- cluttermm/trunk/scripts/config.sub	(original)
+++ cluttermm/trunk/scripts/config.sub	Tue Jul  1 16:19:23 2008
@@ -1 +1 @@
-link /usr/share/libtool/config.sub
\ No newline at end of file
+link /usr/share/automake-1.10/config.sub
\ No newline at end of file

Modified: cluttermm/trunk/scripts/ltmain.sh
==============================================================================
--- cluttermm/trunk/scripts/ltmain.sh	(original)
+++ cluttermm/trunk/scripts/ltmain.sh	Tue Jul  1 16:19:23 2008
@@ -1 +1 @@
-link /usr/share/libtool/ltmain.sh
\ No newline at end of file
+link /usr/share/libtool/config/ltmain.sh
\ No newline at end of file



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