Skip to content

Commit

Permalink
Layout: Ignore NaN numbers when updating regions
Browse files Browse the repository at this point in the history
In Cinnamon 3.2, the "Window List with App Groups" applet
caused issues. The panel and windows wouldn't be clickable
anymore.

This was caused by NaN being returned by
let [x, y] = actorData.actor.get_transformed_position() and
let [w, h] = actorData.actor.get_transformed_size()

and an exception being thrown when doing:

let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h});

It's ok for the applet to fail if it references obsolete code
but it shoudn't affect Cinnamon as a whole.

When numbers are NaN, skip the actor altogether to ensure the regions
are being updated correctly.

Ideally we would log the issue, but this loop is too sensitive and
loops way too fast for that, it would make Cinnamon lag significantly
to do that.
  • Loading branch information
clefebvre committed Dec 22, 2016
1 parent 44bd23b commit fe790f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/ui/layout.js
Expand Up @@ -698,6 +698,14 @@ Chrome.prototype = {

let [x, y] = actorData.actor.get_transformed_position();
let [w, h] = actorData.actor.get_transformed_size();

if (isNaN(x) || isNaN(y) || isNaN(w) || isNaN(h)) {
// If the actor isn't giving us a valid size/position, skip it
// It would make the loop fail with an exception and affect the
// other actors
continue;
}

x = Math.round(x);
y = Math.round(y);
w = Math.round(w);
Expand Down

0 comments on commit fe790f2

Please sign in to comment.