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 614905 - Fix Clutter warnings
Fix Clutter warnings
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-04-05 20:06 UTC by Maxim Ermilov
Modified: 2010-05-06 08:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix Clutter warnings (3.75 KB, patch)
2010-04-05 20:06 UTC, Maxim Ermilov
none Details | Review
[workspaces] Split out workspace indicator into separate class (10.61 KB, patch)
2010-04-09 20:45 UTC, Colin Walters
none Details | Review
[altTab] Fix clutter warning (2.28 KB, patch)
2010-04-09 21:02 UTC, Colin Walters
needs-work Details | Review
Fix Clutter warnings in altTab.js (7.41 KB, patch)
2010-04-18 14:42 UTC, Maxim Ermilov
needs-work Details | Review
Fix Clutter warnings in altTab.js (8.00 KB, patch)
2010-04-18 17:18 UTC, Maxim Ermilov
needs-work Details | Review
Fix Clutter warnings in altTab.js (9.19 KB, patch)
2010-04-18 21:01 UTC, Maxim Ermilov
committed Details | Review
[workspaces] Split out workspace indicator into separate class (12.26 KB, patch)
2010-04-23 01:26 UTC, Maxim Ermilov
none Details | Review
[workspaces] Split out workspace indicator into separate class (11.54 KB, patch)
2010-04-23 17:18 UTC, Maxim Ermilov
reviewed Details | Review
[workspaces] Split out workspace indicator into separate class (11.42 KB, patch)
2010-04-26 15:07 UTC, Maxim Ermilov
committed Details | Review

Description Maxim Ermilov 2010-04-05 20:06:04 UTC
Created attachment 157998 [details] [review]
Fix Clutter warnings

A lot of warnings appear after switch to Clutter 1.2.
Comment 1 Owen Taylor 2010-04-05 20:13:50 UTC
Review of attachment 157998 [details] [review]:

