gnomemm r1596 - in cluttermm/trunk: . clutter clutter/cluttermm clutter/src



Author: arminb
Date: Wed Jul  2 19:04:21 2008
New Revision: 1596
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1596&view=rev

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

	* clutter/src/timeout-pool.hg:
	* clutter/src/timeout-pool.ccg: Wrapped ClutterTimeoutPool.

	* clutter/cluttermm/frame-source.h:
	* clutter/cluttermm/frame-source.cc: Wrapped clutter_frame_source_add.

	* clutter/cluttermm/main.h:
	* clutter/cluttermm/main.cc: Wrapped the pointer grabbing/ungrabbing
	functions.

	* clutter/cluttermm/threads.h: Fix documentation.

	* clutter/cluttermm/utility.cc:
	* clutter/cluttermm/utility.h: Wrapped clutter_util_next_p2.

	* clutter/cluttermm/Makefile.am:
	* clutter/src/Makefile_list_of_hg.am_fragment: Added new files to
	build.

	* clutter/cluttermm.h: Added new includes.


Added:
   cluttermm/trunk/clutter/cluttermm/frame-source.cc
   cluttermm/trunk/clutter/cluttermm/frame-source.h
   cluttermm/trunk/clutter/src/timeout-pool.ccg
   cluttermm/trunk/clutter/src/timeout-pool.hg
Modified:
   cluttermm/trunk/ChangeLog
   cluttermm/trunk/clutter/cluttermm.h
   cluttermm/trunk/clutter/cluttermm/Makefile.am
   cluttermm/trunk/clutter/cluttermm/main.cc
   cluttermm/trunk/clutter/cluttermm/main.h
   cluttermm/trunk/clutter/cluttermm/threads.h
   cluttermm/trunk/clutter/cluttermm/utility.cc
   cluttermm/trunk/clutter/cluttermm/utility.h
   cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment

Modified: cluttermm/trunk/clutter/cluttermm.h
==============================================================================
--- cluttermm/trunk/clutter/cluttermm.h	(original)
+++ cluttermm/trunk/clutter/cluttermm.h	Wed Jul  2 19:04:21 2008
@@ -41,6 +41,7 @@
 #include <cluttermm/color.h>
 #include <cluttermm/effecttemplate.h>
 #include <cluttermm/entry.h>
+#include <cluttermm/frame-source.h>
 #include <cluttermm/group.h>
 #include <cluttermm/init.h>
 #include <cluttermm/label.h>
@@ -54,6 +55,7 @@
 #include <cluttermm/score.h>
 #include <cluttermm/shader.h>
 #include <cluttermm/script.h>
+#include <cluttermm/timeout-pool.h>
 #include <cluttermm/types.h>
 #include <cluttermm/utility.h>
 

Modified: cluttermm/trunk/clutter/cluttermm/Makefile.am
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/Makefile.am	(original)
+++ cluttermm/trunk/clutter/cluttermm/Makefile.am	Wed Jul  2 19:04:21 2008
@@ -11,8 +11,8 @@
 sublib_topdir = clutter
 
 
-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
+files_extra_h	= init.h main.h utility.h threads.h frame-source.h wrap_init.h
+files_extra_cc	= init.cc main.cc utility.cc threads.cc frame-source.cc
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment
 

