diff options
| author | osch <oliver at luced de> | 2019-04-14 20:49:26 +0200 | 
|---|---|---|
| committer | lukefromdc <[email protected]> | 2019-04-23 18:35:39 +0000 | 
| commit | ea3dd08c34139afdc769bf1993a2a0d029f287a2 (patch) | |
| tree | deb58507b2ec92a10cce1a6350e532ea05e5b6eb | |
| parent | 6d7a203c0c920f14a647d8ce5cce36d45a31c8c8 (diff) | |
| download | marco-ea3dd08c34139afdc769bf1993a2a0d029f287a2.tar.bz2 marco-ea3dd08c34139afdc769bf1993a2a0d029f287a2.tar.xz | |
scale icon down if icon is larger than alt+tab preview thumbnail
| -rw-r--r-- | src/core/screen.c | 22 | 
1 files changed, 18 insertions, 4 deletions
| diff --git a/src/core/screen.c b/src/core/screen.c index 9b084bcf..8238d291 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1338,11 +1338,25 @@ meta_screen_ensure_tab_popup (MetaScreen      *screen,            gdk_pixbuf_copy_area (win_pixbuf, 0, 0, width, height,                                  entries[i].icon, 0, 0);            g_object_unref (win_pixbuf); +           +          double icon_scale   = 1.0; +          double max_coverage = 0.9; +           +          if (icon_width > t_width * max_coverage) +            icon_scale = (t_width * max_coverage) / icon_width; +             +          if (icon_height * icon_scale > t_height * max_coverage) +            icon_scale = (t_height * max_coverage) / icon_height; +           +          int t_icon_width  = (int)(icon_width  * icon_scale); +          int t_icon_height = (int)(icon_height * icon_scale); +                      gdk_pixbuf_composite (window->icon, entries[i].icon, -                                t_width - icon_width, t_height - icon_height, -                                icon_width, icon_height, -                                t_width - icon_width, t_height - icon_height, -                                1.0, 1.0, GDK_INTERP_BILINEAR, 255); +                                t_width  - t_icon_width,  +                                t_height - t_icon_height, +                                t_icon_width, t_icon_height, +                                t_width - t_icon_width, t_height - t_icon_height, +                                icon_scale, icon_scale, GDK_INTERP_BILINEAR, 255);          }        entries[i].blank = FALSE; | 