::: js/ui/lightbox.js
@@ +63,2 @@
     _allocationChanged : function(container, box, flags) {
+        Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {

A BEFORE_REDRAW idle will run before the redraw of the *next* frame, which means we'll draw one frame wrong, and then one frame right. Can we use a Shell.GenericContainer or would that be too annoying?
Comment 2 Maxim Ermilov 2010-04-05 20:28:39 UTC
(In reply to comment #1)
> Review of attachment 157998 [details] [review]:
> 
> ::: js/ui/lightbox.js
> @@ +63,2 @@
>      _allocationChanged : function(container, box, flags) {
> +        Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
> function() {
> 
> A BEFORE_REDRAW idle will run before the redraw of the *next* frame, which
> means we'll draw one frame wrong, and then one frame right. Can we use a
> Shell.GenericContainer or would that be too annoying?

In this place only with hack. (We cant query this._container.width/height in _getPreferredWidth/_getPreferredHeight)
Comment 3 Owen Taylor 2010-04-05 20:37:13 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Review of attachment 157998 [details] [review] [details]:
> > 
> > ::: js/ui/lightbox.js
> > @@ +63,2 @@
> >      _allocationChanged : function(container, box, flags) {
> > +        Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
> > function() {
> > 
> > A BEFORE_REDRAW idle will run before the redraw of the *next* frame, which
> > means we'll draw one frame wrong, and then one frame right. Can we use a
> > Shell.GenericContainer or would that be too annoying?
> 
> In this place only with hack. (We cant query this._container.width/height in
> _getPreferredWidth/_getPreferredHeight)

Yeah, I can't see any other way of doing it then the later_add for the specific case of the lightbox. Shouldn't really matter since resizing will only occur when the screen geometry changes - we aren't using the notification for the initial case. (I don't think.)
Comment 4 Colin Walters 2010-04-09 20:45:10 UTC
Created attachment 158325 [details] [review]
[workspaces] Split out workspace indicator into separate class

By simply using a St.BoxLayout, we avoid the positioning/allocation
hacks that the old code was doing which triggered a Clutter warning.
Comment 5 Colin Walters 2010-04-09 20:47:39 UTC
Comment on attachment 157998 [details] [review]
Fix Clutter warnings

Ok I split up this patch and committed the chunk just reviewed by Owen.  The altTab part needs to be reviewed, and I rewrote the workspaces one.
Comment 6 Colin Walters 2010-04-09 21:02:29 UTC
Created attachment 158327 [details] [review]
[altTab] Fix clutter warning
Comment 7 Maxim Ermilov 2010-04-09 21:23:33 UTC
Review of attachment 158325 [details] [review]:

::: js/ui/workspacesView.js
@@ +495,3 @@
+    _init: function() {
+        this.actor = new St.Bin();
+        this._container = new St.BoxLayout({ name: 'workspaceIndicatorArea' });

Size of _container will grow on low resolution and a lot of workspaces

@@ +545,3 @@
+    _onButtonClicked: function(actor, event) {
+        let index = this._container.get_children().indexOf(actor);
+        this.emit('activate', index);

1.need correct 'checked' property (In case click on active button)
2.Nobody listen for this event
Comment 8 drago01 2010-04-17 17:26:45 UTC
Review of attachment 158327 [details] [review]:

This seems to fix some warnings but at the cost of introducing a real bug see below.

::: js/ui/altTab.js
@@ +721,3 @@
         }
+        else if (this._scrollable){
+            this._scrollable = false;

I fail to see how this makes any sense ... in fact it breaks the handling of the gradients. (once you start scrolling they disappear). 

The point here was to hide them when no scrolling is needed.
Comment 9 Maxim Ermilov 2010-04-18 14:42:11 UTC
Created attachment 159010 [details] [review]
Fix Clutter warnings in altTab.js
Comment 10 drago01 2010-04-18 14:58:25 UTC
Review of attachment 159010 [details] [review]:

This fixes the warnings too, but the behavior isn't correct either.
The arrows are now on top rather than centered like they are supposed to be / where before the patch. (which looks kind of weird).
Comment 11 Maxim Ermilov 2010-04-18 15:43:07 UTC
(In reply to comment #10)
> This fixes the warnings too, but the behavior isn't correct either.

When warnings appear? (altTab work without warnings for me.)
Comment 12 drago01 2010-04-18 16:22:18 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > This fixes the warnings too, but the behavior isn't correct either.
> 
> When warnings appear? (altTab work without warnings for me.)

There are no warning ... I said it _fixes_ the warnings.

But the scroll arrows are broken (position is wrong; they should be centered vertically).
Comment 13 Maxim Ermilov 2010-04-18 17:18:59 UTC
Created attachment 159024 [details] [review]
Fix Clutter warnings in altTab.js
Comment 14 drago01 2010-04-18 19:27:00 UTC
Review of attachment 159024 [details] [review]:

Looks better and the arrows are at the correct position now, one small regression is still present though.

::: js/ui/altTab.js
@@ +512,3 @@
+        childBox.y2 = this.actor.height;
+        this._leftGradient.allocate(childBox, flags);
+        this._leftGradient.opacity = (this._highlighted != 0 && scrollable) ? 255 : 0;

This does not work like it should ... the reason this was done in scrollToLeft/Right before is that it should only be shown when scrolling in this direction is possible (one or more items are off screen at the left).

@@ +519,3 @@
+        childBox.y2 = this.actor.height;
+        this._rightGradient.allocate(childBox, flags);
+        this._rightGradient.opacity = (this._highlighted != this._items.length - 1 && scrollable) ? 255 : 0;

Same here.

@@ +593,3 @@
         Tweener.addTween(this._list, { anchor_x: x,
                                         time: POPUP_SCROLL_TIME,
+                                        transition: 'easeOutQuad'

Is there a reason why we can't leave the onComplete handler here? 
Changing the anchor point shouldn't be triggering a re-layout so it should be safe (i.e does not cause the warning).
Comment 15 drago01 2010-04-18 19:27:02 UTC
Review of attachment 159024 [details] [review]:

Looks better and the arrows are at the correct position now, one small regression is still present though.

::: js/ui/altTab.js
@@ +512,3 @@
+        childBox.y2 = this.actor.height;
+        this._leftGradient.allocate(childBox, flags);
+        this._leftGradient.opacity = (this._highlighted != 0 && scrollable) ? 255 : 0;

This does not work like it should ... the reason this was done in scrollToLeft/Right before is that it should only be shown when scrolling in this direction is possible (one or more items are off screen at the left).

@@ +519,3 @@
+        childBox.y2 = this.actor.height;
+        this._rightGradient.allocate(childBox, flags);
+        this._rightGradient.opacity = (this._highlighted != this._items.length - 1 && scrollable) ? 255 : 0;

Same here.

@@ +593,3 @@
         Tweener.addTween(this._list, { anchor_x: x,
                                         time: POPUP_SCROLL_TIME,
+                                        transition: 'easeOutQuad'

Is there a reason why we can't leave the onComplete handler here? 
Changing the anchor point shouldn't be triggering a re-layout so it should be safe (i.e does not cause the warning).
Comment 16 drago01 2010-04-18 19:28:25 UTC
(In reply to comment #15)
> Review of attachment 159024 [details] [review]:
> 
> Looks better and the arrows are at the correct position now, one small
> regression is still present though.
> 
> ::: js/ui/altTab.js
> @@ +512,3 @@
> +        childBox.y2 = this.actor.height;
> +        this._leftGradient.allocate(childBox, flags);
> +        this._leftGradient.opacity = (this._highlighted != 0 && scrollable) ?
> 255 : 0;
> 
> This does not work like it should ... the reason this was done in
> scrollToLeft/Right before is that it should only be shown when scrolling in
> this direction is possible (one or more items are off screen at the left).
> 
> @@ +519,3 @@
> +        childBox.y2 = this.actor.height;
> +        this._rightGradient.allocate(childBox, flags);
> +        this._rightGradient.opacity = (this._highlighted != this._items.length
> - 1 && scrollable) ? 255 : 0;
> 
> Same here.
> 
> @@ +593,3 @@
>          Tweener.addTween(this._list, { anchor_x: x,
>                                          time: POPUP_SCROLL_TIME,
> +                                        transition: 'easeOutQuad'
> 
> Is there a reason why we can't leave the onComplete handler here? 
> Changing the anchor point shouldn't be triggering a re-layout so it should be
> safe (i.e does not cause the warning).

Ignore this; it seems to have been submitted twice (it is the same as the above comment).
Comment 17 Maxim Ermilov 2010-04-18 21:01:29 UTC
Created attachment 159037 [details] [review]
Fix Clutter warnings in altTab.js
Comment 18 drago01 2010-04-18 21:09:48 UTC
Review of attachment 159037 [details] [review]:

This one looks good, and does not seem to cause any regressions.
Comment 19 Maxim Ermilov 2010-04-23 01:26:11 UTC
Created attachment 159381 [details] [review]
[workspaces] Split out workspace indicator into separate class
Comment 20 Colin Walters 2010-04-23 02:40:44 UTC
Review of attachment 159381 [details] [review]:

One quick comment, I'll need to take a closer look tomorrow.  Thanks a lot for working on these patches though, getting rid of the clutter warnings will help debugging a lot.

::: js/ui/workspacesView.js
@@ +517,3 @@
+                return false;
+            }));
+        }));

The code reorganization here is an improvement, but I still don't like using the  reallocate -> idle -> reallocate cycle here.  I guess to do it in one cycle we'd basically need to draw the rectangles internally.

I won't say this is a blocker though.
Comment 21 Maxim Ermilov 2010-04-23 17:18:50 UTC
Created attachment 159454 [details] [review]
[workspaces] Split out workspace indicator into separate class

do reallocate (after resize) in one cycle.
Comment 22 Colin Walters 2010-04-25 23:14:57 UTC
Review of attachment 159454 [details] [review]:

Some small comments:

::: js/ui/workspacesView.js
@@ +507,3 @@
+}
+    this._init(activateWorkspace, workspaceAcceptDrop, scrollEventCb);
+function WorkspaceIndicator(activateWorkspace, workspaceAcceptDrop, scrollEventCb) {

This isn't the right way to use Main.initializeDeferredWork.  You should save the return string value, and then later when something changes, call Main.queueDeferredWork(this._workId);

Look at AllAppDisplay in js/ui/appDisplay.js.

@@ +540,3 @@
+
+    _allocate: function(actor, box, flags) {
+        actor.set_clip(box.x1, box.y1, box.x2, box.y2);

You could accomplish this by setting the "clip-to-allocation" Clutter.Actor property too.

@@ +559,3 @@
+        for (let i = 0; i < children.length; i++) {
+            if (!children[i].visible)
+                continue;

I'm not sure why we're testing for visibility here - as far as I see we never hide the actors, right?
Comment 23 Maxim Ermilov 2010-04-26 15:07:16 UTC
Created attachment 159613 [details] [review]
[workspaces] Split out workspace indicator into separate class
Comment 24 Colin Walters 2010-05-05 17:08:17 UTC
Review of attachment 159613 [details] [review]:

Looks fine, thanks!