Added: cluttermm/trunk/clutter/cluttermm/frame-source.cc
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/frame-source.cc	Wed Jul  2 19:04:21 2008
@@ -0,0 +1,119 @@
+// -*- 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/frame-source.h>
+#include <clutter/clutter.h>
+
+namespace
+{
+
+// Inspired by glibmm, see glibmm/main.cc
+// This is copied from cluttermm/threads.cc. We should perhaps move it into
+// a private header to avoid code duplication.
+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
+{
+
+sigc::connection frame_source_add(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_frame_source_add_full(priority, interval, &source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback);
+  conn_node->install(id);
+  return connection;
+}
+
+} //namespace Clutter

Added: cluttermm/trunk/clutter/cluttermm/frame-source.h
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/cluttermm/frame-source.h	Wed Jul  2 19:04:21 2008
@@ -0,0 +1,52 @@
+// -*- c++ -*-
+#ifndef _LIBCLUTTERMM_FRAME_SOURCE_H
+#define _LIBCLUTTERMM_FRAME_SOURCE_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
+{
+
+/** Sets a function to be called at regular intervals 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 first call to the function will be at the end of the first
+ * interval.
+ *
+ * This function is similar to Glib::SignalTimeout 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 Glib::SignalTimeout 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 callback takes more than
+ * interval ms to execute.
+ *
+ * @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.
+ * @return A sigc::connection that can be used to disconnect the callback from the timeout source.
+ */
+sigc::connection frame_source_add(const sigc::slot<bool>& callback, guint interval, gint priority = Glib::PRIORITY_DEFAULT);
+
+} //namespace Clutter
+
+#endif //_LIBCLUTTERMM_FRAME_SOURCE_H
+

Modified: cluttermm/trunk/clutter/cluttermm/main.cc
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/main.cc	(original)
+++ cluttermm/trunk/clutter/cluttermm/main.cc	Wed Jul  2 19:04:21 2008
@@ -20,7 +20,7 @@
 #include <cluttermm/main.h>
 #include <clutter/clutter.h>
 
-namespace
+namespace Clutter
 {
 
 void main()
@@ -38,4 +38,109 @@
   return clutter_main_level();
 }
 
+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();
+}
+
+Glib::RefPtr<Actor> get_keyboard_grab()
+{
+  return Glib::wrap(clutter_get_keyboard_grab(), true);
+}
+
+Glib::RefPtr<Actor> get_pointer_grab()
+{
+  return Glib::wrap(clutter_get_pointer_grab(), true);
+}
+
+void grab_keyboard(const Glib::RefPtr<Actor>& actor)
+{
+  clutter_grab_keyboard(actor->gobj());
+}
+
+void grab_pointer(const Glib::RefPtr<Actor>& actor)
+{
+  clutter_grab_pointer(actor->gobj());
+}
+
+void ungrab_keyboard()
+{
+  clutter_ungrab_keyboard();
+}
+
+void ungrab_pointer()
+{
+  clutter_ungrab_pointer();
+}
+
+void grab_pointer_for_device(const Glib::RefPtr<Actor>& actor, int id)
+{
+  clutter_grab_pointer_for_device(actor->gobj(), id);
+}
+
+void ungrab_pointer_for_device(int id)
+{
+  clutter_ungrab_pointer_for_device(id);
+}
+
 } //namespace Clutter

Modified: cluttermm/trunk/clutter/cluttermm/main.h
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/main.h	(original)
+++ cluttermm/trunk/clutter/cluttermm/main.h	Wed Jul  2 19:04:21 2008
@@ -20,6 +20,7 @@
  */
 
 #include <glibmm.h>
+#include <cluttermm/actor.h>
 
 namespace Clutter
 {
@@ -37,6 +38,166 @@
  */
 int main_level();
 
+/** 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();
+
+/** Queries the current keyboard grab of clutter.
+ * @return the actor currently holding the keyboard grab, or an empty
+ * Glib::RefPtr if there is no grab.
+ */
+Glib::RefPtr<Actor> get_keyboard_grab();
+
+/** Queries the current pointer grab of clutter.
+ * @return the actor currently holding the pointer grab, or am empty
+ * Glib::RefPtr if there is no grab.
+ */
+Glib::RefPtr<Actor> get_pointer_grab();
+
+/** Grabs keyboard events, after the grab is done keyboard events
+ * ("key-press-event" and "key-release-event") are delivered to this actor
+ * directly. The source set in the event will be the actor that would have
+ * received the event if the keyboard grab was not in effect.
+ * @param actor An Actor
+ */
+void grab_keyboard(const Glib::RefPtr<Actor>& actor);
+
+/** Grabs pointer events, after the grab is done all pointer related events
+ * (press, motion, release, enter, leave and scroll) are delivered to this
+ * actor directly. The source set in the event will be the actor that would
+ * have received the event if the pointer grab was not in effect.
+ *
+ * If you wish to grab all the pointer events for a specific input device,
+ * you should use grab_pointer_for_device().
+ * @param actor An Actor
+ */
+void grab_pointer(const Glib::RefPtr<Actor>& actor);
+
+/** Removes an existing grab of the keyboard.
+ */
+void ungrab_keyboard();
+
+/** Removes an existing grab of the pointer.
+ */
+void ungrab_pointer();
+
+/** Grabs all the pointer events coming from the device id for actor.
+ *
+ * If id is -1 then this function is equivalent to grab_pointer().
+ *
+ * @param actor An Actor.
+ * @param id a device id, or -1
+ */
+void grab_pointer_for_device(const Glib::RefPtr<Actor>& actor, int id);
+
+/** Removes an existing grab of the pointer events for device id.
+ *
+ * @param a device id
+ */
+void ungrab_pointer_for_device(int id);
+
+#if 0
+// As this function should never be used by applications, we don't wrap it
+// until someone really needs it.
+/** Processes an event. This function should never be called by applications.
+ * @param event An Event.
+ */
+void do_event(Event* event);
+#endif
+
 } //namespace Clutter
 
 #endif //_LIBCLUTTERMM_MAIN_H

Modified: cluttermm/trunk/clutter/cluttermm/threads.h
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/threads.h	(original)
+++ cluttermm/trunk/clutter/cluttermm/threads.h	Wed Jul  2 19:04:21 2008
@@ -48,10 +48,10 @@
 // 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
