2006-11-29 Emmanuele Bassi <ebassi@openedhand.com>
authorEmmanuele Bassi <ebassi@openedhand.com>
Wed, 29 Nov 2006 22:55:23 +0000 (22:55 +0000)
committerEmmanuele Bassi <ebassi@openedhand.com>
Wed, 29 Nov 2006 22:55:23 +0000 (22:55 +0000)
* clutter/clutter-stage.c:
(clutter_stage_set_xwindow_foreign): Add checks;
remove an indirection to the private data.

ChangeLog
clutter/clutter-stage.c

index 4e4451d..eb54855 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-11-29  Emmanuele Bassi  <ebassi@openedhand.com>
 
+       * clutter/clutter-stage.c:
+       (clutter_stage_set_xwindow_foreign): Add checks;
+       remove an indirection to the private data.
+
+2006-11-29  Emmanuele Bassi  <ebassi@openedhand.com>
+
        * gtk/*
        * configure.ac:
        * Makfile.am: Remove the GTK+ widget from the
index 387da1a..f6d0081 100644 (file)
@@ -863,7 +863,7 @@ clutter_stage_get_xwindow (ClutterStage *stage)
  *
  * Target the #ClutterStage to use an existing external X Window.
  *
- * Return Value: TRUE if foreign window valid, FALSE otherwise 
+ * Return value: TRUE if foreign window valid, FALSE otherwise
  **/
 gboolean
 clutter_stage_set_xwindow_foreign (ClutterStage *stage,
@@ -877,6 +877,12 @@ clutter_stage_set_xwindow_foreign (ClutterStage *stage,
   Window root_return;
   Status status;
   ClutterGeometry geom;
+  ClutterStagePrivate *priv;
+
+  g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
+  g_return_val_if_fail (xid != None, FALSE);
+
+  priv = stage->priv;
 
   clutter_util_trap_x_errors();
 
@@ -890,23 +896,25 @@ clutter_stage_set_xwindow_foreign (ClutterStage *stage,
                         &border,
                         &depth);
               
-  if (clutter_util_untrap_x_errors() || !status 
-      || width == 0 || height == 0 || depth != stage->priv->xvisinfo->depth)
-    return FALSE;
+  if (clutter_util_untrap_x_errors() || !status ||
+      width == 0 || height == 0 ||
+      depth != priv->xvisinfo->depth)
+    {
+      return FALSE;
+    }
 
-  clutter_actor_unrealize (CLUTTER_ACTOR(stage));
+  clutter_actor_unrealize (CLUTTER_ACTOR (stage));
 
-  stage->priv->xwin = xid;
+  priv->xwin = xid;
 
   geom.x = x;
   geom.y = y;
+  geom.width  = priv->xwin_width  = width;
+  geom.height = priv->xwin_height = height;
 
-  geom.width  = stage->priv->xwin_width  = width;
-  geom.height = stage->priv->xwin_height = height;
-
-  clutter_actor_set_geometry (CLUTTER_ACTOR(stage), &geom);
+  clutter_actor_set_geometry (CLUTTER_ACTOR (stage), &geom);
 
-  clutter_actor_realize (CLUTTER_ACTOR(stage));
+  clutter_actor_realize (CLUTTER_ACTOR (stage));
 
   return TRUE;
 }