From e4283f6d48b98e764b988b43bbc86b9d52e6ec94 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:54:43 +0200 Subject: Adding upstream version 43.9. Signed-off-by: Daniel Baumann --- src/shell-square-bin.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/shell-square-bin.c (limited to 'src/shell-square-bin.c') diff --git a/src/shell-square-bin.c b/src/shell-square-bin.c new file mode 100644 index 0000000..06587fb --- /dev/null +++ b/src/shell-square-bin.c @@ -0,0 +1,43 @@ +#include "config.h" + +#include "shell-square-bin.h" + +struct _ShellSquareBin +{ + /*< private >*/ + StBin parent_instance; +}; + +G_DEFINE_TYPE (ShellSquareBin, shell_square_bin, ST_TYPE_BIN); + +static void +shell_square_bin_get_preferred_width (ClutterActor *actor, + float for_height, + float *min_width_p, + float *natural_width_p) +{ + float min_width, nat_width; + + /* Return the actual height to keep the squared aspect */ + clutter_actor_get_preferred_height (actor, -1, + &min_width, &nat_width); + + if (min_width_p) + *min_width_p = min_width; + + if (natural_width_p) + *natural_width_p = nat_width; +} + +static void +shell_square_bin_init (ShellSquareBin *self) +{ +} + +static void +shell_square_bin_class_init (ShellSquareBinClass *klass) +{ + ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); + + actor_class->get_preferred_width = shell_square_bin_get_preferred_width; +} -- cgit v1.2.3