Package: metacity / 1:2.34.3-4

11_remove_thumbnails.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
From 04ad17378e0f366dd503cf0881e3a3f9ae603699 Mon Sep 17 00:00:00 2001
From: Stéphane Démurget <stephane.demurget@free.fr>
Date: Tue, 18 Dec 2012 12:44:53 +0000
Subject: screen: Remove alt-tab thumbnails

gdk_pixbuf_scale_simple generates very nice thumbnails at the expense of
a very slow rendering. So slow that the alt-tab popup is not usable: it
needs 3.6 seconds to downscale 30 windows of dimension 1600x900 on an
fairly recent computer.

We remove the thumbnailing to makes alt-tab blazing fast again in the
composited mode.

https://bugzilla.gnome.org/show_bug.cgi?id=504729
---
diff --git a/src/core/screen.c b/src/core/screen.c
index 34dcdc3..52e020a 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1197,49 +1197,6 @@ meta_screen_update_cursor (MetaScreen *screen)
   XFreeCursor (screen->display->xdisplay, xcursor);
 }
 
-#define MAX_PREVIEW_SIZE 150.0
-
-static GdkPixbuf *
-get_window_pixbuf (MetaWindow *window,
-                   int        *width,
-                   int        *height)
-{
-  Pixmap pmap;
-  GdkPixbuf *pixbuf, *scaled;
-  double ratio;
-
-  pmap = meta_compositor_get_window_pixmap (window->display->compositor,
-                                            window);
-  if (pmap == None)
-    return NULL;
-
-  pixbuf = meta_ui_get_pixbuf_from_pixmap (pmap);
-  if (pixbuf == NULL) 
-    return NULL;
-
-  *width = gdk_pixbuf_get_width (pixbuf);
-  *height = gdk_pixbuf_get_height (pixbuf);
-
-  /* Scale pixbuf to max dimension MAX_PREVIEW_SIZE */
-  if (*width > *height)
-    {
-      ratio = ((double) *width) / MAX_PREVIEW_SIZE;
-      *width = (int) MAX_PREVIEW_SIZE;
-      *height = (int) (((double) *height) / ratio);
-    }
-  else
-    {
-      ratio = ((double) *height) / MAX_PREVIEW_SIZE;
-      *height = (int) MAX_PREVIEW_SIZE;
-      *width = (int) (((double) *width) / ratio);
-    }
-
-  scaled = gdk_pixbuf_scale_simple (pixbuf, *width, *height,
-                                    GDK_INTERP_BILINEAR);
-  g_object_unref (pixbuf);
-  return scaled;
-}
-                                         
 void
 meta_screen_ensure_tab_popup (MetaScreen      *screen,
                               MetaTabList      list_type,
@@ -1272,41 +1229,23 @@ meta_screen_ensure_tab_popup (MetaScreen      *screen,
     {
       MetaWindow *window;
       MetaRectangle r;
-      GdkPixbuf *win_pixbuf;
-      int width, height;
 
       window = tmp->data;
-      
+
+      /* Metacity used to generated a thumbnail of the window contents
+       * using gdk_pixbuf_simple_scale which is so slow with bilinear
+       * interpolation that it has been removed.
+       *
+       * The cairo downscale could have been an alternative, but the
+       * result is terrible ATM, so it is simply better to have the
+       * same user story as the non-composited case (no thumbnail).
+       *
+       * https://bugzilla.gnome.org/show_bug.cgi?id=504729
+       */
+
       entries[i].key = (MetaTabEntryKey) window->xwindow;
       entries[i].title = window->title;
-
-      win_pixbuf = get_window_pixbuf (window, &width, &height);
-      if (win_pixbuf == NULL)
-        entries[i].icon = g_object_ref (window->icon);
-      else
-        {
-          int icon_width, icon_height, t_width, t_height;
-#define ICON_OFFSET 6
-
-          icon_width = gdk_pixbuf_get_width (window->icon);
-          icon_height = gdk_pixbuf_get_height (window->icon);
-
-          t_width = width + ICON_OFFSET;
-          t_height = height + ICON_OFFSET;
-
-          entries[i].icon = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
-                                            t_width, t_height);
-          gdk_pixbuf_fill (entries[i].icon, 0x00000000);
-          gdk_pixbuf_copy_area (win_pixbuf, 0, 0, width, height,
-                                entries[i].icon, 0, 0);
-          g_object_unref (win_pixbuf);
-          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);
-        }
-                                
+      entries[i].icon = g_object_ref (window->icon);
       entries[i].blank = FALSE;
       entries[i].hidden = !meta_window_showing_on_its_workspace (window);
       entries[i].demands_attention = window->wm_state_demands_attention;
--
cgit v0.9.0.2