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 744883 - Window thumbnails can overlap when scaled
Window thumbnails can overlap when scaled
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: overview
3.15.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2015-02-21 04:53 UTC by Sebastian Keller
Modified: 2015-03-03 22:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot of overlapping thumbnails (894.35 KB, image/png)
2015-02-21 04:53 UTC, Sebastian Keller
  Details
fix that keeps the row height the same (1.52 KB, patch)
2015-02-21 04:55 UTC, Sebastian Keller
rejected Details | Review
video of the keep row height variant (1.06 MB, video/webm)
2015-02-21 04:56 UTC, Sebastian Keller
  Details
fix that scales each row properly (2.44 KB, patch)
2015-02-21 04:57 UTC, Sebastian Keller
none Details | Review
video of the scaling variant (1.00 MB, video/webm)
2015-02-21 04:57 UTC, Sebastian Keller
  Details
fix that scales each row properly [v2] (3.26 KB, patch)
2015-02-23 14:07 UTC, Sebastian Keller
none Details | Review
fix that scales each row properly [v3] (4.35 KB, patch)
2015-03-03 19:37 UTC, Sebastian Keller
committed Details | Review

Description Sebastian Keller 2015-02-21 04:53:28 UTC
Created attachment 297477 [details]
screenshot of overlapping thumbnails

Whenever any but the first row of the window thumbnails have to be scaled to fit the screen, it can happen, that thumbnails overlap each other. This is due to a bug in the computation of the window slots:

When calculating the y position of a row the scaling factor of that row is applied to the cumulative height of all previous rows rather than just to the current row. So if the previous rows are not scaled, this means the y position of the scaled row would be shifted up, resulting in overlapping thumbnails.

I'm going to attach patches for two different approaches to fix this and let the designers decide which one they prefer. I'll also attach videos showing each version, but it might be better to test the patches locally with a different number of windows.

(I prefer the one that keeps the row height, since having scaling, vertical and horizontal movement at the same time can seem a bit too much. Also the code is much simpler.)
Comment 1 Sebastian Keller 2015-02-21 04:55:14 UTC
Created attachment 297478 [details] [review]
fix that keeps the row height the same
Comment 2 Sebastian Keller 2015-02-21 04:56:18 UTC
Created attachment 297479 [details]
video of the keep row height variant
Comment 3 Sebastian Keller 2015-02-21 04:57:04 UTC
Created attachment 297480 [details] [review]
fix that scales each row properly
Comment 4 Sebastian Keller 2015-02-21 04:57:50 UTC
Created attachment 297481 [details]
video of the scaling variant
Comment 5 Sebastian Keller 2015-02-23 14:07:17 UTC
Created attachment 297646 [details] [review]
fix that scales each row properly [v2]

The designers seem to prefer the scaling variant and I also realized that the "keep row height" variant basically prevents vertical scaling from adjusting the height of the grid if that was required. So let's go with the "scaling" variant.

There was an issue with the vertical scaling in the "scaling" variant as well: The centering based on the too large height (= the reason for vertical scaling) was still happening when the grid was vertically scaled. This was basically undoing what the scaling trying to achieve. I've updated the patch to account for that.

That being said, I've never seen the vertical scaling case actually happening, even after trying this with >80 windows open.

The patch is visually identical to the previous one in the horizontal scaling case.
Comment 6 Sebastian Keller 2015-03-03 19:37:04 UTC
Created attachment 298475 [details] [review]
fix that scales each row properly [v3]

This version now considers that the spacing does not get scaled when calculating the additional scaling factor to prevent the overview overlapping the workspace switcher in situations with lots of open windows.
Comment 7 Florian Müllner 2015-03-03 21:29:09 UTC
Review of attachment 298475 [details] [review]:

"Also the previous code was not considering that the spacing does not get
scaled"

Out of scope for this bug, but that's something we might want to reconsider in the future? Increasing the proportion of whitespace as thumbnails get smaller and harder to read doesn't sound like the best strategy.

Anyway, I don't like how code that is already tricky and hard to read gets even trickier and harder to read, but I don't see any obvious way around this - the patch certainly looks correct. So just a style suggestion, up to you to change the code or push your original patch ...

::: js/ui/workspace.js
@@ +937,3 @@
+
+            if (additionalHorizontalScale < additionalVerticalScale) {
+                row.additionalScale = additionalHorizontalScale;

Is

    row.additionalScale = Math.min(additionalHorizontalScale, additionalVerticalScale);
    // Only consider excess vertical scaling for compensation
    compensation += Math.max(0, (additionalVerticalScale - additionalHorizontalScale) * row.height));

clearer than the if-else split?
Comment 8 Florian Müllner 2015-03-03 21:30:14 UTC
Review of attachment 297478 [details] [review]:

Alternative fix for the one we picked, so rejecting
Comment 9 Jasper St. Pierre (not reading bugmail) 2015-03-03 21:35:00 UTC
(In reply to Florian Müllner from comment #7)
> Review of attachment 298475 [details] [review] [review]:
> 
> "Also the previous code was not considering that the spacing does not get
> scaled"
> 
> Out of scope for this bug, but that's something we might want to reconsider
> in the future? Increasing the proportion of whitespace as thumbnails get
> smaller and harder to read doesn't sound like the best strategy.

It was the design choice at the time. I'd be fine to rework it, but the issue is that the thumbnails can get a little tight.
Comment 10 Sebastian Keller 2015-03-03 21:58:01 UTC
(In reply to Florian Müllner from comment #7)
> Review of attachment 298475 [details] [review] [review]:
> 
> "Also the previous code was not considering that the spacing does not get
> scaled"
> 
> Out of scope for this bug, but that's something we might want to reconsider
> in the future? Increasing the proportion of whitespace as thumbnails get
> smaller and harder to read doesn't sound like the best strategy.

That might require a better separation between horizontal and vertical scaling because it would look bad if there was different vertical spacing for a single row because it was horizontally scaled. But yeah, out of scope of this bug and really just a corner case, because usually there are not *that* many windows open. I just wanted to handle it a bit more cleanly while I was already touching that code.

> Anyway, I don't like how code that is already tricky and hard to read gets
> even trickier and harder to read, but I don't see any obvious way around
> this - the patch certainly looks correct. So just a style suggestion, up to
> you to change the code or push your original patch ...

Yeah, I already tried to be rather explicit with the variable names but I couldn't come up with something more readable either...
I have no strong opinion on your style suggestion. The code I've written seems a bit more explicit and clearer to me, but that's probably just because I wrote it and know what it is supposed to do.

Could you push the patch for me then? (Either with or without your style fix, whichever you prefer)
Comment 11 Florian Müllner 2015-03-03 22:01:05 UTC
Ah, I was assuming you had git access - pushed your patch unmodified then ...