removed ClutterReal; added clutter-units
authorTomas Frydrych <tf@openedhand.com>
Tue, 22 May 2007 09:31:40 +0000 (09:31 +0000)
committerTomas Frydrych <tf@openedhand.com>
Tue, 22 May 2007 09:31:40 +0000 (09:31 +0000)
24 files changed:
ChangeLog
Makefile.am
clutter.pc.in
clutter/Makefile.am
clutter/clutter-actor.c
clutter/clutter-actor.h
clutter/clutter-group.c
clutter/clutter-label.c
clutter/clutter-real.h [deleted file]
clutter/clutter-units.h [new file with mode: 0644]
clutter/clutter.h
clutter/egl/clutter-stage-egl.c
clutter/glx/clutter-stage-glx.c
clutter/sdl/clutter-stage-sdl.c
configure.ac
doc/reference/ChangeLog
doc/reference/clutter-docs.sgml
doc/reference/clutter-sections.txt
doc/reference/tmpl/clutter-actor.sgml
doc/reference/tmpl/clutter-alpha.sgml
doc/reference/tmpl/clutter-media.sgml
doc/reference/tmpl/clutter-units.sgml [new file with mode: 0644]
examples/Makefile.am
tests/Makefile.am

index 8b3e6ae..f36eba1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2007-05-22  Tomas Frydrych  <tf@openedhand.com>
+
+       * configure.ac:
+       * Makefile.am:
+       * clutter.pc.in:
+       * clutter/Makefile.am:
+       * clutter/clutter-actor.c:
+       * clutter/clutter-actor.h:
+       * clutter/clutter-group.c:
+       * clutter/clutter-label.c:
+       * clutter/clutter-real.h:
+       * clutter/clutter-units.h:
+       * clutter/clutter.h:
+       * clutter/egl/clutter-stage-egl.c:
+       * clutter/glx/clutter-stage-glx.c:
+       * clutter/sdl/clutter-stage-sdl.c:
+       * examples/Makefile.am:
+       * tests/Makefile.am:
+       Removed ClutterReal; added clutter-units.
+       
 2007-05-18  Tomas Frydrych  <tf@openedhand.com>
        
        * configure.ac:
index f1aac6c..ac3d4b2 100644 (file)
@@ -1,8 +1,8 @@
 SUBDIRS=clutter doc examples tests
 
-pcfiles = clutter@CLUTTER_REAL@-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.pc
+pcfiles = clutter-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.pc
 
-%@CLUTTER_REAL@-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.pc: %.pc
+%-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.pc: %.pc
        cp $< $@
 
 pkgconfig_DATA = $(pcfiles)
index 4bee3fd..8d413cd 100644 (file)
@@ -3,12 +3,11 @@ exec_prefix=${prefix}
 libdir=${exec_prefix}/lib
 includedir=${prefix}/include
 backend=@clutterbackend@
-real=@CLUTTER_REAL@
 apiversion=@CLUTTER_API_VERSION@
 
 Name: Clutter
 Description: Clutter Core Library (${backend} backend)
 Version: @VERSION@
-Libs: -L${libdir} -lclutter${real}-${backend}-${apiversion}
+Libs: -L${libdir} -lclutter-${backend}-${apiversion}
 Cflags: -I${includedir}/clutter-${apiversion}
 Requires: glib-2.0 >= 2.10 gobject-2.0 gthread-2.0 pangoft2 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0
index 3a75373..681b0b4 100644 (file)
@@ -60,6 +60,7 @@ source_h =                                    \
        $(srcdir)/clutter-texture.h             \
        $(srcdir)/clutter-timeline.h            \
        $(srcdir)/clutter-effect.h              \
+       $(srcdir)/clutter-units.h               \
        $(srcdir)/clutter-util.h                \
        $(srcdir)/clutter-version.h             \
        $(NULL)
@@ -159,19 +160,19 @@ source_h_priv = \
        $(NULL)
 
 
-libclutter@CLUTTER_REAL@_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_LIBADD =   \
+libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_LIBADD =   \
   $(CLUTTER_LIBS) pango/libpangoclutter.la                       \
   @CLUTTER_FLAVOUR@/libclutter-@CLUTTER_FLAVOUR@.la              \
   cogl/@CLUTTER_COGL@/libclutter-cogl.la         
 
-libclutter@CLUTTER_REAL@_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_SOURCES =  \
+libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_SOURCES =  \
   $(source_c) $(source_h) $(source_h_priv)                      
 
-libclutter@CLUTTER_REAL@_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_LDFLAGS = $(LDADD)
+libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_LDFLAGS = $(LDADD)
 
 lib_LTLIBRARIES = $(clutterbackendlib)
 
-EXTRA_LTLIBRARIES = libclutter@CLUTTER_REAL@-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@.la
+EXTRA_LTLIBRARIES = libclutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@.la
 
 clutterdir = $(includedir)/clutter-@CLUTTER_API_VERSION@/clutter
 
index 132a447..93d85b7 100644 (file)
@@ -39,6 +39,7 @@
 #include "clutter-marshal.h"
 #include "clutter-private.h"
 #include "clutter-debug.h"
+#include "clutter-units.h"
 #include "cogl.h"
 
 #include <GL/gl.h>
