mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter/stage: Remove 'minimum window size' logic
It was a feature relevant for when Clutter was an application toolkit that wanted the application window to communicate a minimum size to the windowing system. Now, clutter is part of the windowing system component, so this feature doesn't make any sense, so remove it. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2002>
This commit is contained in:
parent
259a906b8c
commit
7058013660
@ -128,7 +128,6 @@ struct _ClutterStagePrivate
|
||||
GHashTable *touch_sequences;
|
||||
|
||||
guint throttle_motion_events : 1;
|
||||
guint min_size_changed : 1;
|
||||
guint motion_events_enabled : 1;
|
||||
guint actor_needs_immediate_relayout : 1;
|
||||
};
|
||||
@ -299,32 +298,6 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
CLUTTER_CONTAINER (self),
|
||||
&children_box);
|
||||
|
||||
/* Ensure the window is sized correctly */
|
||||
if (priv->min_size_changed)
|
||||
{
|
||||
gfloat min_width, min_height;
|
||||
gboolean min_width_set, min_height_set;
|
||||
|
||||
g_object_get (G_OBJECT (self),
|
||||
"min-width", &min_width,
|
||||
"min-width-set", &min_width_set,
|
||||
"min-height", &min_height,
|
||||
"min-height-set", &min_height_set,
|
||||
NULL);
|
||||
|
||||
if (!min_width_set)
|
||||
min_width = 1;
|
||||
if (!min_height_set)
|
||||
min_height = 1;
|
||||
|
||||
if (width < min_width)
|
||||
width = min_width;
|
||||
if (height < min_height)
|
||||
height = min_height;
|
||||
|
||||
priv->min_size_changed = FALSE;
|
||||
}
|
||||
|
||||
if (window_size.width != CLUTTER_NEARBYINT (width) ||
|
||||
window_size.height != CLUTTER_NEARBYINT (height))
|
||||
{
|
||||
@ -1532,12 +1505,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
klass->deactivate = clutter_stage_real_deactivate;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_notify_min_size (ClutterStage *self)
|
||||
{
|
||||
self->priv->min_size_changed = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_init (ClutterStage *self)
|
||||
{
|
||||
@ -1578,7 +1545,6 @@ clutter_stage_init (ClutterStage *self)
|
||||
priv->event_queue = g_queue_new ();
|
||||
|
||||
priv->throttle_motion_events = TRUE;
|
||||
priv->min_size_changed = FALSE;
|
||||
priv->motion_events_enabled = TRUE;
|
||||
|
||||
priv->pointer_devices =
|
||||
@ -1596,12 +1562,6 @@ clutter_stage_init (ClutterStage *self)
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
||||
clutter_stage_set_title (self, g_get_prgname ());
|
||||
clutter_stage_set_key_focus (self, NULL);
|
||||
|
||||
g_signal_connect (self, "notify::min-width",
|
||||
G_CALLBACK (clutter_stage_notify_min_size), NULL);
|
||||
g_signal_connect (self, "notify::min-height",
|
||||
G_CALLBACK (clutter_stage_notify_min_size), NULL);
|
||||
|
||||
clutter_stage_set_viewport (self, geom.width, geom.height);
|
||||
|
||||
priv->pending_queue_redraws =
|
||||
@ -2485,87 +2445,6 @@ clutter_stage_get_throttle_motion_events (ClutterStage *stage)
|
||||
return stage->priv->throttle_motion_events;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_set_minimum_size:
|
||||
* @stage: a #ClutterStage
|
||||
* @width: width, in pixels
|
||||
* @height: height, in pixels
|
||||
*
|
||||
* Sets the minimum size for a stage window, if the default backend
|
||||
* uses #ClutterStage inside a window
|
||||
*
|
||||
* This is a convenience function, and it is equivalent to setting the
|
||||
* #ClutterActor:min-width and #ClutterActor:min-height on @stage
|
||||
*
|
||||
* If the current size of @stage is smaller than the minimum size, the
|
||||
* @stage will be resized to the new @width and @height
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_stage_set_minimum_size (ClutterStage *stage,
|
||||
guint width,
|
||||
guint height)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
g_return_if_fail ((width > 0) && (height > 0));
|
||||
|
||||
g_object_set (G_OBJECT (stage),
|
||||
"min-width", (gfloat) width,
|
||||
"min-height", (gfloat )height,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_minimum_size:
|
||||
* @stage: a #ClutterStage
|
||||
* @width: (out): return location for the minimum width, in pixels,
|
||||
* or %NULL
|
||||
* @height: (out): return location for the minimum height, in pixels,
|
||||
* or %NULL
|
||||
*
|
||||
* Retrieves the minimum size for a stage window as set using
|
||||
* clutter_stage_set_minimum_size().
|
||||
*
|
||||
* The returned size may not correspond to the actual minimum size and
|
||||
* it is specific to the #ClutterStage implementation inside the
|
||||
* Clutter backend
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_stage_get_minimum_size (ClutterStage *stage,
|
||||
guint *width_p,
|
||||
guint *height_p)
|
||||
{
|
||||
gfloat width, height;
|
||||
gboolean width_set, height_set;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
g_object_get (G_OBJECT (stage),
|
||||
"min-width", &width,
|
||||
"min-width-set", &width_set,
|
||||
"min-height", &height,
|
||||
"min-height-set", &height_set,
|
||||
NULL);
|
||||
|
||||
/* if not width or height have been set, then the Stage
|
||||
* minimum size is defined to be 1x1
|
||||
*/
|
||||
if (!width_set)
|
||||
width = 1;
|
||||
|
||||
if (!height_set)
|
||||
height = 1;
|
||||
|
||||
if (width_p)
|
||||
*width_p = (guint) width;
|
||||
|
||||
if (height_p)
|
||||
*height_p = (guint) height;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_schedule_update:
|
||||
* @stage: a #ClutterStage actor
|
||||
|
@ -80,26 +80,16 @@ meta_stage_x11_fix_window_size (MetaStageX11 *stage_x11,
|
||||
int new_width,
|
||||
int new_height)
|
||||
{
|
||||
MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_x11);
|
||||
g_return_if_fail (new_width > 0);
|
||||
g_return_if_fail (new_height > 0);
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
uint32_t min_width, min_height;
|
||||
XSizeHints *size_hints;
|
||||
|
||||
size_hints = XAllocSizeHints();
|
||||
|
||||
clutter_stage_get_minimum_size (stage_impl->wrapper,
|
||||
&min_width,
|
||||
&min_height);
|
||||
|
||||
if (new_width <= 0)
|
||||
new_width = min_width;
|
||||
|
||||
if (new_height <= 0)
|
||||
new_height = min_height;
|
||||
|
||||
size_hints->min_width = new_width;
|
||||
size_hints->min_height = new_height;
|
||||
size_hints->max_width = new_width;
|
||||
|
@ -71,10 +71,6 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
clutter_actor_add_child (rect, label);
|
||||
clutter_actor_add_child (box, rect);
|
||||
|
||||
clutter_stage_set_minimum_size (CLUTTER_STAGE (stage),
|
||||
clutter_actor_get_width (box),
|
||||
clutter_actor_get_height (box));
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_test_main ();
|
||||
|
Loading…
Reference in New Issue
Block a user