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 598030 - [AppSwitcher] Scale app icons down to fit on screen
[AppSwitcher] Scale app icons down to fit on screen
Status: RESOLVED DUPLICATE of bug 597983
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on: 597983
Blocks:
 
 
Reported: 2009-10-10 18:20 UTC by drago01
Modified: 2010-03-10 15:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[AppSwitcher] Scale app icons down to fit on screen (1.42 KB, patch)
2009-10-10 18:20 UTC, drago01
none Details | Review
[AppSwitcher] Scale app icons down to fit on screen (1.42 KB, patch)
2009-10-10 18:21 UTC, drago01
needs-work Details | Review
[AppSwitcher] Scale app icons down to fit on screen (1.93 KB, patch)
2009-10-25 10:30 UTC, drago01
needs-work Details | Review
[AppSwitcher] Scale app icons down to fit on screen (1.70 KB, patch)
2009-11-14 11:20 UTC, drago01
needs-work Details | Review
[AppSwitcher] Scale app icons down to fit on screen (3.86 KB, patch)
2010-02-27 22:53 UTC, drago01
none Details | Review
[AppSwitcher] Scale app icons down to fit on screen (3.85 KB, patch)
2010-02-27 23:02 UTC, drago01
none Details | Review
[AppSwitcher] Scale app icons down to fit on screen (3.83 KB, patch)
2010-03-02 19:54 UTC, drago01
none Details | Review

Description drago01 2009-10-10 18:20:36 UTC
Created attachment 145221 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

Scale the app icons down if nesserary to fit all icons on screen.
Comment 1 drago01 2009-10-10 18:21:37 UTC
Created attachment 145222 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

Fix comment.
Comment 2 Dan Winship 2009-10-19 20:30:52 UTC
Comment on attachment 145222 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

We want to use fixed icon sizes, to assure pretty rendering when drawing non-SVG icons. bug 590563 said:

 * All app icons must have the same width and height.  Select the largest value
from following list of icon size such that the application icons will fit onto
one row:
   [96, 64, 48, 32, 22]
Comment 3 drago01 2009-10-25 10:30:34 UTC
Created attachment 146199 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

Select the best fitting size from [96, 64, 48, 32, 22]
Comment 4 Dan Winship 2009-10-26 14:34:16 UTC
Comment on attachment 146199 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

>+        // Decide when to start scaling down, 18 is the padding used for the switcher list

You should read that out of the parsed CSS rather than hardcoding it here; look at the computation of arrowHeight in AppSwitcher's _allocate().

>+        let maxIcons = Math.floor((global.screen_width - 18 * 2) / ((POPUP_APPICON_SIZE + POPUP_LIST_SPACING * 2) * 2));

The math here is wrong. With N icons there will be N POPUP_APPICON_SIZEs but only N-1 POPUP_LIST_SPACINGs. Not sure what either of the final "* 2"s is for.

>+                let iconScale = POPUP_APPICON_SIZE * (maxIcons / apps.length);

This is also wrong, because the math isn't taking into account the fact that the icons will change size but the padding won't.

Don't compute it in terms of scaling. Just loop over iconSizes until you find a size that fits. Eg:

    let maxWidth = global.screen_width - totalPadding;
    for (let i = 0; i < iconSizes.length; i++) {
        let widthAtSize = apps.length * iconSizes[i] + (apps.length - 1) * POPUP_LIST_SPACING;
        if (widthAtSize <= maxWidth)
            ...

Also, we probably don't want the switcher to go all the way from 0 to screen_width, so subtract another totalPadding from maxWidth to leave a margin there.
Comment 5 drago01 2009-11-14 11:20:23 UTC
Created attachment 147716 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

Fixed up patch
Comment 6 Dan Winship 2009-11-16 19:27:03 UTC
Comment on attachment 147716 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

I get:

(mutter:7499): St-WARNING **: st_widget_get_theme_node called on a widget not in a stage

and then it measures the switcher incorrectly, extending it a bit off the screen before switching down to the next size.

Hardcoding totalPadding based on what it *should* be according to the CSS does not work either... it seems that the icon boxes are getting larger allocations than we'd expect.

Maybe AppSwitcher needs to override SwitcherList's GenericContainer implementations? Perhaps we shouldn't create the icons until right before they're drawn? Not totally sure what the best fix is.
Comment 7 drago01 2010-02-27 22:53:11 UTC
Created attachment 154866 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

OK, here is a new approach that should 

1) Not show any such warnings and 2) does not make any assumptions about how big the switcher would be.

It uses a "try and error" method which looks a bit odd at first, but is the only way I can think of (the amount of changes are small and it works just fine).
Comment 8 drago01 2010-02-27 23:02:27 UTC
Created attachment 154868 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

Small fix.
Comment 9 drago01 2010-03-02 19:54:41 UTC
Created attachment 155065 [details] [review]
[AppSwitcher] Scale app icons down to fit on screen

*) Rebase against patch in 597983 and add a dependency on that bug.
Comment 10 Dan Winship 2010-03-10 15:20:51 UTC
this has been merged with 597983 now right?
Comment 11 drago01 2010-03-10 15:26:55 UTC
(In reply to comment #10)
> this has been merged with 597983 now right?

Yes
Comment 12 drago01 2010-03-10 15:31:32 UTC

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