@@ -55,7 +56,7 @@ static guint32 __id = 0;
 
 struct _ClutterActorPrivate
 {
-  ClutterActorBoxReal coords;
+  ClutterActorBox coords;
 
   ClutterGeometry clip;
   guint           has_clip : 1;
@@ -308,8 +309,8 @@ clutter_actor_paint (ClutterActor *self)
 
   if (clutter_actor_get_parent (self) != NULL)
     {
-      cogl_translate (CLUTTER_REAL_TO_FLOAT (priv->coords.x1), 
-                     CLUTTER_REAL_TO_FLOAT (priv->coords.y1), 
+      cogl_translate (CLUTTER_FIXED_TO_FLOAT (priv->coords.x1), 
+                     CLUTTER_FIXED_TO_FLOAT (priv->coords.y1), 
                      0);
     }
 
@@ -383,9 +384,19 @@ clutter_actor_paint (ClutterActor *self)
   cogl_pop_matrix();
 }
 
+/**
+ * clutter_actor_request_coords:
+ * @self: A #ClutterActor
+ * @box: A #ClutterActorBox with requested new co-ordinates.
+ *
+ * Requests new co-ordinates for the #ClutterActor ralative to any parent.
+ *
+ * This function should not be called directly by applications instead 
+ * the various position/geometry methods should be used.
+ **/
 void
-_clutter_actor_request_coords_real (ClutterActor        *self,
-                                   ClutterActorBoxReal *box)
+clutter_actor_request_coords (ClutterActor    *self,
+                             ClutterActorBox *box)
 {
   ClutterActorClass *klass;
   gboolean x_change, y_change, width_change, height_change;
@@ -395,12 +406,12 @@ _clutter_actor_request_coords_real (ClutterActor        *self,
   if (klass->request_coords)
     klass->request_coords (self, box);
   
-  x_change     = CLUTTER_REAL_NE (self->priv->coords.x1,  box->x1);
-  y_change     = CLUTTER_REAL_NE (self->priv->coords.y1,  box->y1);
-  width_change = CLUTTER_REAL_NE ((self->priv->coords.x2 - self->priv->coords.x1),
-                        (box->x2 - box->x1));
-  height_change = CLUTTER_REAL_NE ((self->priv->coords.y2 - self->priv->coords.y1),
-                         (box->y2 - box->y1));
+  x_change     = (self->priv->coords.x1 != box->x1);
+  y_change     = (self->priv->coords.y1 != box->y1);
+  width_change = ((self->priv->coords.x2 - self->priv->coords.x1) != 
+      (box->x2 - box->x1));
+  height_change = ((self->priv->coords.y2 - self->priv->coords.y1) !=
+                  (box->y2 - box->y1));
 
   if (x_change || y_change || width_change || height_change)
     {
@@ -433,41 +444,28 @@ _clutter_actor_request_coords_real (ClutterActor        *self,
 }
 
 /**
- * clutter_actor_request_coords:
+ * clutter_actor_allocate_coords:
  * @self: A #ClutterActor
- * @box: A #ClutterActorBox with requested new co-ordinates.
+ * @box: A location to store the actors #ClutterActorBox co-ordinates
  *
- * Requests new co-ordinates for the #ClutterActor ralative to any parent.
+ * Requests the allocated co-ordinates for the #ClutterActor relative 
+ * to any parent.
  *
  * This function should not be called directly by applications instead 
  * the various position/geometry methods should be used.
  **/
 void
-clutter_actor_request_coords (ClutterActor    *self,
-                             ClutterActorBox *box)
-{
-  ClutterActorBoxReal rbox;
-
-  rbox.x1 = CLUTTER_REAL_FROM_INT (box->x1);
-  rbox.y1 = CLUTTER_REAL_FROM_INT (box->y1);
-  rbox.x2 = CLUTTER_REAL_FROM_INT (box->x2);
-  rbox.y2 = CLUTTER_REAL_FROM_INT (box->y2);
-
-  _clutter_actor_request_coords_real (self, &rbox);
-}
-
-void
-_clutter_actor_allocate_coords_real (ClutterActor        *self,
-                                    ClutterActorBoxReal *rbox)
+clutter_actor_allocate_coords (ClutterActor    *self,
+                              ClutterActorBox *box)
 {
   ClutterActorClass *klass;
 
   klass = CLUTTER_ACTOR_GET_CLASS (self);
 
-  rbox->x1 = self->priv->coords.x1;
-  rbox->y1 = self->priv->coords.y1;
-  rbox->x2 = self->priv->coords.x2;
-  rbox->y2 = self->priv->coords.y2;
+  box->x1 = self->priv->coords.x1;
+  box->y1 = self->priv->coords.y1;
+  box->x2 = self->priv->coords.x2;
+  box->y2 = self->priv->coords.y2;
 
   if (klass->allocate_coords)
     {
@@ -476,40 +474,15 @@ _clutter_actor_allocate_coords_real (ClutterActor        *self,
        *        we then resync any changes. Needed for group class.
        *        Need to figure out nicer way.
       */
-      klass->allocate_coords(self, rbox);
+      klass->allocate_coords(self, box);
 
-      self->priv->coords.x1 = rbox->x1;
-      self->priv->coords.y1 = rbox->y1; 
-      self->priv->coords.x2 = rbox->x2; 
-      self->priv->coords.y2 = rbox->y2; 
+      self->priv->coords.x1 = box->x1;
+      self->priv->coords.y1 = box->y1; 
+      self->priv->coords.x2 = box->x2; 
+      self->priv->coords.y2 = box->y2; 
     }
 }
 
-/**
- * clutter_actor_allocate_coords:
- * @self: A #ClutterActor
- * @box: A location to store the actors #ClutterActorBox co-ordinates
- *
- * Requests the allocated co-ordinates for the #ClutterActor relative 
- * to any parent.
- *
- * This function should not be called directly by applications instead 
- * the various position/geometry methods should be used.
- **/
-void
-clutter_actor_allocate_coords (ClutterActor    *self,
-                              ClutterActorBox *box)
-{
-  ClutterActorBoxReal rbox;
-  
-  _clutter_actor_allocate_coords_real (self, &rbox);
-
-  box->x1 = CLUTTER_REAL_TO_INT (rbox.x1);
-  box->y1 = CLUTTER_REAL_TO_INT (rbox.y1);
-  box->x2 = CLUTTER_REAL_TO_INT (rbox.x2);
-  box->y2 = CLUTTER_REAL_TO_INT (rbox.y2);
-}
-
 static void 
 clutter_actor_set_property (GObject      *object, 
                              guint         prop_id,
@@ -926,10 +899,10 @@ clutter_actor_set_geometry (ClutterActor          *self,
 {
   ClutterActorBox box;
 
-  box.x1 = geometry->x;
-  box.y1 = geometry->y;
-  box.x2 = geometry->x + geometry->width;
-  box.y2 = geometry->y + geometry->height;
+  box.x1 = CLUTTER_UNITS_FROM_INT (geometry->x);
+  box.y1 = CLUTTER_UNITS_FROM_INT (geometry->y);
+  box.x2 = CLUTTER_UNITS_FROM_INT (geometry->x + geometry->width);
+  box.y2 = CLUTTER_UNITS_FROM_INT (geometry->y + geometry->height);
   
   clutter_actor_request_coords (self, &box);
 }
@@ -951,10 +924,10 @@ clutter_actor_get_geometry (ClutterActor    *self,
   
   clutter_actor_allocate_coords (self, &box);
 
-  geometry->x      = box.x1;
-  geometry->y      = box.y1;
-  geometry->width  = box.x2 - box.x1;
-  geometry->height = box.y2 - box.y1;
+  geometry->x      = CLUTTER_UNITS_TO_INT (box.x1);
+  geometry->y      = CLUTTER_UNITS_TO_INT (box.y1);
+  geometry->width  = CLUTTER_UNITS_TO_INT (box.x2 - box.x1);
+  geometry->height = CLUTTER_UNITS_TO_INT (box.y2 - box.y1);
 }
 
 /**
@@ -975,43 +948,23 @@ clutter_actor_get_coords (ClutterActor *self,
                          gint         *x2,
                          gint         *y2)
 {
-  ClutterActorBoxReal box;
+  ClutterActorBox box;
 
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
   
-  _clutter_actor_allocate_coords_real (self, &box);
+  clutter_actor_allocate_coords (self, &box);
 
   if (x1)
-    *x1 = CLUTTER_REAL_TO_INT (box.x1);
+    *x1 = CLUTTER_UNITS_TO_INT (box.x1);
   
   if (y1)
-    *y1 = CLUTTER_REAL_TO_INT (box.y1);
+    *y1 = CLUTTER_UNITS_TO_INT (box.y1);
   
   if (x2)
-    *x2 = CLUTTER_REAL_TO_INT (box.x2);
+    *x2 = CLUTTER_UNITS_TO_INT (box.x2);
   
   if (y2)
-    *y2 = CLUTTER_REAL_TO_INT (box.y2);
-}
-
-static void
-_clutter_actor_set_position_real (ClutterActor *self,
-                                 ClutterReal   x,
-                                 ClutterReal   y)
-{
-  ClutterActorBoxReal box;
-
-  g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
-  _clutter_actor_allocate_coords_real (self, &box);
-
-  box.x2 += (x - box.x1);
-  box.y2 += (y - box.y1);
-
-  box.x1 = x;
-  box.y1 = y;
-
-  _clutter_actor_request_coords_real (self, &box);
+    *y2 = CLUTTER_UNITS_TO_INT (box.y2);
 }
 
 /**
@@ -1028,10 +981,19 @@ clutter_actor_set_position (ClutterActor *self,
                            gint          x,
                            gint          y)
 {
-  ClutterReal xr = CLUTTER_REAL_FROM_INT (x);
-  ClutterReal yr = CLUTTER_REAL_FROM_INT (y);
-  
-  _clutter_actor_set_position_real (self, xr, yr);
+  ClutterActorBox box;
+
+  g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
+  clutter_actor_allocate_coords (self, &box);
+
+  box.x2 += (CLUTTER_UNITS_FROM_INT (x) - box.x1);
+  box.y2 += (CLUTTER_UNITS_FROM_INT (y) - box.y1);
+
+  box.x1 = CLUTTER_UNITS_FROM_INT (x);
+  box.y1 = CLUTTER_UNITS_FROM_INT (y);
+
+  clutter_actor_request_coords (self, &box);
 }
 
 /**
@@ -1050,20 +1012,20 @@ clutter_actor_move_by (ClutterActor *self,
                       gint          dx,
                       gint          dy)
 {
-  ClutterActorBoxReal box;
-  ClutterReal dxr = CLUTTER_REAL_FROM_INT (dx);
-  ClutterReal dyr = CLUTTER_REAL_FROM_INT (dy);
+  ClutterActorBox box;
+  gint32 dxu = CLUTTER_UNITS_FROM_INT (dx);
+  gint32 dyu = CLUTTER_UNITS_FROM_INT (dy);
   
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
 
-  _clutter_actor_allocate_coords_real (self, &box);
+  clutter_actor_allocate_coords (self, &box);
 
-  box.x2 += dxr;
-  box.y2 += dyr;
-  box.x1 += dxr;
-  box.y1 += dyr;
+  box.x2 += dxu;
+  box.y2 += dyu;
+  box.x1 += dxu;
+  box.y1 += dyu;
 
-  _clutter_actor_request_coords_real (self, &box);
+  clutter_actor_request_coords (self, &box);
 }
 
 /**
@@ -1080,16 +1042,16 @@ clutter_actor_set_size (ClutterActor *self,
                        gint          width,
                        gint          height)
 {
-  ClutterActorBoxReal box;
+  ClutterActorBox box;
 
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
 
-  _clutter_actor_allocate_coords_real (self, &box);
+  clutter_actor_allocate_coords (self, &box);
 
-  box.x2 = CLUTTER_REAL_ADD_INT (box.x1, width);
-  box.y2 = CLUTTER_REAL_ADD_INT (box.y1, height);
+  box.x2 = box.x1 + CLUTTER_UNITS_FROM_INT (width);
+  box.y2 = box.y1 + CLUTTER_UNITS_FROM_INT (height);
 
-  _clutter_actor_request_coords_real (self, &box);
+  clutter_actor_request_coords (self, &box);
 }
 
 /**
@@ -1116,18 +1078,50 @@ clutter_actor_get_size (ClutterActor *self,
     *height = clutter_actor_get_height (self);
 }
 
+/**
+ * clutter_actor_get_abs_position
+ * @self: A #ClutterActor
+ * @x: Location to store x position if non NULL.
+ * @y: Location to store y position if non NULL.
+ *
+ * Gets the absolute position of an actor in pixels relative
+ * to the stage.
+ */
+void
+clutter_actor_get_abs_position (ClutterActor *self,
+                               gint           *x,
+                               gint           *y)
+{
+  gint32 xu, yu;
+  clutter_actor_get_abs_position_units (self, &xu, &yu);
+
+  *x = CLUTTER_UNITS_TO_INT (xu);
+  *y = CLUTTER_UNITS_TO_INT (yu);
+}
+
+/**
+ * clutter_actor_get_abs_position_units
+ * @self: A #ClutterActor
+ * @x: Location to store x position if non NULL.
+ * @y: Location to store y position if non NULL.
+ *
+ * Gets the absolute position of an actor in clutter units relative
+ * to the stage.
+ *
+ * Since: 0.4
+ */
 void
-_clutter_actor_get_abs_position_real (ClutterActor *self,
-                                     ClutterReal  *x,
-                                     ClutterReal  *y)
+clutter_actor_get_abs_position_units (ClutterActor *self,
+                                     gint32       *x,
+                                     gint32       *y)
 {
-  ClutterActorBoxReal   box;
-  ClutterActor         *parent;
-  ClutterReal           px = 0, py = 0;
+  ClutterActorBox   box;
+  ClutterActor     *parent;
+  gint32            px = 0, py = 0;
   
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
 
-  _clutter_actor_allocate_coords_real (self, &box);
+  clutter_actor_allocate_coords (self, &box);
 
   parent = self->priv->parent_actor;
 
@@ -1135,24 +1129,20 @@ _clutter_actor_get_abs_position_real (ClutterActor *self,
   if (parent)
     {
       ClutterFixed parent_scale_x, parent_scale_y;
-      ClutterReal sx, sy;
 
       clutter_actor_get_scalex (parent,
                                 &parent_scale_x,
                                 &parent_scale_y);
 
-      sx = CLUTTER_REAL_FROM_FIXED (parent_scale_x);
-      sy = CLUTTER_REAL_FROM_FIXED (parent_scale_y);
-      
       if (parent_scale_x != CFX_ONE ||
           parent_scale_y != CFX_ONE)
        {
-         box.x1 = CLUTTER_REAL_MUL (box.x1, sx); 
-         box.y1 = CLUTTER_REAL_MUL (box.y1, sy); 
+         box.x1 = CFX_MUL (box.x1, parent_scale_x); 
+         box.y1 = CFX_MUL (box.y1, parent_scale_y); 
        }
 
       if (!CLUTTER_IS_STAGE (parent))
-       _clutter_actor_get_abs_position_real (parent, &px, &py);
+       clutter_actor_get_abs_position_units (parent, &px, &py);
     }
 
   if (x)
@@ -1163,42 +1153,41 @@ _clutter_actor_get_abs_position_real (ClutterActor *self,
 }
 
 /**
- * clutter_actor_get_abs_position
+ * clutter_actor_get_abs_size:
  * @self: A #ClutterActor
- * @x: Location to store x position if non NULL.
- * @y: Location to store y position if non NULL.
+ * @width: Location to store width if non NULL.
+ * @height: Location to store height if non NULL.
  *
- * Gets the absolute position of an actor in pixels relative
- * to the stage.
+ * Gets the absolute size of an actor taking into account
+ * an scaling factors
  */
 void
-clutter_actor_get_abs_position (ClutterActor *self,
-                               gint           *x,
-                               gint           *y)
+clutter_actor_get_abs_size (ClutterActor *self,
+                           guint        *width,
+                           guint        *height)
 {
-    ClutterReal xr, yr;
-    _clutter_actor_get_abs_position_real (self, &xr, &yr);
-
-    if (x)
-       *x = CLUTTER_REAL_TO_INT (xr);
-
-    if (y)
-       *y = CLUTTER_REAL_TO_INT (yr);
+  gint32 wu, hu;
+  clutter_actor_get_abs_size_units (self, &wu, &hu);
+  
+  *width  = CLUTTER_UNITS_TO_INT (wu);
+  *height = CLUTTER_UNITS_TO_INT (hu);
 }
 
 /**
- * clutter_actor_get_abs_size:
+ * clutter_actor_get_abs_size_units:
  * @self: A #ClutterActor
  * @width: Location to store width if non NULL.
  * @height: Location to store height if non NULL.
  *
- * Gets the absolute size of an actor taking into account
- * an scaling factors
+ * Gets the absolute size of an actor in clutter units taking into account
+ * an scaling factors.
+ *
+ * Since: 0.4
  */
 void
-clutter_actor_get_abs_size (ClutterActor *self,
-                           guint        *width,
-                           guint        *height)
+clutter_actor_get_abs_size_units (ClutterActor *self,
+                                 gint32       *width,
+                                 gint32       *height)
 {
   ClutterActorBox  box;
   ClutterActor    *parent;
@@ -1222,56 +1211,16 @@ clutter_actor_get_abs_size (ClutterActor *self,
 
          if (width)
            {
-             fx = CLUTTER_FIXED_MUL (CLUTTER_INT_TO_FIXED (*width),
-                                    parent->priv->scale_x); 
-             *width = CLUTTER_FIXED_INT (fx);
+             fx = CLUTTER_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (*width),
+                                     parent->priv->scale_x); 
+             *width = CLUTTER_UNITS_FROM_FIXED (fx);
            }
 
          if (height)
            {
-             fy = CLUTTER_FIXED_MUL (CLUTTER_INT_TO_FIXED (*height),
-                                    parent->priv->scale_x); 
-             *height = CLUTTER_FIXED_INT (fy);
-           }
-       }
-    }
-  while ((parent = clutter_actor_get_parent (parent)) != NULL);
-}
-
-static void
-_clutter_actor_get_abs_size_real (ClutterActor *self,
-                                 ClutterReal  *width,
-                                 ClutterReal  *height)
-{
-  ClutterActorBoxReal  box;
-  ClutterActor        *parent;
-
-  _clutter_actor_allocate_coords_real (self, &box);
-
-  if (width)
-    *width  = box.x2 - box.x1;
-
-  if (height)
-    *height = box.y2 - box.y1;
-
-  parent = self;
-
-  do
-    {
-      if (parent->priv->scale_x != CFX_ONE ||
-          parent->priv->scale_y != CFX_ONE)
-       {
-         
-         if (width)
-           {
-             ClutterReal scale = CLUTTER_REAL_FROM_FIXED (parent->priv->scale_x);
-             *width = CLUTTER_REAL_MUL (*width, scale); 
-           }
-
-         if (height)
-           {
-             ClutterReal scale = CLUTTER_REAL_FROM_FIXED (parent->priv->scale_y);
-             *height = CLUTTER_REAL_MUL (*height, scale); 
+             fy = CLUTTER_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (*height),
+                                     parent->priv->scale_x); 
+             *height = CLUTTER_UNITS_FROM_FIXED (fy);
            }
        }
     }
@@ -1296,7 +1245,7 @@ clutter_actor_get_width (ClutterActor *self)
   
   clutter_actor_allocate_coords (self, &box);
 
-  return box.x2 - box.x1;
+  return CLUTTER_UNITS_TO_INT (box.x2 - box.x1);
 }
 
 /**
@@ -1316,7 +1265,7 @@ clutter_actor_get_height (ClutterActor *self)
   
   clutter_actor_allocate_coords (self, &box);
 
-  return box.y2 - box.y1;
+  return CLUTTER_UNITS_TO_INT (box.y2 - box.y1);
 }
 
 /**
@@ -1371,19 +1320,7 @@ clutter_actor_get_x (ClutterActor *self)
 
   clutter_actor_allocate_coords (self, &box);
 
-  return box.x1;
-}
-
-static ClutterReal
-_clutter_actor_get_x_real (ClutterActor *self)
-{
-  ClutterActorBoxReal box;
-  
-  g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
-  _clutter_actor_allocate_coords_real (self, &box);
-
-  return box.x1;
+  return CLUTTER_UNITS_TO_INT (box.x1);
 }
 
 /**
@@ -1403,19 +1340,7 @@ clutter_actor_get_y (ClutterActor *self)
 
   clutter_actor_allocate_coords (self, &box);
 
-  return box.y1;
-}
-
-static ClutterReal
-_clutter_actor_get_y_real (ClutterActor *self)
-{
-  ClutterActorBoxReal box;
-
-  g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
-  _clutter_actor_allocate_coords_real (self, &box);
-
-  return box.y1;
+  return CLUTTER_UNITS_TO_INT (box.y1);
 }
 
 /**
@@ -1524,21 +1449,23 @@ clutter_actor_scalex (ClutterActor     *self,
                      ClutterFixed      scale_y,
                      ClutterGravity    gravity)
 {
-  ClutterReal sw, sh, w, h;
-  ClutterReal x, y;
+  ClutterActorBox box;
+  gint32 sw, sh, w, h;
+  gint32 x, y;
 
-  _clutter_actor_get_abs_size_real (self, &w, &h);
+  clutter_actor_get_abs_size_units (self, &w, &h);
   clutter_actor_set_scalex (self, scale_x, scale_y);
 
   if (gravity == CLUTTER_GRAVITY_NONE ||
       gravity == CLUTTER_GRAVITY_NORTH_WEST)
     return;
 
-  _clutter_actor_get_abs_size_real (self, &sw, &sh);
-
-  x = _clutter_actor_get_x_real (self);
-  y = _clutter_actor_get_y_real (self);
+  clutter_actor_get_abs_size_units (self, &sw, &sh);
 
+  clutter_actor_allocate_coords (self, &box);
+  x = box.x1;
+  y = box.y1;
+  
   switch (gravity)
     {
     case CLUTTER_GRAVITY_NORTH:
@@ -1572,7 +1499,12 @@ clutter_actor_scalex (ClutterActor     *self,
       break;
     }
 
-  _clutter_actor_set_position_real (self, x, y);
+  box.x2 += (x - box.x1);
+  box.y2 += (y - box.y1);
+  box.x1 = x;
+  box.y1 = y;
+
+  clutter_actor_request_coords (self, &box);
 }
 
 /**
@@ -1584,7 +1516,7 @@ clutter_actor_scalex (ClutterActor     *self,
  */
 void
 clutter_actor_set_opacity (ClutterActor *self,
-                            guint8          opacity)
+                          guint8        opacity)
 {
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
   
@@ -2185,28 +2117,3 @@ clutter_actor_box_get_type (void)
   return our_type;
 }
 
-/*
- * ClutterActorBoxReal
- */
-static ClutterActorBoxReal *
-clutter_actor_box_real_copy (const ClutterActorBoxReal *box)
-{
-  ClutterActorBoxReal *result = g_new (ClutterActorBoxReal, 1);
-
-  *result = *box;
-
-  return result;
-}
-
-GType
-clutter_actor_box_real_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (our_type == 0)
-    our_type = g_boxed_type_register_static (
-              g_intern_static_string ("ClutterActorBoxReal"),
-             (GBoxedCopyFunc) clutter_actor_box_real_copy,
-             (GBoxedFreeFunc) g_free);
-  return our_type;
-}
index d04d1e6..6379ced 100644 (file)
@@ -29,8 +29,7 @@
 /* clutter-actor.h */
 
 #include <glib-object.h>
-
-#include "clutter-real.h"
+#include <clutter/clutter-fixed.h>
 
 G_BEGIN_DECLS
 
@@ -74,7 +73,6 @@ typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
 typedef struct _ClutterActor         ClutterActor;
 typedef struct _ClutterActorClass    ClutterActorClass;
 typedef struct _ClutterActorBox      ClutterActorBox;
-typedef struct _ClutterActorBoxReal  ClutterActorBoxReal;
 typedef struct _ClutterActorPrivate  ClutterActorPrivate;
 typedef struct _ClutterGeometry      ClutterGeometry;
 
@@ -86,11 +84,13 @@ struct _ClutterGeometry
   /* FIXME: 
    * It is likely gonna save a load of pain if we make 
    * x,y unsigned...
-  */
-  gint x;
-  gint y;
-  guint width;
-  guint height;
+   *
+   * No, no, no, usigned is evil; we should make width and height signed.
+   */
+  gint   x;
+  gint   y;
+  guint  width;
+  guint  height;
 };
 
 GType clutter_geometry_get_type (void) G_GNUC_CONST;
@@ -101,8 +101,7 @@ typedef enum
   CLUTTER_ACTOR_REALIZED = 1 << 2
 } ClutterActorFlags;
 
-struct _ClutterActorBox { gint x1, y1, x2, y2; };
-struct _ClutterActorBoxReal { ClutterReal x1, y1, x2, y2; };
+struct _ClutterActorBox { gint32 x1, y1, x2, y2; };
 
 GType clutter_actor_box_get_type (void) G_GNUC_CONST;
 
@@ -130,9 +129,9 @@ struct _ClutterActorClass
   void (* unrealize)       (ClutterActor        *actor);
   void (* paint)           (ClutterActor        *actor);
   void (* request_coords)  (ClutterActor        *actor,
-                           ClutterActorBoxReal *box);
+                           ClutterActorBox     *box);
   void (* allocate_coords) (ClutterActor        *actor,
-                           ClutterActorBoxReal *box);
+                           ClutterActorBox     *box);
   void (* set_depth)       (ClutterActor        *actor,
                            gint                 depth);
   gint (* get_depth)       (ClutterActor        *actor);
