+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):
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,
if (height)
*height = 0;
-
- return;
}
-
- klass->get_display_size (backend, width, height);
+ else
+ klass->get_display_size (backend, width, height);
}
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;
{
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);
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);
}
}
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)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (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