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 602221 - Improve the window sizing/layout in the workspace view
Improve the window sizing/layout in the workspace view
Status: RESOLVED DUPLICATE of bug 582650
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2009-11-17 17:42 UTC by Maxim Ermilov
Modified: 2012-08-28 20:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for this bug (11.32 KB, patch)
2009-11-17 17:42 UTC, Maxim Ermilov
none Details | Review
Screenshoot (89.34 KB, image/jpeg)
2009-11-17 17:43 UTC, Maxim Ermilov
  Details
Improve the window sizing/layout in the overlay. (11.35 KB, patch)
2009-12-17 15:32 UTC, Colin Walters
reviewed Details | Review

Description Maxim Ermilov 2009-11-17 17:42:52 UTC
Created attachment 147987 [details] [review]
Patch for this bug

At the beginning, divide window in to group. In group window should not overlap. 

Groups placement in slot.

Advantages:
1. If we have only one group, windows will be layout originaly
2. Reducing the required slots
Comment 1 Maxim Ermilov 2009-11-17 17:43:41 UTC
Created attachment 147988 [details]
Screenshoot
Comment 2 Owen Taylor 2009-11-24 17:05:59 UTC
It's hard to me to figure out what the idea of the patch is from reading the patch. Can you explain what you are trying to solve and the algorithm in more detail here?
Comment 3 Colin Walters 2009-12-17 15:32:02 UTC
Created attachment 149919 [details] [review]
Improve the window sizing/layout in the overlay.

(Updated to latest master 20294f2c9204087880e8d379e374789a31793f6a by me)
Comment 4 Colin Walters 2009-12-17 16:03:12 UTC
It looks like the algorithm is:

* Divide the windows into groups where the windows in the group don't intersect
* We use a number of slots which is equal to the number of groups
* For each slot, divide the windows inside that slot

Under which situations this is better/worse than the old way would need some more thought; on my netbook it's exactly the same since all windows on it are maximized (and thus overlap).  I'll need to try it on my home machine.
Comment 5 Colin Walters 2009-12-17 16:54:00 UTC
Review of attachment 149919 [details] [review]:

I'd still like to see a high level description of what problems you saw with the old system, and how this one is better.

Partial review follows:

::: js/ui/workspaces.js
@@ +892,3 @@
+                let ret = (x >= rect.x) && (x <= rect.x + rect.width);
+            function inner(rect, x, y) {
+        function intersect(w1, w2) {

This is inefficient; you're losing the short-circuiting effect that || provides.  You really want:

 return inner() || inner () || inner ()
  || inner ().

But:

@@ +898,3 @@
+                return ret;
+                ret = ret && (y >= rect.y) && (y <= rect.y + rect.height);
+            function inner(rect, x, y) {

There's a more efficient way to determine if two rectangles intersect;

return ! (r1.x + r1.width < r2.x || r1.y + r1.height < r2.y || r1.x > r2.x + r2.width || r1.y > r2.y + r2.height);

And actually, looking around a bit, there's a meta_rectangle_overlap method, so:

function intersect(w1, w2) {
    let r1 = new Meta.Rectangle();
    w1.get_outer_rect(r1);
    let r2 = new Meta.Rectangle();
    w2.get_outer_rect(r2);
    return r1.overlap(r2);
}

(You can find this as windows_overlap in mutter/src/core/windows.c)

@@ +915,3 @@
+            group.push(i);
+                continue;
+            if (used[i] !== undefined)

Likewise here:

 if (intersect) {
   b = intersect(...);
   if (b)
     break;
 }

I'd prefer "let intersecting = false;" rather than just "b" too.
Comment 6 Emmanuele Bassi (:ebassi) 2011-02-03 17:50:22 UTC
just a rough overview of why the current algorithm is not good: it allocates the same scaling factor to all windows on a workspace

using the same factor makes small windows really small; all distinguishing features of a window are blurred together into a white/grey-ish blob, and it makes them a hard target to hit - especially with crappy pointer devices. this also makes it look like *a lot* of space gets wasted; compare with OSX's exposé:

  http://www.flickr.com/photos/drkpnk/476322516/

obviously, these considerations do not apply to exactly one scenario: if you use only maximized windows; with only maximized windows the effect of the current algorithm are masked because the windows have all exactly the same size, and the scaling factor requires a bigger number of windows on the same workspace to make them small blobs.

I'll try attachment 149919 [details] [review], update it and try to address the issues Colin's review outlined.
Comment 7 Emmanuele Bassi (:ebassi) 2011-02-03 17:59:30 UTC
compare and contrast with the result of the current algorithm on my laptop; the primary panel is 1280x800, and the windows are various non homogeneous sizes:

  http://folks.o-hand.com/ebassi/overview.png
Comment 8 Florian Müllner 2011-02-03 18:55:34 UTC
(In reply to comment #6)
> just a rough overview of why the current algorithm is not good: it allocates
> the same scaling factor to all windows on a workspace

If I recall correctly the rationale was that a window's size in relation to others helps identifying windows (think of two editor windows, one maximized).
Comment 9 Florian Müllner 2011-02-03 18:59:28 UTC
(In reply to comment #7)
> compare and contrast with the result of the current algorithm on my laptop; the
> primary panel is 1280x800, and the windows are various non homogeneous sizes:
> 
>   http://folks.o-hand.com/ebassi/overview.png

The problem here is not so much the window positioning, but that we handle dual-monitor setups badly. Workspaces in the overview are based on the _screen_ size, which are scaled down to fit the monitor, wasting a huge amount of space above and below the workspace.

See bug 609258.
Comment 10 Emmanuele Bassi (:ebassi) 2011-02-03 19:59:14 UTC
(In reply to comment #9)
> (In reply to comment #7)
> > compare and contrast with the result of the current algorithm on my laptop; the
> > primary panel is 1280x800, and the windows are various non homogeneous sizes:
> > 
> >   http://folks.o-hand.com/ebassi/overview.png
> 
> The problem here is not so much the window positioning, but that we handle
> dual-monitor setups badly. Workspaces in the overview are based on the _screen_
> size, which are scaled down to fit the monitor, wasting a huge amount of space
> above and below the workspace.

that might be true, but I see the same waste - or, better, far too much wasted space - when I run with a single panel.

(In reply to comment #8)
> (In reply to comment #6)
> > just a rough overview of why the current algorithm is not good: it allocates
> > the same scaling factor to all windows on a workspace
> 
> If I recall correctly the rationale was that a window's size in relation to
> others helps identifying windows (think of two editor windows, one maximized).

it's not just shape: it's also content. a small window to start with will be easier to recognize against a bigger one. on the other hand, I agree: trying to maintain some regular ratio aids visual recognition.

a combined approach of bucketing the sizes - i.e. partitioning the set of sizes to various boxes with the same regular ratio - seems like the best compromise.
Comment 11 Owen Taylor 2011-02-03 20:11:34 UTC
(In reply to comment #8)
> (In reply to comment #6)
> > just a rough overview of why the current algorithm is not good: it allocates
> > the same scaling factor to all windows on a workspace
> 
> If I recall correctly the rationale was that a window's size in relation to
> others helps identifying windows (think of two editor windows, one maximized).

Wait a moment here, we don't use a constant scale between windows - each window is scaled up independently. Try creating a really small window and go to the overview. The only constraint is supposed to be that we never scale windows *up* that that seems broken in the latest version and we scale windows up by a small amount.
Comment 12 Florian Müllner 2012-08-28 20:41:18 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 582650 ***