@@ -185,6 +184,9 @@ void                  clutter_actor_set_position     (ClutterActor          *sel
 void                  clutter_actor_get_abs_position (ClutterActor          *self,
                                                      gint                  *x,
                                                      gint                  *y);
+void                  clutter_actor_get_abs_position_units (ClutterActor    *self,
+                                                           gint32          *x,
+                                                           gint32          *y);
 guint                 clutter_actor_get_width        (ClutterActor          *self);
 guint                 clutter_actor_get_height       (ClutterActor          *self);
 
@@ -259,6 +261,9 @@ void                  clutter_actor_scalex           (ClutterActor          *sel
 void                  clutter_actor_get_abs_size     (ClutterActor          *self,
                                                       guint                 *width,
                                                       guint                 *height);
+void                  clutter_actor_get_abs_size_units (ClutterActor        *self,
+                                                       gint32              *width,
+                                                       gint32              *height);
 void                  clutter_actor_get_size         (ClutterActor          *self,
                                                       guint                 *width,
                                                       guint                 *height);
@@ -266,13 +271,6 @@ void                  clutter_actor_move_by          (ClutterActor          *sel
                                                       gint                   dx,
                                                       gint                   dy);
 
-/*<private*/
-void                  _clutter_actor_request_coords_real (ClutterActor        *self,
-                                                         ClutterActorBoxReal *rbox);
-
-void                  _clutter_actor_allocate_coords_real (ClutterActor        *self,
-                                                          ClutterActorBoxReal *rbox);
-
 G_END_DECLS
 
 #endif /* _HAVE_CLUTTER_ACTOR_H */
index 5a985bb..0da7d1c 100644 (file)
@@ -97,11 +97,11 @@ clutter_group_paint (ClutterActor *actor)
 
 static void
 clutter_group_request_coords (ClutterActor        *self,
-                             ClutterActorBoxReal *box)
+                             ClutterActorBox     *box)
 {
-  ClutterActorBoxReal cbox;
+  ClutterActorBox cbox;
 
-  _clutter_actor_allocate_coords_real (self, &cbox);
+  clutter_actor_allocate_coords (self, &cbox);
 
   /* Only positioning works.
    * Sizing requests fail, use scale() instead 
@@ -112,7 +112,7 @@ clutter_group_request_coords (ClutterActor        *self,
 
 static void
 clutter_group_allocate_coords (ClutterActor        *self,
-                              ClutterActorBoxReal *box)
+                              ClutterActorBox     *box)
 {
   ClutterGroupPrivate *priv;
   GList               *child_item;
@@ -132,21 +132,19 @@ clutter_group_allocate_coords (ClutterActor        *self,
          /* Once added we include in sizing - doesn't matter if visible */
          /* if (CLUTTER_ACTOR_IS_VISIBLE (child)) */
            {
-             ClutterActorBoxReal cbox;
+             ClutterActorBox cbox;
 
-             _clutter_actor_allocate_coords_real (child, &cbox);
+             clutter_actor_allocate_coords (child, &cbox);
              
              /* Ignore any children with offscreen ( negaive )
                * positions.
               *
                * Also x1 and x2 will be set by parent caller.
              */
-             if (CLUTTER_REAL_EZ (box->x2) ||
-                 CLUTTER_REAL_GT (cbox.x2, box->x2))
+             if (box->x2 == 0 || cbox.x2 > box->x2)
                box->x2 = cbox.x2;
 
-             if (CLUTTER_REAL_EZ (box->y2) ||
-                 CLUTTER_REAL_GT (cbox.y2, box->y2))
+             if (box->y2 == 0 || cbox.y2 > box->y2)
                box->y2 = cbox.y2;
            }
        }
index 6594a63..4455b2b 100644 (file)
@@ -37,6 +37,7 @@
 #include "clutter-enum-types.h"
 #include "clutter-private.h"
 #include "clutter-debug.h"
+#include "clutter-units.h"
 
 #include "pangoclutter.h"
 
@@ -264,7 +265,7 @@ clutter_label_paint (ClutterActor *self)
 
 static void
 clutter_label_allocate_coords (ClutterActor        *self,
-                              ClutterActorBoxReal *box)
+                              ClutterActorBox     *box)
 {
   ClutterLabel         *label = CLUTTER_LABEL(self);
   ClutterLabelPrivate  *priv;  
@@ -272,19 +273,19 @@ clutter_label_allocate_coords (ClutterActor        *self,
 
   priv = label->priv;
 
-  clutter_label_ensure_layout (label, CLUTTER_REAL_TO_INT (box->x2 - box->x1));
+  clutter_label_ensure_layout (label, CLUTTER_UNITS_TO_INT (box->x2 - box->x1));
 
   pango_layout_get_extents (priv->layout, NULL, &logical_rect);
 
-  box->x2 = box->x1 + PANGO_PIXELS (logical_rect.width);
-  box->y2 = box->y1 + PANGO_PIXELS (logical_rect.height);
+  box->x2 = box->x1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.width);
+  box->y2 = box->y1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.height);
 
   return;
 }
 
 static void
 clutter_label_request_coords (ClutterActor        *self,
-                             ClutterActorBoxReal *box)
+                             ClutterActorBox     *box)
 {
   /* do we need to do anything ? */
   clutter_label_clear_layout (CLUTTER_LABEL(self));
diff --git a/clutter/clutter-real.h b/clutter/clutter-real.h
deleted file mode 100644 (file)
index 8168469..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Tomas Frydrych  <tf@openedhand.com>
- *
- * Copyright (C) 2007 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:clutter-real
- * @short_description: An abstract numeric type encapsulating either float
- * or fixed point number, depending whether clutter was configured using
- * FPU or not.
- *
- * Since: 0.4
- */
-
-#ifndef _HAVE_CLUTTER_REAL_H
-#define _HAVE_CLUTTER_REAL_H
-
-#include "clutter-fixed.h"
-
-#if 1
-#if CLUTTER_NO_FPU
-
-#define CLUTTER_REAL_IS_FIXED() 1
-#define CLUTTER_REAL_IS_FLOAT() 0
-
-typedef ClutterFixed ClutterReal;
-
-#define CLUTTER_REAL_MUL(x,y) CFX_MUL((x),(y))
-#define CLUTTER_REAL_DIV(x,y) CFX_DIV((x),(y))
-#define CLUTTER_REAL_ADD_INT(x,i) ((x) + CLUTTER_INT_TO_FIXED(i))
-#define CLUTTER_REAL_SUB_INT(x,i) ((x) - CLUTTER_INT_TO_FIXED(i))
-
-#define CLUTTER_REAL_TO_INT(x) CFX_INT((x) + (CFX_ONE >> 1))
-#define CLUTTER_REAL_FROM_INT(i) CLUTTER_INT_TO_FIXED(i)
-
-#define CLUTTER_REAL_TO_FLOAT(x) CLUTTER_FIXED_TO_FLOAT(x)
-#define CLUTTER_REAL_FROM_FLOAT(f) CLUTTER_FLOAT_TO_FIXED(f)
-
-#define CLUTTER_REAL_TO_FIXED(x) (x)
-#define CLUTTER_REAL_FROM_FIXED(x) (x)
-
-#define CLUTTER_REAL_ZERO 0
-
-#else
-
-#define CLUTTER_REAL_IS_FIXED() 0
-#define CLUTTER_REAL_IS_FLOAT() 1
-
-typedef float ClutterReal;
-
-#define CLUTTER_REAL_MUL(x,y) ((x)*(y))
-#define CLUTTER_REAL_DIV(x,y) ((x)/(y))
-#define CLUTTER_REAL_ADD_INT(x,i) (x+i)
-#define CLUTTER_REAL_SUB_INT(x,i) (x-i)
-
-#define CLUTTER_REAL_TO_INT(x) CLUTTER_FLOAT_TO_INT(x+0.5)
-#define CLUTTER_REAL_FROM_INT(i) ((float)i)
-
-#define CLUTTER_REAL_TO_FLOAT(x) (x)
-#define CLUTTER_REAL_FROM_FLOAT(f) (f)
-
-#define CLUTTER_REAL_TO_FIXED(x) CLLUTER_FLOAT_TO_FIXED(x)
-#define CLUTTER_REAL_FROM_FIXED(x) CLUTTER_FIXED_TO_FLOAT(x)
-
-#define CLUTTER_REAL_ZERO 0.0
-
-#endif
-
-#else
-/*
- * This is an int defintion for reference / debugging purposes only
- *
- * FIXME : remove this when no longer needed.
- */
-typedef gint ClutterReal;
-
-#define CLUTTER_REAL_MUL(x,y) ((x)*(y))
-#define CLUTTER_REAL_DIV(x,y) ((x)/(y))
-#define CLUTTER_REAL_ADD_INT(x,i) (x + i)
-#define CLUTTER_REAL_SUB_INT(x,i) (x - i)
-
-#define CLUTTER_REAL_TO_INT(x) (x)
-#define CLUTTER_REAL_FROM_INT(i) (i)
-
-#define CLUTTER_REAL_TO_FLOAT(x) ((float)(x))
-#define CLUTTER_REAL_FROM_FLOAT(f) ((gint)(f))
-
-#define CLUTTER_REAL_TO_FIXED(x) CLUTTER_INT_TO_FIXED(x)
-#define CLUTTER_REAL_FROM_FIXED(x) CFX_INT(x)
-
-#define CLUTTER_REAL_ZERO 0
-
-#endif
-
-#define CLUTTER_REAL_EZ(x) (CLUTTER_REAL_TO_INT(x) == 0)
-#define CLUTTER_REAL_NZ(x) (CLUTTER_REAL_TO_INT(x) != 0)
-#define CLUTTER_REAL_EQ(x,y) (CLUTTER_REAL_TO_INT(x) == CLUTTER_REAL_TO_INT(y))
-#define CLUTTER_REAL_NE(x,y) (CLUTTER_REAL_TO_INT(x) != CLUTTER_REAL_TO_INT(y))
-#define CLUTTER_REAL_LT(x,y) (CLUTTER_REAL_TO_INT(x) < CLUTTER_REAL_TO_INT(y))
-#define CLUTTER_REAL_GT(x,y) (CLUTTER_REAL_TO_INT(x) > CLUTTER_REAL_TO_INT(y))
-#define CLUTTER_REAL_LE(x,y) (CLUTTER_REAL_TO_INT(x) <= CLUTTER_REAL_TO_INT(y))
-#define CLUTTER_REAL_GE(x,y) (CLUTTER_REAL_TO_INT(x) >= CLUTTER_REAL_TO_INT(y))
-
-#endif /* ifndef _HAVE_CLUTTER_REAL_H */
diff --git a/clutter/clutter-units.h b/clutter/clutter-units.h
new file mode 100644 (file)
index 0000000..799271e
--- /dev/null
@@ -0,0 +1,74 @@
+/* -*- mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Authored By Tomas Frydrych  <tf@openedhand.com>
+ *
+ * Copyright (C) 2007 OpenedHand
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:clutter-units
+ * @short_description: A logical distance unit.
+ *
+ * Clutter units are logical units with granularity greater than that of the
+ * device units; they are used by #ClutterActorBox and the _units() family of
+ * ClutterActor functions. To convert between clutter units and device units,
+ * use #CLUTTER_UNITS_FROM_DEVICE and #CLUTTER_UNITS_TO_DEVICE macros.
+ *
+ * Note: It is expected that as of version 0.6 all dimensions in the public
+ * Clutter API will be given in clutter units. In order to ease the transition,
+ * two extra macros have been provided, #CLUTTER_UNITS_TMP_TO_DEVICE and
+ * #CLUTTER_UNITS_TMP_FROM_DEVICE. In version 0.4 these are identity macros,
+ * but when the API transition happens will map to #CLUTTER_UNITS_TO_DEVICE and
+ * #CLUTTER_UNITS_FROM_DEVICE respectively. You can use these in newly written
+ * code as place holders.
+ * 
+ * Since: 0.4
+ */
+
+#ifndef _HAVE_CLUTTER_UNITS_H
+#define _HAVE_CLUTTER_UNITS_H
+
+#include <clutter/clutter-fixed.h>
+
+/*
+ * Currently CLUTTER_UNIT maps directly onto ClutterFixed. Nevertheless, the
+ * _FROM_FIXED and _TO_FIXED macros should always be used in case that we
+ * decide to change this relationship in the future.
+ */
+#define CLUTTER_UNITS_FROM_DEVICE(x)     CLUTTER_UNITS_FROM_INT (x)
+#define CLUTTER_UNITS_TO_DEVICE(x)       CLUTTER_UNITS_TO_INT (x)
+
+#define CLUTTER_UNITS_TMP_FROM_DEVICE(x) (x)
+#define CLUTTER_UNITS_TMP_TO_DEVICE(x)   (x)
+
+#define CLUTTER_UNITS_FROM_INT(x)        CLUTTER_INT_TO_FIXED (x)
+#define CLUTTER_UNITS_TO_INT(x)          CFX_INT (x)
+
+#define CLUTTER_UNITS_FROM_FLOAT(x)      CLUTTER_FLOAT_TO_FIXED (x)
+#define CLUTTER_UNITS_TO_FLOAT(x)        CLUTTER_FIXED_TO_FLOAT (x)
+
+#define CLUTTER_UNITS_FROM_FIXED(x)      (x)
+#define CLUTTER_UNITS_TO_FIXED(x)        (x)
+
+#define CLUTTER_UNITS_FROM_PANGO_UNIT(x) (x << 6)
+
+#endif /* _HAVE_CLUTTER_UNITS_H */
index c57b44e..3b0e956 100644 (file)
@@ -52,5 +52,6 @@
 #include "clutter-feature.h"
 #include "clutter-version.h"
 #include "clutter-enum-types.h"
+#include "clutter-units.h"
 
 #endif
index 1419b46..809c71b 100644 (file)
@@ -11,6 +11,7 @@
 #include "../clutter-enum-types.h"
 #include "../clutter-private.h"
 #include "../clutter-debug.h"
+#include "../clutter-units.h"
 
 #ifdef HAVE_XFIXES
 #include <X11/extensions/Xfixes.h>
@@ -239,25 +240,25 @@ clutter_stage_egl_paint (ClutterActor *self)
 
 static void
 clutter_stage_egl_allocate_coords (ClutterActor        *self,
-                                   ClutterActorBoxReal *box)
+                                   ClutterActorBox     *box)
 {
   ClutterStageEgl *stage_egl = CLUTTER_STAGE_EGL (self);
 
   box->x1 = box->y1 = 0;
-  box->x2 = CLUTTER_REAL_ADD_INT (box->x1, stage_egl->xwin_width);
-  box->y2 = CLUTTER_REAL_ADD_INT (box->y1, stage_egl->xwin_height);
+  box->x2 = box->x1 + CLUTTER_UNITS_FROM_INT (stage_egl->xwin_width);
+  box->y2 = box->y1 + CLUTTER_UNITS_FROM_INT (stage_egl->xwin_height);
 }
 
 static void
 clutter_stage_egl_request_coords (ClutterActor        *self,
-                                 ClutterActorBoxReal *box)
+                                 ClutterActorBox     *box)
 {
   ClutterStageEgl *stage_egl = CLUTTER_STAGE_EGL (self);
   gint new_width, new_height;
 
   /* FIXME: some how have X configure_notfiys call this ? */
-  new_width  = ABS (CLUTTER_REAL_TO_INT (box->x2 - box->x1));
-  new_height = ABS (CLUTTER_REAL_TO_INT (box->y2 - box->y1)); 
+  new_width  = ABS (CLUTTER_UNITS_TO_INT (box->x2 - box->x1));
+  new_height = ABS (CLUTTER_UNITS_TO_INT (box->y2 - box->y1)); 
 
   if (new_width != stage_egl->xwin_width ||
       new_height != stage_egl->xwin_height)
@@ -277,8 +278,8 @@ clutter_stage_egl_request_coords (ClutterActor        *self,
   if (stage_egl->xwin != None) /* Do we want to bother ? */
     XMoveWindow (stage_egl->xdpy,
                 stage_egl->xwin,
-                CLUTTER_REAL_TO_INT (box->x1),
-                CLUTTER_REAL_TO_INT (box->y1));
+                CLUTTER_UNITS_TO_INT (box->x1),
+                CLUTTER_UNITS_TO_INT (box->y1));
 }
 
 static void
