From a80e5a8c39497f4874b9c6051bbc462f7f7988ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 24 Jan 2025 14:21:51 +0100 Subject: [PATCH 1/2] st/box-layout: Fix forwarding `vertical` changes Our code to "forward" `notify` signals from the underlying layout manager for the `vertical` property broke when ClutterLayoutManager removed its own `vertical` property. Property changes via the underlying layout manager should be rare, but still worth fixing, so explicitly connect to `notify::orientation` now. Part-of: --- src/st/st-box-layout.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index db174e40c8..059a81dd18 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -131,15 +131,12 @@ st_box_layout_style_changed (StWidget *self) } static void -layout_notify (GObject *object, - GParamSpec *pspec, - gpointer user_data) +on_layout_orientation_changed (GObject *object, + GParamSpec *pspec, + gpointer user_data) { - GObject *self = user_data; - const char *prop_name = g_param_spec_get_name (pspec); - - if (g_object_class_find_property (G_OBJECT_GET_CLASS (self), prop_name)) - g_object_notify (self, prop_name); + GObject *box = user_data; + g_object_notify_by_pspec (box, props[PROP_VERTICAL]); } static void @@ -153,7 +150,8 @@ on_layout_manager_notify (GObject *object, if (layout == NULL) return; - g_signal_connect (layout, "notify", G_CALLBACK (layout_notify), object); + g_signal_connect (layout, "notify::orientation", + G_CALLBACK (on_layout_orientation_changed), object); } static void -- GitLab From 0c20407f57f345453ae28114ad0d0cdc85920626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 24 Jan 2025 15:36:30 +0100 Subject: [PATCH 2/2] st/box-layout: Remove unnecessary notify We already notify via the `notify::orientation` handler on the layout manager, so there is no need to also do so from our own setter. Part-of: --- src/st/st-box-layout.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 059a81dd18..c77433e924 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -225,10 +225,7 @@ st_box_layout_set_vertical (StBoxLayout *box, : CLUTTER_ORIENTATION_HORIZONTAL; if (clutter_box_layout_get_orientation (CLUTTER_BOX_LAYOUT (layout)) != orientation) - { - clutter_box_layout_set_orientation (CLUTTER_BOX_LAYOUT (layout), orientation); - g_object_notify_by_pspec (G_OBJECT (box), props[PROP_VERTICAL]); - } + clutter_box_layout_set_orientation (CLUTTER_BOX_LAYOUT (layout), orientation); } /** -- GitLab