2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c: (clutter_actor_set_min_width), (clutter_actor_set_min_height), (clutter_actor_set_natural_width), (clutter_actor_set_natural_height): Ignore any override of the minimum and natural size of the stage on backends that only support static stages. * clutter/clutter-stage.c (clutter_stage_allocate): Use the preferred size of the ClutterStage implementation instead of the display size. * clutter/clutter-backend.[ch]: Remove get_display_size() and clutter_backend_get_display_size(). * clutter/eglnative/clutter-backend-egl.c: * clutter/fruity/clutter-backend-fruity.c: * clutter/osx/clutter-backend-osx.c: * clutter/sdl/clutter-backend-sdl.c: * clutter/win32/clutter-backend-win32.c: * clutter/x11/clutter-backend-x11.c: Remove get_display_size() implementations.
This commit is contained in:
parent
7dd3eda029
commit
a07d57572c
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
||||
2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
(clutter_actor_set_min_width),
|
||||
(clutter_actor_set_min_height),
|
||||
(clutter_actor_set_natural_width),
|
||||
(clutter_actor_set_natural_height): Ignore any override of the
|
||||
minimum and natural size of the stage on backends that only
|
||||
support static stages.
|
||||
|
||||
* clutter/clutter-stage.c (clutter_stage_allocate): Use the
|
||||
preferred size of the ClutterStage implementation instead of
|
||||
the display size.
|
||||
|
||||
* clutter/clutter-backend.[ch]: Remove get_display_size() and
|
||||
clutter_backend_get_display_size().
|
||||
|
||||
* clutter/eglnative/clutter-backend-egl.c:
|
||||
* clutter/fruity/clutter-backend-fruity.c:
|
||||
* clutter/osx/clutter-backend-osx.c:
|
||||
* clutter/sdl/clutter-backend-sdl.c:
|
||||
* clutter/win32/clutter-backend-win32.c:
|
||||
* clutter/x11/clutter-backend-x11.c: Remove get_display_size()
|
||||
implementations.
|
||||
|
||||
2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-shader.c (bind_glsl_shader): Verify that the
|
||||
|
@ -3641,25 +3641,14 @@ clutter_actor_set_min_width (ClutterActor *self,
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterActorBox old = { 0, };
|
||||
|
||||
/* override the minimum width on a top-level actor in case
|
||||
* we are working on a backend that only provides a fixed
|
||||
* size stage (e.g. on a framebuffer)
|
||||
/* if we are setting the size on a top-level actor and the
|
||||
* backend only supports static top-levels (e.g. framebuffers)
|
||||
* then we ignore the passed value and we override it with
|
||||
* the stage implementation's preferred size.
|
||||
*/
|
||||
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)
|
||||
{
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
gint display_width;
|
||||
|
||||
clutter_backend_get_display_size (backend,
|
||||
&display_width,
|
||||
NULL);
|
||||
|
||||
if (min_width != (CLUTTER_UNITS_FROM_DEVICE (display_width)))
|
||||
min_width = CLUTTER_UNITS_FROM_DEVICE (display_width);
|
||||
}
|
||||
}
|
||||
if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) &&
|
||||
clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
return;
|
||||
|
||||
if (priv->min_width_set && min_width == priv->request_min_width)
|
||||
return;
|
||||
@ -3687,25 +3676,14 @@ clutter_actor_set_min_height (ClutterActor *self,
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterActorBox old = { 0, };
|
||||
|
||||
/* override the minimum height on a top-level actor in case
|
||||
* we are working on a backend that only provides a fixed
|
||||
* size stage (e.g. on a framebuffer)
|
||||
/* if we are setting the size on a top-level actor and the
|
||||
* backend only supports static top-levels (e.g. framebuffers)
|
||||
* then we ignore the passed value and we override it with
|
||||
* the stage implementation's preferred size.
|
||||
*/
|
||||
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)
|
||||
{
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
gint display_height;
|
||||
|
||||
clutter_backend_get_display_size (backend,
|
||||
NULL,
|
||||
&display_height);
|
||||
|
||||
if (min_height != (CLUTTER_UNITS_FROM_DEVICE (display_height)))
|
||||
min_height = CLUTTER_UNITS_FROM_DEVICE (display_height);
|
||||
}
|
||||
}
|
||||
if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) &&
|
||||
clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
return;
|
||||
|
||||
if (priv->min_height_set && min_height == priv->request_min_height)
|
||||
return;
|
||||
@ -3732,25 +3710,14 @@ clutter_actor_set_natural_width (ClutterActor *self,
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterActorBox old = { 0, };
|
||||
|
||||
/* override the natural width on a top-level actor in case
|
||||
* we are working on a backend that only provides a fixed
|
||||
* size stage (e.g. on a framebuffer)
|
||||
/* if we are setting the size on a top-level actor and the
|
||||
* backend only supports static top-levels (e.g. framebuffers)
|
||||
* then we ignore the passed value and we override it with
|
||||
* the stage implementation's preferred size.
|
||||
*/
|
||||
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)
|
||||
{
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
gint display_width;
|
||||
|
||||
clutter_backend_get_display_size (backend,
|
||||
&display_width,
|
||||
NULL);
|
||||
|
||||
if (natural_width != (CLUTTER_UNITS_FROM_DEVICE (display_width)))
|
||||
natural_width = CLUTTER_UNITS_FROM_DEVICE (display_width);
|
||||
}
|
||||
}
|
||||
if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) &&
|
||||
clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
return;
|
||||
|
||||
if (priv->natural_width_set &&
|
||||
natural_width == priv->request_natural_width)
|
||||
@ -3778,25 +3745,14 @@ clutter_actor_set_natural_height (ClutterActor *self,
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterActorBox old = { 0, };
|
||||
|
||||
/* override the natural height on a top-level actor in case
|
||||
* we are working on a backend that only provides a fixed
|
||||
* size stage (e.g. on a framebuffer)
|
||||
/* if we are setting the size on a top-level actor and the
|
||||
* backend only supports static top-levels (e.g. framebuffers)
|
||||
* then we ignore the passed value and we override it with
|
||||
* the stage implementation's preferred size.
|
||||
*/
|
||||
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)
|
||||
{
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
gint display_height;
|
||||
|
||||
clutter_backend_get_display_size (backend,
|
||||
NULL,
|
||||
&display_height);
|
||||
|
||||
if (natural_height != (CLUTTER_UNITS_FROM_DEVICE (display_height)))
|
||||
natural_height = CLUTTER_UNITS_FROM_DEVICE (display_height);
|
||||
}
|
||||
}
|
||||
if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) &&
|
||||
clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||
return;
|
||||
|
||||
if (priv->natural_height_set &&
|
||||
natural_height == priv->request_natural_height)
|
||||
|
@ -482,34 +482,3 @@ 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,
|
||||
gint *height)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (!klass->get_display_size)
|
||||
{
|
||||
if (width)
|
||||
*width = 0;
|
||||
|
||||
if (height)
|
||||
*height = 0;
|
||||
}
|
||||
else
|
||||
klass->get_display_size (backend, width, height);
|
||||
}
|
||||
|
@ -75,9 +75,6 @@ struct _ClutterBackendClass
|
||||
ClutterStage *stage);
|
||||
void (* ensure_context) (ClutterBackend *backend,
|
||||
ClutterStage *stage);
|
||||
void (* get_display_size) (ClutterBackend *backend,
|
||||
gint *width,
|
||||
gint *height);
|
||||
};
|
||||
|
||||
GType clutter_backend_get_type (void) G_GNUC_CONST;
|
||||
@ -96,9 +93,6 @@ guint clutter_backend_get_double_click_distance (ClutterBackend
|
||||
void clutter_backend_set_font_options (ClutterBackend *backend,
|
||||
cairo_font_options_t *options);
|
||||
cairo_font_options_t *clutter_backend_get_font_options (ClutterBackend *backend);
|
||||
void clutter_backend_get_display_size (ClutterBackend *backend,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -182,25 +182,24 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
else
|
||||
{
|
||||
ClutterActorBox override = { 0, };
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
gint display_width, display_height;
|
||||
ClutterActorClass *klass;
|
||||
ClutterUnit natural_width, natural_height;
|
||||
|
||||
display_width = display_height = 0;
|
||||
clutter_backend_get_display_size (backend,
|
||||
&display_width,
|
||||
&display_height);
|
||||
/* propagate the allocation */
|
||||
klass = CLUTTER_ACTOR_GET_CLASS (priv->impl);
|
||||
klass->allocate (self, box, origin_changed);
|
||||
|
||||
/* get the preferred size from the backend */
|
||||
clutter_actor_get_preferred_size (priv->impl,
|
||||
NULL, NULL,
|
||||
&natural_width, &natural_height);
|
||||
|
||||
override.x1 = 0;
|
||||
override.y1 = 0;
|
||||
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");
|
||||
override.x2 = natural_width;
|
||||
override.y2 = natural_height;
|
||||
|
||||
/* and store the overridden allocation */
|
||||
klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
|
||||
klass->allocate (self, &override, origin_changed);
|
||||
}
|
||||
|
@ -197,33 +197,6 @@ clutter_backend_egl_get_features (ClutterBackend *backend)
|
||||
return CLUTTER_FEATURE_STAGE_STATIC;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_get_display_size (ClutterBackend *backend,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
gint surface_width, surface_height;
|
||||
|
||||
if (backend_egl->stage)
|
||||
{
|
||||
ClutterStageEGL *stage_egl;
|
||||
|
||||
stage_egl = CLUTTER_STAGE_EGL (backend_egl->stage);
|
||||
|
||||
surface_width = stage_egl->surface_width;
|
||||
surface_height = stage_egl->surface_height;
|
||||
}
|
||||
else
|
||||
surface_width = surface_height = 0;
|
||||
|
||||
if (width)
|
||||
*width = surface_width;
|
||||
|
||||
if (height)
|
||||
*height = surface_height;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
||||
{
|
||||
@ -241,7 +214,6 @@ clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
||||
backend_class->ensure_context = clutter_backend_egl_ensure_context;
|
||||
backend_class->redraw = clutter_backend_egl_redraw;
|
||||
backend_class->get_features = clutter_backend_egl_get_features;
|
||||
backend_class->get_display_size = clutter_backend_egl_get_display_size;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -190,33 +190,6 @@ clutter_backend_egl_get_features (ClutterBackend *backend)
|
||||
return CLUTTER_FEATURE_STAGE_STATIC;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_get_display_size (ClutterBackend *backend,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
gint surface_width, surface_height;
|
||||
|
||||
if (backend_egl->stage)
|
||||
{
|
||||
ClutterStageEgl *stage_egl;
|
||||
|
||||
stage_egl = CLUTTER_STAGE_EGL (backend_egl->stage);
|
||||
|
||||
surface_width = stage_egl->surface_width;
|
||||
surface_height = stage_egl->surface_height;
|
||||
}
|
||||
else
|
||||
surface_width = surface_height = 0;
|
||||
|
||||
if (width)
|
||||
*width = surface_width;
|
||||
|
||||
if (height)
|
||||
*height = surface_height;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
||||
{
|
||||
@ -234,7 +207,6 @@ clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
||||
backend_class->ensure_context = clutter_backend_egl_ensure_context;
|
||||
backend_class->redraw = clutter_backend_egl_redraw;
|
||||
backend_class->get_features = clutter_backend_egl_get_features;
|
||||
backend_class->get_display_size = clutter_backend_egl_get_display_size;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -167,38 +167,6 @@ clutter_backend_osx_redraw (ClutterBackend *backend, ClutterStage *wrapper)
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_osx_get_display_size (ClutterBackend *backend,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
int i;
|
||||
int display_width, display_height;
|
||||
NSArray *array;
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
array = [NSScreen screens];
|
||||
|
||||
display_width = display_height = 0;
|
||||
|
||||
for (i = 0; i < [array count]; i++)
|
||||
{
|
||||
NSRect rect = [[array objectAtIndex:i] frame];
|
||||
|
||||
display_width += rect.size.width;
|
||||
display_height += rect.size.height;
|
||||
}
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
|
||||
if (width)
|
||||
*width = display_width;
|
||||
|
||||
if (height)
|
||||
*height = display_height;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
static void
|
||||
@ -236,7 +204,6 @@ clutter_backend_osx_class_init (ClutterBackendOSXClass *klass)
|
||||
backend_class->ensure_context = clutter_backend_osx_ensure_context;
|
||||
backend_class->init_events = clutter_backend_osx_init_events;
|
||||
backend_class->redraw = clutter_backend_osx_redraw;
|
||||
backend_class->get_display_size = clutter_backend_osx_get_display_size;
|
||||
}
|
||||
|
||||
GType
|
||||
|
@ -167,32 +167,6 @@ 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)
|
||||
{
|
||||
@ -210,7 +184,6 @@ clutter_backend_sdl_class_init (ClutterBackendSDLClass *klass)
|
||||
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
|
||||
|
@ -229,30 +229,6 @@ clutter_backend_win32_get_features (ClutterBackend *backend)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_win32_get_display_size (ClutterBackend *backend,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
gint display_width, display_height;
|
||||
|
||||
/* Try get the combined size of all of the monitors */
|
||||
if ((display_width = GetSystemMetrics (SM_CXVIRTUALSCREEN)) == 0
|
||||
|| (display_height = GetSystemMetrics (SM_CYVIRTUALSCREEN)) == 0)
|
||||
{
|
||||
/* If the multi-monitor API isn't supported then just return the
|
||||
size of the primary display */
|
||||
display_width = GetSystemMetrics (SM_CXSCREEN);
|
||||
display_height = GetSystemMetrics (SM_CYSCREEN);
|
||||
}
|
||||
|
||||
if (width)
|
||||
*width = display_width;
|
||||
|
||||
if (height)
|
||||
*height = display_height;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_win32_ensure_context (ClutterBackend *backend,
|
||||
ClutterStage *stage)
|
||||
@ -365,7 +341,6 @@ clutter_backend_win32_class_init (ClutterBackendWin32Class *klass)
|
||||
backend_class->create_stage = clutter_backend_win32_create_stage;
|
||||
backend_class->add_options = clutter_backend_win32_add_options;
|
||||
backend_class->get_features = clutter_backend_win32_get_features;
|
||||
backend_class->get_display_size = clutter_backend_win32_get_display_size;
|
||||
backend_class->redraw = clutter_backend_win32_redraw;
|
||||
backend_class->ensure_context = clutter_backend_win32_ensure_context;
|
||||
}
|
||||
|
@ -843,7 +843,6 @@ clutter_backend_get_double_click_distance
|
||||
clutter_backend_set_double_click_distance
|
||||
clutter_backend_set_font_options
|
||||
clutter_backend_get_font_options
|
||||
clutter_backend_get_display_size
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_BACKEND
|
||||
CLUTTER_IS_BACKEND
|
||||
|
Loading…
Reference in New Issue
Block a user