index 8168837..a4a9ef9 100644 (file)
@@ -35,6 +35,7 @@
 #include "../clutter-enum-types.h"
 #include "../clutter-private.h"
 #include "../clutter-debug.h"
+#include "../clutter-units.h"
 
 #include "cogl.h"
 
@@ -370,24 +371,24 @@ clutter_stage_glx_paint (ClutterActor *self)
 
 static void
 clutter_stage_glx_allocate_coords (ClutterActor        *self,
-                                   ClutterActorBoxReal *box)
+                                   ClutterActorBox     *box)
 {
   ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (self);
 
   box->x1 = box->y1 = 0;
-  box->x2 = CLUTTER_REAL_ADD_INT (box->x1, stage_glx->xwin_width);
-  box->y2 = CLUTTER_REAL_ADD_INT (box->y1, stage_glx->xwin_height);
+  box->x2 = box->x1 + CLUTTER_UNITS_FROM_INT (stage_glx->xwin_width);
+  box->y2 = box->y1 + CLUTTER_UNITS_FROM_INT (stage_glx->xwin_height);
 }
 
 static void
 clutter_stage_glx_request_coords (ClutterActor        *self,
-                                 ClutterActorBoxReal *box)
+                                 ClutterActorBox     *box)
 {
   ClutterStageGlx *stage_glx = CLUTTER_STAGE_GLX (self);
   gint new_width, new_height;
 
-  new_width  = ABS (CLUTTER_REAL_TO_INT (box->x2 - box->x1));
-  new_height = ABS (CLUTTER_REAL_TO_INT (box->y2 - box->y1)); 
+  new_width  = ABS (CLUTTER_UNITS_TO_INT (box->x2 - box->x1));
+  new_height = ABS (CLUTTER_UNITS_TO_INT (box->y2 - box->y1)); 
 
   if (new_width != stage_glx->xwin_width ||
       new_height != stage_glx->xwin_height)
@@ -414,8 +415,8 @@ clutter_stage_glx_request_coords (ClutterActor        *self,
   if (stage_glx->xwin != None) /* Do we want to bother ? */
     XMoveWindow (stage_glx->xdpy,
                 stage_glx->xwin,
-                CLUTTER_REAL_TO_INT (box->x1),
-                CLUTTER_REAL_TO_INT (box->y1));
+                CLUTTER_UNITS_TO_INT (box->x1),
+                CLUTTER_UNITS_TO_INT (box->y1));
 }
 
 static void
