After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703810 - Make BoxLayout use a Clutter layout manager internally
Make BoxLayout use a Clutter layout manager internally
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on: 703808 703809
Blocks: 703811 704015
 
 
Reported: 2013-07-08 18:00 UTC by Florian Müllner
Modified: 2013-08-20 06:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
st: Make BoxLayout use a Clutter layout manager internally (23.41 KB, patch)
2013-07-08 18:00 UTC, Florian Müllner
committed Details | Review
st: Remove StBoxLayoutChild property getter (4.49 KB, patch)
2013-07-08 18:00 UTC, Florian Müllner
rejected Details | Review
st: Remove empty dispose/finalize methods from StBoxLayoutChild (1.42 KB, patch)
2013-07-08 18:00 UTC, Florian Müllner
committed Details | Review
st: Translate StBoxLayoutChild properties to ClutterBoxChild (4.63 KB, patch)
2013-07-08 18:00 UTC, Florian Müllner
reviewed Details | Review
st: Notify on BoxLayout property changes (1.49 KB, patch)
2013-07-08 18:00 UTC, Florian Müllner
committed Details | Review
st: Translate StBoxLayoutChild properties to ClutterBoxChild (6.16 KB, patch)
2013-07-08 20:01 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2013-07-08 18:00:07 UTC
See patches.

With the fixes in bug 703809, there shouldn't be any changes in behavior (tested this quite a bit, including classic mode).
Comment 1 Florian Müllner 2013-07-08 18:00:12 UTC
Created attachment 248642 [details] [review]
st: Make BoxLayout use a Clutter layout manager internally

With the BoxLayout containers in St and Mx and the ClutterBoxLayout
manager, we now have three more or less diverged implementations of
the same layout policy.

While removing StBoxLayout entirely in favor of ClutterLayoutManager
would be the fashionable thing to do, there are obvious drawbacks:

 - it is the only actor we have that implements the scrollable interface
 - it conveniently exposes its spacing property in CSS
 - last but not least, it is used all over the place

So do the next best thing and make our implementation use the
Clutter layout manager internally - that way, the change is
transparent to users, while we get to refer most of the tricky
bits to Clutter. win-win!
Comment 2 Florian Müllner 2013-07-08 18:00:17 UTC
Created attachment 248643 [details] [review]
st: Remove StBoxLayoutChild property getter

Nothing reads those properties now, so just kill the getter.
Comment 3 Florian Müllner 2013-07-08 18:00:21 UTC
Created attachment 248644 [details] [review]
st: Remove empty dispose/finalize methods from StBoxLayoutChild

If the only thing we do is chain up to the parent, there's no
point in not using the parent's implementation directly.
Comment 4 Florian Müllner 2013-07-08 18:00:26 UTC
Created attachment 248645 [details] [review]
st: Translate StBoxLayoutChild properties to ClutterBoxChild

With StBoxLayout using the Clutter layout manager, it will now respect
actors' expand/align properties. However for the change to be transparent,
we need to support the existing child meta properties as well. Do
this by simply translating them to the corresponding ClutterBoxChild
properties.
Comment 5 Florian Müllner 2013-07-08 18:00:31 UTC
Created attachment 248646 [details] [review]
st: Notify on BoxLayout property changes

We didn't do this before, but it might come in handy eventually,
so add change notifications.
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-07-08 18:05:45 UTC
Review of attachment 248642 [details] [review]:

We should potentially look at making StScrollView use a ClutterScrollActor in the future. Making that transparent as well would be cool.

This looks good to me.
Comment 7 Jasper St. Pierre (not reading bugmail) 2013-07-08 18:07:01 UTC
Review of attachment 248644 [details] [review]:

I have never understood this either.
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-07-08 18:08:36 UTC
Review of attachment 248645 [details] [review]:

Hm, not sure if I like this. Fiddling with the actor is dirty, but I feel it's less dirty than using something which ClutterBoxLayout will flat out ignore in some circumstances.

Marking reviewed as a "eh". Could be swayed either way.
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-07-08 18:13:53 UTC
Review of attachment 248643 [details] [review]:

Uh, this doesn't seem very GObject-friendly to me. I use these properties all the time in looking-glass debugging.
Comment 10 Jasper St. Pierre (not reading bugmail) 2013-07-08 18:15:01 UTC
Review of attachment 248646 [details] [review]:

::: src/st/st-box-layout.c
@@ +553,3 @@
+  const char *prop_name = g_param_spec_get_name (pspec);
+
+  if (g_object_class_find_property (G_OBJECT_GET_CLASS (self), prop_name))

Sort of nice that all the properties map out like that, though I suppose when things have been copy/pasted from Mx in two different ways, it's expected to happen.
Comment 11 Florian Müllner 2013-07-08 20:01:57 UTC
Created attachment 248654 [details] [review]
st: Translate StBoxLayoutChild properties to ClutterBoxChild

Translate properties in property_get() as well.


(In reply to comment #8)
> Hm, not sure if I like this. Fiddling with the actor is dirty, but I feel it's
> less dirty than using something which ClutterBoxLayout will flat out ignore in
> some circumstances.

One alternative would be to leave the properties as-is and then call a sync_properties() function from set_property() and constructed() to sync the corresponding ClutterLayoutMeta properties, but I'm not sure it's worth the extra code (not to mention that it would miss Clutter->St translation, in case someone starts to mess with the ClutterLayoutMeta props directly).

Another approach would be to remove StBoxLayoutChild altogether and adjust the monkey patching in environment.js instead (basically: change "let meta = this.get_child_meta(actor);" to "let meta = this.get_child_meta(actor) || this.layout_manager.get_child_meta(this, actor);". However I don't see how we can deal with differing default values and different alignment types in a non-ugly way in that case.

Long-term we should encourage a transition to the standard x-expand, x-align etc. properties, but I don't see a good reason for enforcing it now by breaking code all over the place (I have a similar set for StTable which is a lot less used, so I'm more open to requiring people to adjust code there (up to removing the widget altogether and port to Clutter.TableLayout directly))
Comment 12 Jasper St. Pierre (not reading bugmail) 2013-07-08 20:11:05 UTC
Review of attachment 248654 [details] [review]:

Assuming you've tested and it works fine, this is good.
Comment 13 Jasper St. Pierre (not reading bugmail) 2013-07-16 01:23:15 UTC
This doesn't seem to apply to master.
Comment 14 Florian Müllner 2013-08-20 06:40:51 UTC
Attachment 248642 [details] pushed as aa39475 - st: Make BoxLayout use a Clutter layout manager internally
Attachment 248644 [details] pushed as 741b204 - st: Remove empty dispose/finalize methods from StBoxLayoutChild
Attachment 248646 [details] pushed as 6a19b7c - st: Notify on BoxLayout property changes
Attachment 248654 [details] pushed as 144f7d6 - st: Translate StBoxLayoutChild properties to ClutterBoxChild