+ * 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
+ * This variant of Glib::signal_idle 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.
@@ -66,9 +66,8 @@
 /** 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.
+ * the function will not be called again. 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
@@ -76,7 +75,7 @@
  * 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
+ * This variant of Glib::SignalTimeout can be thought of a MT-safe version
  * for Clutter actors. See also threads_add_idle().
  *
  * @param callback function to call
@@ -89,12 +88,11 @@
 
 /** 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.
+ * returns false, at which point the timeout is automatically destroyed and
+ * the function will not be called again. 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
+ * This function is similar to 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
@@ -109,7 +107,7 @@
  * @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.
+ * @return 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);
 

Modified: cluttermm/trunk/clutter/cluttermm/utility.cc
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/utility.cc	(original)
+++ cluttermm/trunk/clutter/cluttermm/utility.cc	Wed Jul  2 19:04:21 2008
@@ -24,69 +24,9 @@
 namespace Clutter
 {
 
-bool get_debug_enabled()
+int util_next_p2(int a)
 {
-  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();
+  return clutter_util_next_p2(a);
 }
 
 } //namespace Clutter

Modified: cluttermm/trunk/clutter/cluttermm/utility.h
==============================================================================
--- cluttermm/trunk/clutter/cluttermm/utility.h	(original)
+++ cluttermm/trunk/clutter/cluttermm/utility.h	Wed Jul  2 19:04:21 2008
@@ -24,102 +24,7 @@
 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();
+int util_next_p2(int a);
 
 } //namespace Clutter
 

Modified: cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment	(original)
+++ cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment	Wed Jul  2 19:04:21 2008
@@ -29,5 +29,6 @@
 shader.hg \
 script.hg \
 scriptable.hg \
-effecttemplate.hg
+effecttemplate.hg \
+timeout-pool.hg
 #layout.hg box.hg margin.hg

Added: cluttermm/trunk/clutter/src/timeout-pool.ccg
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/src/timeout-pool.ccg	Wed Jul  2 19:04:21 2008
@@ -0,0 +1,42 @@
+/* Copyright (C) 2007 The cluttermm Development Team
+ *
+ * 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.
+ */
+
+namespace
+{
+
+gboolean timout_source_func(gpointer data)
+{
+  return (*static_cast<Clutter::TimeoutPool::TimeoutSlot*>(data))();
+}
+
+void timeout_slot_destroy_func(gpointer data)
+{
+  delete static_cast<Clutter::TimeoutPool::TimeoutSlot*>(data);
+}
+
+}
+
+namespace Clutter
+{
+
+guint TimeoutPool::add(guint interval, const TimeoutSlot& func, int priority)
+{
+  return clutter_timeout_pool_add(gobj(), interval, timout_source_func, new TimeoutSlot(func), timeout_slot_destroy_func);
+}
+
+}
+

Added: cluttermm/trunk/clutter/src/timeout-pool.hg
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/src/timeout-pool.hg	Wed Jul  2 19:04:21 2008
@@ -0,0 +1,61 @@
+/* Copyright (C) 2007 The cluttermm Development Team
+ *
+ * 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 <clutter/clutter-timeout-pool.h>
+
+_DEFS(cluttermm,clutter)
+
+namespace Clutter
+{
+
+/** A timeout pool should be used when multiple timeout functions, running at
+ * the same priority, are needed and the Glib::SignalTimeout API might lead to
+ * starvation of the time slice of the main loop. A timeout pool allocates a
+ * single time slice of the main loop and runs every timeout function
+ * inside it. The timeout pool is always sorted, so that the extraction of
+ * the next timeout function is a constant time operation.
+ *
+ * Inside Clutter, every Timeline share the same timeout pool, unless the
+ * CLUTTER_TIMELINE=no-pool environment variable is set.
+ */
+class TimeoutPool
+{
+  _CLASS_GENERIC(TimeoutPool, ClutterTimeoutPool)
+
+public:
+  explicit TimeoutPool(int priority);
+
+  typedef sigc::slot<bool> TimeoutSlot;
+  _WRAP_METHOD_DOCS_ONLY(clutter_timeout_pool_add)
+  guint add(guint interval, const TimeoutSlot& func, int priority = Glib::PRIORITY_DEFAULT);
+
+  _WRAP_METHOD(void remove(guint id), clutter_timeout_pool_remove)
+
+  ClutterTimeoutPool* gobj() { return gobject_; }
+  const ClutterTimeoutPool* gobj() const { return gobject_; }
+
+protected:
+  ClutterTimeoutPool* gobject_;
+
+private:
+  // noncopyable:
+  TimeoutPool(const TimeoutPool& other);
+  TimeoutPool& operator=(const TimeoutPool& other);
+};
+
+}
+



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