1
0
Fork 0

2008-06-25 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-backend.c:
	(clutter_backend_get_display_size): Provide a fallback for
	backends not implementing get_display_size().

	* clutter/clutter-stage.c:
	(clutter_stage_allocate): Add debug messages.

	* clutter/sdl/clutter-backend-sdl.c:
	(clutter_backend_sdl_get_display_size),
	(clutter_backend_sdl_class_init): Implement get_display_size()
	on the SDL backend.
This commit is contained in:
Emmanuele Bassi 2008-06-25 13:32:03 +00:00
parent 631277be44
commit d651cc4337
4 changed files with 73 additions and 14 deletions

View file

@ -1,3 +1,17 @@
2008-06-25 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-backend.c:
(clutter_backend_get_display_size): Provide a fallback for
backends not implementing get_display_size().
* clutter/clutter-stage.c:
(clutter_stage_allocate): Add debug messages.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_get_display_size),
(clutter_backend_sdl_class_init): Implement get_display_size()
on the SDL backend.
2008-06-25 Chris Lord <chris@openedhand.com>
* clutter/clutter-fixed.c: (clutter_sinx):

View file

@ -482,6 +482,16 @@ clutter_backend_get_font_options (ClutterBackend *backend)
return priv->font_options;
}
/**
* clutter_backend_get_display_size:
* @backend: a #ClutterBackend
* @width: return location for the display width in pixels, or %NULL
* @height: return location for the display height in pixels, or %NULL
*
* Retrieves the size of the display from the #ClutterBackend.
*
* Since: 0.8
*/
void
clutter_backend_get_display_size (ClutterBackend *backend,
gint *width,
@ -499,9 +509,7 @@ clutter_backend_get_display_size (ClutterBackend *backend,
if (height)
*height = 0;
return;
}
klass->get_display_size (backend, width, height);
else
klass->get_display_size (backend, width, height);
}

View file

@ -152,9 +152,9 @@ clutter_stage_get_preferred_height (ClutterActor *self,
natural_height_p);
}
static void
clutter_stage_allocate (ClutterActor *self,
const ClutterActorBox *box,
gboolean origin_changed)
clutter_stage_allocate (ClutterActor *self,
const ClutterActorBox *box,
gboolean origin_changed)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
@ -168,6 +168,11 @@ clutter_stage_allocate (ClutterActor *self,
{
ClutterActorClass *klass;
CLUTTER_NOTE (ACTOR, "Following allocation to %dx%d (origin %s)",
CLUTTER_UNITS_TO_DEVICE (box->x2 - box->x1),
CLUTTER_UNITS_TO_DEVICE (box->y2 - box->y1),
origin_changed ? "changed" : "not changed");
klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
klass->allocate (self, box, origin_changed);
@ -191,6 +196,11 @@ clutter_stage_allocate (ClutterActor *self,
override.x2 = CLUTTER_UNITS_FROM_DEVICE (display_width);
override.y2 = CLUTTER_UNITS_FROM_DEVICE (display_height);
CLUTTER_NOTE (ACTOR, "Overriding allocation to %dx%d (origin: %s)",
display_width,
display_height,
origin_changed ? "changed" : "not changed");
klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
klass->allocate (self, &override, origin_changed);
}

View file

@ -167,6 +167,32 @@ clutter_backend_sdl_get_features (ClutterBackend *backend)
return CLUTTER_FEATURE_STAGE_CURSOR;
}
static void
clutter_backend_sdl_get_display_size (ClutterBackend *backend,
gint *width,
gint *height)
{
SDL_Surface *surface;
surface = SDL_GetVideoSurface ();
if (!surface)
{
if (width)
*width = 0;
if (height)
*height = 0;
}
else
{
if (width)
*width = surface->w;
if (height)
*height = surface->h;
}
}
static void
clutter_backend_sdl_class_init (ClutterBackendSDLClass *klass)
{
@ -177,13 +203,14 @@ clutter_backend_sdl_class_init (ClutterBackendSDLClass *klass)
gobject_class->dispose = clutter_backend_sdl_dispose;
gobject_class->finalize = clutter_backend_sdl_finalize;
backend_class->pre_parse = clutter_backend_sdl_pre_parse;
backend_class->post_parse = clutter_backend_sdl_post_parse;
backend_class->init_events = clutter_backend_sdl_init_events;
backend_class->create_stage = clutter_backend_sdl_create_stage;
backend_class->ensure_context = clutter_backend_sdl_ensure_context;
backend_class->redraw = clutter_backend_sdl_redraw;
backend_class->get_features = clutter_backend_sdl_get_features;
backend_class->pre_parse = clutter_backend_sdl_pre_parse;
backend_class->post_parse = clutter_backend_sdl_post_parse;
backend_class->init_events = clutter_backend_sdl_init_events;
backend_class->create_stage = clutter_backend_sdl_create_stage;
backend_class->ensure_context = clutter_backend_sdl_ensure_context;
backend_class->redraw = clutter_backend_sdl_redraw;
backend_class->get_features = clutter_backend_sdl_get_features;
backend_class->get_display_size = clutter_backend_sdl_get_display_size;
}
static void