Merge remote branch 'origin/cwiiis-stage-resize'
* origin/cwiiis-stage-resize: [stage-x11] Set the default size differently [stage] Set default size correctly Revert "[x11] Don't set actor size on ConfigureNotify" [x11] Don't set actor size on ConfigureNotify [stage] Now that get_geometry works, use it [stage-x11] make get_geometry always get geometry [stage] Get the current size correctly [stage] Set minimum width/height to 1x1 [stage] Add set/get_minumum_size
This commit is contained in:
commit
6106010b6f
@ -82,6 +82,8 @@ struct _ClutterStagePrivate
|
|||||||
{
|
{
|
||||||
/* the stage implementation */
|
/* the stage implementation */
|
||||||
ClutterStageWindow *impl;
|
ClutterStageWindow *impl;
|
||||||
|
guint minimum_width;
|
||||||
|
guint minimum_height;
|
||||||
|
|
||||||
ClutterColor color;
|
ClutterColor color;
|
||||||
ClutterPerspective perspective;
|
ClutterPerspective perspective;
|
||||||
@ -1179,6 +1181,8 @@ clutter_stage_init (ClutterStage *self)
|
|||||||
priv->throttle_motion_events = TRUE;
|
priv->throttle_motion_events = TRUE;
|
||||||
|
|
||||||
priv->color = default_stage_color;
|
priv->color = default_stage_color;
|
||||||
|
priv->minimum_width = 1;
|
||||||
|
priv->minimum_height = 1;
|
||||||
|
|
||||||
priv->perspective.fovy = 60.0; /* 60 Degrees */
|
priv->perspective.fovy = 60.0; /* 60 Degrees */
|
||||||
priv->perspective.aspect = 1.0;
|
priv->perspective.aspect = 1.0;
|
||||||
@ -2322,3 +2326,74 @@ clutter_stage_get_use_alpha (ClutterStage *stage)
|
|||||||
|
|
||||||
return stage->priv->use_alpha;
|
return stage->priv->use_alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_stage_set_minimum_size:
|
||||||
|
* @stage: a #ClutterStage
|
||||||
|
* @width: width, in pixels
|
||||||
|
* @height: height, in pixels
|
||||||
|
*
|
||||||
|
* Sets the minimum size for a stage window. This has no effect if the stage
|
||||||
|
* is fullscreen.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_stage_set_minimum_size (ClutterStage *stage,
|
||||||
|
guint width,
|
||||||
|
guint height)
|
||||||
|
{
|
||||||
|
gboolean resize;
|
||||||
|
ClutterGeometry geom;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||||
|
g_return_if_fail ((width > 0) && (height > 0));
|
||||||
|
|
||||||
|
stage->priv->minimum_width = width;
|
||||||
|
stage->priv->minimum_height = height;
|
||||||
|
|
||||||
|
if (stage->priv->impl == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
resize = FALSE;
|
||||||
|
_clutter_stage_window_get_geometry (stage->priv->impl, &geom);
|
||||||
|
|
||||||
|
if (geom.width < width)
|
||||||
|
resize = TRUE;
|
||||||
|
else
|
||||||
|
width = geom.width;
|
||||||
|
|
||||||
|
if (geom.height < height)
|
||||||
|
resize = TRUE;
|
||||||
|
else
|
||||||
|
height = geom.height;
|
||||||
|
|
||||||
|
if (resize)
|
||||||
|
_clutter_stage_window_resize (stage->priv->impl, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_stage_get_minimum_size:
|
||||||
|
* @stage: a #ClutterStage
|
||||||
|
* @width: width, in pixels
|
||||||
|
* @height: height, in pixels
|
||||||
|
*
|
||||||
|
* Gets the set minimum size for a stage window. This may not correspond
|
||||||
|
* to the actual minimum size and is specific to the back-end
|
||||||
|
* implementation.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_stage_get_minimum_size (ClutterStage *stage,
|
||||||
|
guint *width,
|
||||||
|
guint *height)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||||
|
|
||||||
|
if (width)
|
||||||
|
*width = stage->priv->minimum_width;
|
||||||
|
if (height)
|
||||||
|
*height = stage->priv->minimum_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -247,6 +247,13 @@ void clutter_stage_set_use_alpha (ClutterStage *stage,
|
|||||||
gboolean use_alpha);
|
gboolean use_alpha);
|
||||||
gboolean clutter_stage_get_use_alpha (ClutterStage *stage);
|
gboolean clutter_stage_get_use_alpha (ClutterStage *stage);
|
||||||
|
|
||||||
|
void clutter_stage_set_minimum_size (ClutterStage *stage,
|
||||||
|
guint width,
|
||||||
|
guint height);
|
||||||
|
void clutter_stage_get_minimum_size (ClutterStage *stage,
|
||||||
|
guint *width,
|
||||||
|
guint *height);
|
||||||
|
|
||||||
/* Commodity macro, for mallum only */
|
/* Commodity macro, for mallum only */
|
||||||
#define clutter_stage_add(stage,actor) G_STMT_START { \
|
#define clutter_stage_add(stage,actor) G_STMT_START { \
|
||||||
if (CLUTTER_IS_STAGE ((stage)) && CLUTTER_IS_ACTOR ((actor))) \
|
if (CLUTTER_IS_STAGE ((stage)) && CLUTTER_IS_ACTOR ((actor))) \
|
||||||
|
@ -171,7 +171,9 @@ clutter_stage_glx_realize (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* no user resize.. */
|
/* no user resize.. */
|
||||||
clutter_stage_x11_fix_window_size (stage_x11, -1, -1);
|
clutter_stage_x11_fix_window_size (stage_x11,
|
||||||
|
stage_x11->xwin_width,
|
||||||
|
stage_x11->xwin_height);
|
||||||
clutter_stage_x11_set_wm_protocols (stage_x11);
|
clutter_stage_x11_set_wm_protocols (stage_x11);
|
||||||
|
|
||||||
/* ask for a context; a no-op, if a context already exists */
|
/* ask for a context; a no-op, if a context already exists */
|
||||||
|
@ -102,24 +102,20 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
|||||||
|
|
||||||
if (stage_x11->xwin != None && !stage_x11->is_foreign_xwin)
|
if (stage_x11->xwin != None && !stage_x11->is_foreign_xwin)
|
||||||
{
|
{
|
||||||
gint min_width, min_height;
|
guint min_width, min_height;
|
||||||
ClutterGeometry min_size;
|
|
||||||
XSizeHints *size_hints;
|
XSizeHints *size_hints;
|
||||||
|
|
||||||
size_hints = XAllocSizeHints();
|
size_hints = XAllocSizeHints();
|
||||||
|
|
||||||
_clutter_stage_window_get_geometry (CLUTTER_STAGE_WINDOW (stage_x11),
|
clutter_stage_get_minimum_size (stage_x11->wrapper,
|
||||||
&min_size);
|
&min_width,
|
||||||
|
&min_height);
|
||||||
|
|
||||||
if (new_width < 0)
|
if (new_width <= 0)
|
||||||
min_width = min_size.width;
|
new_width = min_width;
|
||||||
else
|
|
||||||
min_width = new_width;
|
|
||||||
|
|
||||||
if (new_height < 0)
|
if (new_height <= 0)
|
||||||
min_height = min_size.height;
|
new_height = min_height;
|
||||||
else
|
|
||||||
min_height = new_height;
|
|
||||||
|
|
||||||
size_hints->flags = 0;
|
size_hints->flags = 0;
|
||||||
|
|
||||||
@ -127,15 +123,19 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
|||||||
restrictions on the window size */
|
restrictions on the window size */
|
||||||
if (!stage_x11->fullscreen_on_map)
|
if (!stage_x11->fullscreen_on_map)
|
||||||
{
|
{
|
||||||
size_hints->min_width = min_width;
|
if (resize)
|
||||||
size_hints->min_height = min_height;
|
|
||||||
size_hints->flags = PMinSize;
|
|
||||||
|
|
||||||
if (!resize)
|
|
||||||
{
|
{
|
||||||
size_hints->max_width = size_hints->min_width;
|
size_hints->min_width = min_width;
|
||||||
size_hints->max_height = size_hints->min_height;
|
size_hints->min_height = min_height;
|
||||||
size_hints->flags |= PMaxSize;
|
size_hints->flags = PMinSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_hints->min_width = new_width;
|
||||||
|
size_hints->min_height = new_height;
|
||||||
|
size_hints->max_width = new_width;
|
||||||
|
size_hints->max_height = new_height;
|
||||||
|
size_hints->flags = PMinSize | PMaxSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
|||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
ClutterBackendX11 *backend_x11;
|
ClutterBackendX11 *backend_x11;
|
||||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||||
gboolean is_fullscreen, resize;
|
gboolean is_fullscreen;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_BACKEND_X11 (backend));
|
g_return_if_fail (CLUTTER_IS_BACKEND_X11 (backend));
|
||||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||||
@ -187,19 +187,8 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
resize = clutter_stage_get_user_resizable (stage_x11->wrapper);
|
geometry->width = stage_x11->xwin_width;
|
||||||
|
geometry->height = stage_x11->xwin_height;
|
||||||
if (resize)
|
|
||||||
{
|
|
||||||
/* FIXME need API to set this */
|
|
||||||
geometry->width = 1;
|
|
||||||
geometry->height = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
geometry->width = stage_x11->xwin_width;
|
|
||||||
geometry->height = stage_x11->xwin_height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -533,6 +533,8 @@ clutter_stage_set_throttle_motion_events
|
|||||||
clutter_stage_get_throttle_motion_events
|
clutter_stage_get_throttle_motion_events
|
||||||
clutter_stage_set_use_alpha
|
clutter_stage_set_use_alpha
|
||||||
clutter_stage_get_use_alpha
|
clutter_stage_get_use_alpha
|
||||||
|
clutter_stage_set_minimum_size
|
||||||
|
clutter_stage_get_minimum_size
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
ClutterPerspective
|
ClutterPerspective
|
||||||
|
Loading…
x
Reference in New Issue
Block a user