]> Dogcows Code - chaz/openbox/blobdiff - openbox/focus_cycle_popup.c
look, thumbnails in alt-tab. its such crap though. oh well, just for fun.
[chaz/openbox] / openbox / focus_cycle_popup.c
index 477619f557c37afc448cc2abba1961cbb2d9672a..595fb9df752488caa76a0556787bf5880aaf0ec9 100644 (file)
@@ -397,6 +397,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
            they can pick up the hilite changes in the backgroud */
         if (!p->mapped || newtarget == target || p->last_target == target) {
             const ObClientIcon *icon;
+            ObClientIcon *thumb;
             const gint row = i / icons_per_row; /* starting from 0 */
             const gint col = i % icons_per_row; /* starting from 0 */
             gint innerx, innery;
@@ -412,17 +413,27 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
                               innerx, innery, innerw, innerh);
 
             /* get the icon from the client */
-            icon = client_icon(target->client, innerw, innerh);
-            p->a_icon->texture[0].data.rgba.width = icon->width;
-            p->a_icon->texture[0].data.rgba.height = icon->height;
-            p->a_icon->texture[0].data.rgba.alpha =
-                target->client->iconic ? OB_ICONIC_ALPHA : 0xff;
-            p->a_icon->texture[0].data.rgba.data = icon->data;
+            if ((thumb = client_thumbnail(target->client))) {
+                p->a_icon->texture[0].data.rgba.width = thumb->width;
+                p->a_icon->texture[0].data.rgba.height = thumb->height;
+                p->a_icon->texture[0].data.rgba.alpha =
+                    target->client->iconic ? OB_ICONIC_ALPHA : 0xff;
+                p->a_icon->texture[0].data.rgba.data = thumb->data;
+            } else {
+                icon = client_icon(target->client, innerw, innerh);
+                p->a_icon->texture[0].data.rgba.width = icon->width;
+                p->a_icon->texture[0].data.rgba.height = icon->height;
+                p->a_icon->texture[0].data.rgba.alpha =
+                    target->client->iconic ? OB_ICONIC_ALPHA : 0xff;
+                p->a_icon->texture[0].data.rgba.data = icon->data;
+            }
 
             /* draw the icon */
             p->a_icon->surface.parentx = innerx;
             p->a_icon->surface.parenty = innery;
             RrPaint(p->a_icon, target->win, innerw, innerh);
+
+            clienticon_free(thumb);
         }
     }
 
This page took 0.025413 seconds and 4 git commands to generate.