[Xfce4-commits] [xfce/xfwm4] 01/02: icons: Refactor getAppIcon()
noreply at xfce.org
noreply at xfce.org
Thu Jun 13 21:24:21 CEST 2019
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit 7218546be95e2badc1a34007c6fa84d3979d1bf5
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Thu Jun 13 21:17:03 2019 +0200
icons: Refactor getAppIcon()
There is no reason for `getAppIcon()` API to differ from its counterpart
`getClientIcon()`.
Use the same API so for both.
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
src/client.c | 2 +-
src/icons.c | 14 +++++++++-----
src/icons.h | 3 +--
src/tabwin.c | 6 ++----
4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/client.c b/src/client.c
index b808fbf..3bb7a7f 100644
--- a/src/client.c
+++ b/src/client.c
@@ -1499,7 +1499,7 @@ clientUpdateIconPix (Client *c)
if (size > 1)
{
- icon = getAppIcon (screen_info, c->window, size, size);
+ icon = getAppIcon (c, size, size);
if (icon)
{
for (i = 0; i < STATE_TOGGLED; i++)
diff --git a/src/icons.c b/src/icons.c
index ef47c08..f12feec 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -481,25 +481,29 @@ scaled_from_pixdata (guchar * pixdata, guint w, guint h, guint dest_w, guint des
}
GdkPixbuf *
-getAppIcon (ScreenInfo *screen_info, Window window, guint width, guint height)
+getAppIcon (Client *c, guint width, guint height)
{
+ ScreenInfo *screen_info;
XWMHints *hints;
Pixmap pixmap;
Pixmap mask;
guchar *pixdata;
guint w, h;
+ g_return_val_if_fail (c != NULL, NULL);
+
pixdata = NULL;
pixmap = None;
mask = None;
- if (read_rgb_icon (screen_info->display_info, window, width, height, &w, &h, &pixdata))
+ screen_info = c->screen_info;
+ if (read_rgb_icon (screen_info->display_info, c->window, width, height, &w, &h, &pixdata))
{
return scaled_from_pixdata (pixdata, w, h, width, height);
}
myDisplayErrorTrapPush (screen_info->display_info);
- hints = XGetWMHints (myScreenGetXDisplay(screen_info), window);
+ hints = XGetWMHints (myScreenGetXDisplay(screen_info), c->window);
myDisplayErrorTrapPopIgnored (screen_info->display_info);
if (hints)
@@ -526,7 +530,7 @@ getAppIcon (ScreenInfo *screen_info, Window window, guint width, guint height)
}
}
- getKDEIcon (screen_info->display_info, window, &pixmap, &mask);
+ getKDEIcon (screen_info->display_info, c->window, &pixmap, &mask);
if (pixmap != None)
{
GdkPixbuf *icon = try_pixmap_and_mask (screen_info, pixmap, mask, width, height);
@@ -582,7 +586,7 @@ getClientIcon (Client *c, guint width, guint height)
small_icon_size = MIN (width / 4, height / 4);
small_icon_size = MIN (small_icon_size, 48);
- small_icon = getAppIcon (screen_info, c->window, small_icon_size, small_icon_size);
+ small_icon = getAppIcon (c, small_icon_size, small_icon_size);
gdk_pixbuf_composite (small_icon, icon_pixbuf,
(width - small_icon_size) / 2, height - small_icon_size,
diff --git a/src/icons.h b/src/icons.h
index bccddea..b6323b8 100644
--- a/src/icons.h
+++ b/src/icons.h
@@ -35,8 +35,7 @@
#include "screen.h"
#include "client.h"
-GdkPixbuf *getAppIcon (ScreenInfo *,
- Window,
+GdkPixbuf *getAppIcon (Client *,
guint,
guint);
GdkPixbuf *getClientIcon (Client *,
diff --git a/src/tabwin.c b/src/tabwin.c
index 35dfba0..a12105c 100644
--- a/src/tabwin.c
+++ b/src/tabwin.c
@@ -735,16 +735,14 @@ computeTabwinData (ScreenInfo *screen_info, TabwinWidget *tabwin_widget)
}
else
{
- icon_pixbuf = getAppIcon (c->screen_info, c->window,
- tabwin->icon_size * tabwin->icon_scale,
+ icon_pixbuf = getAppIcon (c, tabwin->icon_size * tabwin->icon_scale,
tabwin->icon_size * tabwin->icon_scale);
}
}
else
{
/* No preview in list mode */
- icon_pixbuf = getAppIcon (c->screen_info, c->window,
- tabwin->icon_size * tabwin->icon_scale,
+ icon_pixbuf = getAppIcon (c, tabwin->icon_size * tabwin->icon_scale,
tabwin->icon_size * tabwin->icon_scale);
}
tabwin->icon_list = g_list_append(tabwin->icon_list, icon_pixbuf);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list