[libwnck/wip/muktupavels/icon-cache-cleanup: 2/5] xutils: replace width and height with size in get_fallback_icons




commit daad23cb82efdd3c5c769e7fd2847bb1b0a8ea9a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri May 7 22:56:08 2021 +0300

    xutils: replace width and height with size in get_fallback_icons
    
    Function is always used with same value for width and height. Replace
    with single parameter.

 libwnck/class-group.c |  2 --
 libwnck/tasklist.c    |  4 ++--
 libwnck/xutils.c      | 30 ++++++++++--------------------
 libwnck/xutils.h      | 12 ++++--------
 4 files changed, 16 insertions(+), 32 deletions(-)
---
diff --git a/libwnck/class-group.c b/libwnck/class-group.c
index 72513b8..f4afc31 100644
--- a/libwnck/class-group.c
+++ b/libwnck/class-group.c
@@ -456,10 +456,8 @@ set_icon (WnckClassGroup *class_group)
   if (!icon || !mini_icon)
     {
       _wnck_get_fallback_icons (&icon,
-                                _wnck_get_default_icon_size (),
                                 _wnck_get_default_icon_size (),
                                 &mini_icon,
-                                _wnck_get_default_mini_icon_size (),
                                 _wnck_get_default_mini_icon_size ());
       icons_reffed = TRUE;
     }
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index f14ca62..95f062a 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -3498,8 +3498,8 @@ wnck_task_get_icon (WnckTask *task)
 
       if (pixbuf == NULL)
         {
-          _wnck_get_fallback_icons (NULL, 0, 0,
-                                    &pixbuf, MINI_ICON_SIZE, MINI_ICON_SIZE);
+          _wnck_get_fallback_icons (NULL, 0,
+                                    &pixbuf, MINI_ICON_SIZE);
         }
 #endif
       break;
diff --git a/libwnck/xutils.c b/libwnck/xutils.c
index d53f190..4617589 100644
--- a/libwnck/xutils.c
+++ b/libwnck/xutils.c
@@ -2304,10 +2304,8 @@ _wnck_read_icons (WnckScreen     *screen,
       icon_cache->origin < USING_FALLBACK_ICON)
     {
       _wnck_get_fallback_icons (iconp,
-                                ideal_size,
                                 ideal_size,
                                 mini_iconp,
-                                ideal_mini_size,
                                 ideal_mini_size);
 
       replace_cache (icon_cache, USING_FALLBACK_ICON,
@@ -2330,8 +2328,7 @@ _wnck_read_icons (WnckScreen     *screen,
 }
 
 static GdkPixbuf*
-default_icon_at_size (int width,
-                      int height)
+default_icon_at_size (int size)
 {
   GdkPixbuf *base;
 
@@ -2339,9 +2336,9 @@ default_icon_at_size (int width,
 
   g_assert (base);
 
-  if ((width < 0 && height < 0) ||
-      (gdk_pixbuf_get_width (base) == width &&
-       gdk_pixbuf_get_height (base) == height))
+  if ((size < 0) ||
+      (gdk_pixbuf_get_width (base) == size &&
+       gdk_pixbuf_get_height (base) == size))
     {
       return base;
     }
@@ -2350,9 +2347,9 @@ default_icon_at_size (int width,
       GdkPixbuf *scaled;
 
       scaled = gdk_pixbuf_scale_simple (base,
-                                        width > 0 ? width :
+                                        size > 0 ? size :
                                         gdk_pixbuf_get_width (base),
-                                        height > 0 ? height :
+                                        size > 0 ? size :
                                         gdk_pixbuf_get_height (base),
                                         GDK_INTERP_BILINEAR);
 
@@ -2364,26 +2361,19 @@ default_icon_at_size (int width,
 
 void
 _wnck_get_fallback_icons (GdkPixbuf **iconp,
-                          int         ideal_width,
-                          int         ideal_height,
+                          int         ideal_size,
                           GdkPixbuf **mini_iconp,
-                          int         ideal_mini_width,
-                          int         ideal_mini_height)
+                          int         ideal_mini_size)
 {
   if (iconp)
-    *iconp = default_icon_at_size (ideal_width > 0 ? ideal_width :
-                                   (int) _wnck_get_default_icon_size (),
-                                   ideal_height > 0 ? ideal_height :
+    *iconp = default_icon_at_size (ideal_size > 0 ? ideal_size :
                                    (int) _wnck_get_default_icon_size ());
 
   if (mini_iconp)
-    *mini_iconp = default_icon_at_size (ideal_mini_width > 0 ? ideal_mini_width :
-                                        (int) _wnck_get_default_mini_icon_size (),
-                                        ideal_mini_height > 0 ? ideal_mini_height :
+    *mini_iconp = default_icon_at_size (ideal_mini_size > 0 ? ideal_mini_size :
                                         (int) _wnck_get_default_mini_icon_size ());
 }
 
-
 void
 _wnck_get_window_geometry (Screen *screen,
                           Window  xwindow,
diff --git a/libwnck/xutils.h b/libwnck/xutils.h
index b460bcf..e5ef85d 100644
--- a/libwnck/xutils.h
+++ b/libwnck/xutils.h
@@ -178,14 +178,10 @@ gboolean _wnck_read_icons (WnckScreen     *screen,
                            GdkPixbuf     **mini_iconp,
                            int             ideal_mini_size);
 
-void _wnck_get_fallback_icons (GdkPixbuf     **iconp,
-                               int             ideal_width,
-                               int             ideal_height,
-                               GdkPixbuf     **mini_iconp,
-                               int             ideal_mini_width,
-                               int             ideal_mini_height);
-
-
+void _wnck_get_fallback_icons (GdkPixbuf **iconp,
+                               int         ideal_size,
+                               GdkPixbuf **mini_iconp,
+                               int         ideal_mini_size);
 
 void _wnck_get_window_geometry (Screen *screen,
                                Window  xwindow,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]