]> Dogcows Code - chaz/openbox/blobdiff - openbox/focus_cycle_popup.c
set the alpha based on iconicness
[chaz/openbox] / openbox / focus_cycle_popup.c
index c00ee8407b5788d5785e42c8953007c7afc5cd7a..7d132b6ab55298f822104d59da82d131955f12e3 100644 (file)
@@ -74,14 +74,13 @@ static ObFocusCyclePopup popup;
 /*! This popup shows a single window */
 static ObIconPopup *single_popup;
 
-static gboolean cycle_iconic_windows;
-static gboolean cycle_all_desktops;
-static gboolean cycle_dock_windows;
-static gboolean cycle_desktop_windows;
-
 static gchar *popup_get_name (ObClient *c);
 static void   popup_setup    (ObFocusCyclePopup *p,
-                              gboolean create_targets);
+                              gboolean create_targets,
+                              gboolean iconic_windows,
+                              gboolean all_desktops,
+                              gboolean dock_windows,
+                              gboolean desktop_windows);
 static void   popup_render   (ObFocusCyclePopup *p,
                               const ObClient *c);
 
@@ -156,7 +155,9 @@ void focus_cycle_popup_shutdown(gboolean reconfig)
     RrAppearanceFree(popup.a_bg);
 }
 
-static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets)
+static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
+                        gboolean iconic_windows, gboolean all_desktops,
+                        gboolean dock_windows, gboolean desktop_windows)
 {
     gint maxwidth, n;
     GList *it;
@@ -174,10 +175,10 @@ static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets)
         ObClient *ft = it->data;
 
         if (focus_cycle_target_valid(ft,
-                                     cycle_iconic_windows,
-                                     cycle_all_desktops,
-                                     cycle_dock_windows,
-                                     cycle_desktop_windows))
+                                     iconic_windows,
+                                     all_desktops,
+                                     dock_windows,
+                                     desktop_windows))
         {
             gchar *text = popup_get_name(ft);
 
@@ -320,6 +321,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
         /* set up the hilite texture for the background */
         p->a_bg->texture[0].data.rgba.width = rgbaw;
         p->a_bg->texture[0].data.rgba.height = rgbah;
+        p->a_bg->texture[0].data.rgba.alpha = 0xff;
         p->hilite_rgba = g_new(RrPixel32, rgbaw * rgbah);
         p->a_bg->texture[0].data.rgba.data = p->hilite_rgba;
 
@@ -404,6 +406,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
             const gint row = i / icons_per_row; /* starting from 0 */
             const gint col = i % icons_per_row; /* starting from 0 */
             gint innerx, innery;
+            RrPixel32 *icon_data;
 
             /* find the dimensions of the icon inside it */
             innerx = icons_center_x + l + (col * ICON_SIZE);
@@ -419,12 +422,20 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
             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;
+            if (target->client->iconic)
+                /* 7/16 alpha */
+                p->a_icon->texture[0].data.rgba.alpha = (0xff>>1 - 0xff>>4);
+            else
+                p->a_icon->texture[0].data.rgba.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);
+
+            if (target->client->iconic)
+                g_free(icon_data);
         }
     }
 
@@ -444,13 +455,9 @@ void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows,
     g_assert(c != NULL);
 
     /* do this stuff only when the dialog is first showing */
-    if (!popup.mapped) {
-        cycle_iconic_windows = iconic_windows;
-        cycle_all_desktops = all_desktops;
-        cycle_dock_windows = dock_windows;
-        cycle_desktop_windows = desktop_windows;
-        popup_setup(&popup, TRUE);
-    }
+    if (!popup.mapped)
+        popup_setup(&popup, TRUE, iconic_windows, all_desktops,
+                    dock_windows, desktop_windows);
     g_assert(popup.targets != NULL);
 
     popup_render(&popup, c);
@@ -502,11 +509,8 @@ void focus_cycle_popup_single_show(struct _ObClient *c,
     if (!popup.mapped) {
         Rect *a;
 
-        cycle_iconic_windows = iconic_windows;
-        cycle_all_desktops = all_desktops;
-        cycle_dock_windows = dock_windows;
-        cycle_desktop_windows = desktop_windows;
-        popup_setup(&popup, FALSE);
+        popup_setup(&popup, FALSE, iconic_windows, all_desktops,
+                    dock_windows, desktop_windows);
         g_assert(popup.targets == NULL);
 
         /* position the popup */
This page took 0.022456 seconds and 4 git commands to generate.