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.
This commit is contained in:
Emmanuele Bassi 2006-11-29 22:55:23 +00:00
parent 9139c07b48
commit 56132b57ca
2 changed files with 25 additions and 11 deletions

View File

@ -1,3 +1,9 @@
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> 2006-11-29 Emmanuele Bassi <ebassi@openedhand.com>
* gtk/* * gtk/*

View File

@ -863,7 +863,7 @@ clutter_stage_get_xwindow (ClutterStage *stage)
* *
* Target the #ClutterStage to use an existing external X Window. * 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 gboolean
clutter_stage_set_xwindow_foreign (ClutterStage *stage, clutter_stage_set_xwindow_foreign (ClutterStage *stage,
@ -877,6 +877,12 @@ clutter_stage_set_xwindow_foreign (ClutterStage *stage,
Window root_return; Window root_return;
Status status; Status status;
ClutterGeometry geom; 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(); clutter_util_trap_x_errors();
@ -890,19 +896,21 @@ clutter_stage_set_xwindow_foreign (ClutterStage *stage,
&border, &border,
&depth); &depth);
if (clutter_util_untrap_x_errors() || !status if (clutter_util_untrap_x_errors() || !status ||
|| width == 0 || height == 0 || depth != stage->priv->xvisinfo->depth) width == 0 || height == 0 ||
depth != priv->xvisinfo->depth)
{
return FALSE; 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.x = x;
geom.y = y; geom.y = y;
geom.width = priv->xwin_width = width;
geom.width = stage->priv->xwin_width = width; geom.height = priv->xwin_height = height;
geom.height = stage->priv->xwin_height = height;
clutter_actor_set_geometry (CLUTTER_ACTOR (stage), &geom); clutter_actor_set_geometry (CLUTTER_ACTOR (stage), &geom);