index cfa7900..b8eeee6 100644 (file)
@@ -11,6 +11,7 @@
 #include "../clutter-enum-types.h"
 #include "../clutter-private.h"
 #include "../clutter-debug.h"
+#include "../clutter-units.h"
 
 #include "cogl.h"
 
@@ -130,8 +131,8 @@ clutter_stage_sdl_allocate_coords (ClutterActor    *self,
   ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self);
 
   box->x1 = box->y1 = 0;
-  box->x2 = box->x1 + stage_sdl->win_width;
-  box->y2 = box->y1 + stage_sdl->win_height;
+  box->x2 = box->x1 + CLUTTER_UNITS_FROM_INT (stage_sdl->win_width);
+  box->y2 = box->y1 + CLUTTER_UNITS_FROM_INT (stage_sdl->win_height);
 }
 
 static void
@@ -142,8 +143,8 @@ clutter_stage_sdl_request_coords (ClutterActor    *self,
   gint new_width, new_height;
 
   /* FIXME: some how have X configure_notfiys call this ? */
-  new_width  = ABS (box->x2 - box->x1);
-  new_height = ABS (box->y2 - box->y1); 
+  new_width  = ABS (CLUTTER_UNITS_TO_INT (box->x2 - box->x1));
+  new_height = ABS (CLUTTER_UNITS_TO_INT (box->y2 - box->y1));
 
   if (new_width != stage_sdl->win_width ||
       new_height != stage_sdl->win_height)
index ad7dfa3..786c4b3 100644 (file)
@@ -93,8 +93,6 @@ if $PKG_CONFIG --exists xfixes ; then
 fi
 
 CLUTTER_NO_FPU="0"
-CLUTTER_REAL=""
-
 AC_ARG_WITH(fpu,
             AS_HELP_STRING([--without-fpu],
                            [Assume target hardware has no fpu]),
@@ -103,11 +101,9 @@ AC_ARG_WITH(fpu,
 
 if test "x$with_fpu" != "xyes" ; then
    CLUTTER_NO_FPU="1"
-   CLUTTER_REAL="-fx"
 fi
 
 AC_SUBST(CLUTTER_NO_FPU)
-AC_SUBST(CLUTTER_REAL)
 
 clutterbackend=glx
 AC_ARG_WITH([flavour],
index 83b0969..54e7eda 100644 (file)
@@ -1,3 +1,15 @@
+2007-05-22  Tomas Frydrych  <tf@openedhand.com>
+
+       * clutter-sections.txt:
+       * clutter-docs.sgml: 
+       * tmpl/clutter-units.sgml:
+       Added clutter-units.
+
+       * tmpl/clutter-alpha.sgml:
+       * tmpl/clutter-actor.sgml:
+       * tmpl/clutter-media.sgml:
+       Updated templates.
+       
 2007-05-17  Emmanuele Bassi  <ebassi@openedhand.com>
 
        * Makefile.am: Ignore the sdl backend.
index ae2c773..7890cf0 100644 (file)
@@ -94,6 +94,7 @@
     <xi:include href="xml/clutter-util.xml"/>
     <xi:include href="xml/clutter-fixed.xml"/>
     <xi:include href="xml/clutter-version.xml"/>
+    <xi:include href="xml/clutter-units.xml"/>
   </chapter>
   <chapter>
     <title>Clutter Backends</title>
index f79eda1..ce46c52 100644 (file)
@@ -25,6 +25,22 @@ clutter_media_get_type
 </SECTION>
 
 <SECTION>
+<FILE>clutter-units</FILE>
+<TITLE>clutter-units</TITLE>
+CLUTTER_UNITS_FROM_DEVICE
+CLUTTER_UNITS_FROM_FIXED
+CLUTTER_UNITS_FROM_FLOAT
+CLUTTER_UNITS_FROM_INT
+CLUTTER_UNITS_FROM_PANGO_UNIT
+CLUTTER_UNITS_TMP_FROM_DEVICE
+CLUTTER_UNITS_TMP_TO_DEVICE
+CLUTTER_UNITS_TO_DEVICE
+CLUTTER_UNITS_TO_FIXED
+CLUTTER_UNITS_TO_FLOAT
+CLUTTER_UNITS_TO_INT
+</SECTION>
+
+<SECTION>
 <FILE>clutter-label</FILE>
 <TITLE>ClutterLabel</TITLE>
 ClutterLabel
index 310730e..7b6de46 100644 (file)
@@ -61,7 +61,8 @@ Evaluates to %TRUE if an actor is visible.
 
 <!-- ##### STRUCT ClutterActorBox ##### -->
 <para>
-Coordinates (top-left to bottom-right) of a box surrounding an actor.
+Coordinates (top-left to bottom-right) of a box surrounding an actor; in
+cluttter units.
 </para>
 
 @x1: X coordinate of the top left corner of the box
index 9339995..d6c1280 100644 (file)
@@ -219,6 +219,57 @@ Symbolic name for passing clutter_sine_func().
 @Returns: 
 
 
+<!-- ##### MACRO CLUTTER_ALPHA_SINE_INC ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION clutter_sine_inc_func ##### -->
+<para>
+
+</para>
+
+@alpha: 
+@dummy: 
+@Returns: 
+
+
+<!-- ##### MACRO CLUTTER_ALPHA_SINE_DEC ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION clutter_sine_dec_func ##### -->
+<para>
+
+</para>
+
+@alpha: 
+@dummy: 
+@Returns: 
+
+
+<!-- ##### MACRO CLUTTER_ALPHA_SINE_HALF ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION clutter_sine_half_func ##### -->
+<para>
+
+</para>
+
+@alpha: 
+@dummy: 
+@Returns: 
+
+
 <!-- ##### MACRO CLUTTER_ALPHA_SQUARE ##### -->
 <para>
 
@@ -253,3 +304,37 @@ Symbolic name for passing clutter_sine_func().
 @Returns: 
 
 
+<!-- ##### MACRO CLUTTER_ALPHA_EXP_INC ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION clutter_exp_inc_func ##### -->
+<para>
+
+</para>
+
+@alpha: 
+@dummy: 
+@Returns: 
+
+
+<!-- ##### MACRO CLUTTER_ALPHA_EXP_DEC ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION clutter_exp_dec_func ##### -->
+<para>
+
+</para>
+
+@alpha: 
+@dummy: 
+@Returns: 
+
+
index 3d85887..5330021 100644 (file)
@@ -23,21 +23,6 @@ clutter-media
 </para>
 
 
-<!-- ##### SIGNAL ClutterMedia::eos ##### -->
-<para>
-
-</para>
-
-@cluttermedia: the object which received the signal.
-
-<!-- ##### SIGNAL ClutterMedia::error ##### -->
-<para>
-
-</para>
-
-@cluttermedia: the object which received the signal.
-@arg1: 
-
 <!-- ##### ARG ClutterMedia:buffer-percent ##### -->
 <para>
 
diff --git a/doc/reference/tmpl/clutter-units.sgml b/doc/reference/tmpl/clutter-units.sgml
new file mode 100644 (file)
index 0000000..fae5251
--- /dev/null
@@ -0,0 +1,107 @@
+<!-- ##### SECTION Title ##### -->
+Clutter Units
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO CLUTTER_UNITS_FROM_DEVICE ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_FROM_FIXED ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_FROM_FLOAT ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_FROM_INT ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_FROM_PANGO_UNIT ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_TMP_FROM_DEVICE ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_TMP_TO_DEVICE ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_TO_DEVICE ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_TO_FIXED ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_TO_FLOAT ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
+<!-- ##### MACRO CLUTTER_UNITS_TO_INT ##### -->
+<para>
+
+</para>
+
+@x: 
+
+
index 2762dbb..7efa6d5 100644 (file)
@@ -1,7 +1,7 @@
 noinst_PROGRAMS = test super-oh behave test-text slider
 
 INCLUDES = -I$(top_srcdir)/
-LDADD = $(top_builddir)/clutter/libclutter@CLUTTER_REAL@-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.la
+LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.la
 
 AM_CFLAGS = $(CLUTTER_CFLAGS) 
 LDFLAGS = $(CLUTTER_LIBS)
index 0ae1f6c..c92da6b 100644 (file)
@@ -1,7 +1,7 @@
 noinst_PROGRAMS = test-textures test-events
 
 INCLUDES = -I$(top_srcdir)/
-LDADD = $(top_builddir)/clutter/libclutter@CLUTTER_REAL@-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.la
+LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.la
 AM_CFLAGS = $(CLUTTER_CFLAGS)
 LDFLAGS = $(CLUTTER_LIBS)