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 689316 - Strange issues with margins
Strange issues with margins
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-11-29 23:39 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-11-30 23:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
actor: Use fixed positioning for allocate_preferred_size (1.76 KB, patch)
2012-11-29 23:39 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-11-29 23:39:53 UTC
Margins may have weird creeping offsets, due to adjusted allocations.

Simple gjs testcase:

    const Clutter = imports.gi.Clutter;
    Clutter.init(null);
    
    let stage = new Clutter.Stage({ user_resizable: true });
    let container = new Clutter.Actor();
    container.set_margin(new Clutter.Margin({ top: 20, left: 20 }));
    stage.add_child(container);
    
    let box = new Clutter.Actor({ background_color: Clutter.Color.get_static(Clutter.StaticColor.RED),
                                  width: 100, height: 100 });
    container.add_child(box);
    
    stage.show();
    Clutter.main();

Attached patch fixes issues.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-11-29 23:39:55 UTC
Created attachment 230254 [details] [review]
actor: Use fixed positioning for allocate_preferred_size

clutter_actor_allocate_preferred_size is supposed to use the fixed
position of an actor. Unfortunately, recent refactorings made it so
that it accidentally used the current allocation. As the current
allocation may be adjusted by the actor, or have been previously
allocated in a strange spot, it may have unintended side effects. Use
the fixed positioning of the actor instead.

This fixes weird issues with margins colliding with
ClutterFixedLayout, causing strange offsets on relayout.
Comment 2 Emmanuele Bassi (:ebassi) 2012-11-30 23:07:35 UTC
Review of attachment 230254 [details] [review]:

looks okay; with one minor change, it can be committed.

::: clutter/clutter-actor.c
@@ +15105,3 @@
+  if (priv->position_set)
+    {
+      info = _clutter_actor_peek_layout_info (self);

use _clutter_actor_get_layout_info_or_defaults() instead, to avoid the NULL check.
Comment 3 Jasper St. Pierre (not reading bugmail) 2012-11-30 23:20:13 UTC
Attachment 230254 [details] pushed as 15b8118 - actor: Use fixed positioning for allocate_preferred_size


Pushed with suggested changes, thanks!