>From 785cc418238c78e9e5fc15793ecd669aba8a8394 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Mon, 1 Oct 2012 23:19:01 +0200
Subject: [PATCH 5/9] wIconCreate get the icon file name first
The function wIconCreate search the icon image calling wDefaultGetIconFile.
wDefaultGetIconFile search first the icon file name and then search the
image using the icon file name. wDefaultGetIconFile returns the icon image
to wIconCreate, then wIconCreate search the file name (again).
Is better that wIconCreate search first the file name, and then get
the image using the file name.
---
src/icon.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/icon.c b/src/icon.c
index a940123..efcc2b5 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -101,7 +101,7 @@ INLINE static void getSize(Drawable d, unsigned int *w,
unsigned int *h, unsigne
XGetGeometry(dpy, d, &rjunk, &xjunk, &yjunk, w, h, &bjunk, dep);
}
-WIcon *wIconCreate(WWindow * wwin)
+WIcon *wIconCreate(WWindow *wwin)
{
WScreen *scr = wwin->screen_ptr;
WIcon *icon;
@@ -126,12 +126,13 @@ WIcon *wIconCreate(WWindow * wwin)
#else
icon->show_title = 1;
#endif
- icon->file_image = wDefaultGetImage(scr, wwin->wm_instance,
wwin->wm_class, wPreferences.icon_size);
/* Get the application icon, default included */
- file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, True);
- if (file)
+ file = get_default_icon_filename(scr, wwin->wm_instance,
wwin->wm_class, NULL, True);
+ if (file) {
icon->file = wstrdup(file);
+ icon->file_image = get_default_icon_rimage(scr, icon->file,
wPreferences.icon_size);
+ }
icon->icon_name = wNETWMGetIconName(wwin->client_win);
if (icon->icon_name)
@@ -206,6 +207,10 @@ static WIcon *wIconCreateCore(WScreen *scr, int coord_x,
int coord_y)
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
icon->core->stacking->child_of = NULL;
+ /* Icon image */
+ icon->file = NULL;
+ icon->file_image = NULL;
+
return icon;
}
--
1.7.10.4
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 785cc418238c78e9e5fc15793ecd669aba8a8394 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Mon, 1 Oct 2012 23:19:01 +0200
Subject: [PATCH 5/9] wIconCreate get the icon file name first
The function wIconCreate search the icon image calling wDefaultGetIconFile.
wDefaultGetIconFile search first the icon file name and then search the
image using the icon file name. wDefaultGetIconFile returns the icon image
to wIconCreate, then wIconCreate search the file name (again).
Is better that wIconCreate search first the file name, and then get
the image using the file name.
---
src/icon.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/icon.c b/src/icon.c
index a940123..efcc2b5 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -101,7 +101,7 @@ INLINE static void getSize(Drawable d, unsigned int *w, unsigned int *h, unsigne
XGetGeometry(dpy, d, &rjunk, &xjunk, &yjunk, w, h, &bjunk, dep);
}
-WIcon *wIconCreate(WWindow * wwin)
+WIcon *wIconCreate(WWindow *wwin)
{
WScreen *scr = wwin->screen_ptr;
WIcon *icon;
@@ -126,12 +126,13 @@ WIcon *wIconCreate(WWindow * wwin)
#else
icon->show_title = 1;
#endif
- icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size);
/* Get the application icon, default included */
- file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, True);
- if (file)
+ file = get_default_icon_filename(scr, wwin->wm_instance, wwin->wm_class, NULL, True);
+ if (file) {
icon->file = wstrdup(file);
+ icon->file_image = get_default_icon_rimage(scr, icon->file, wPreferences.icon_size);
+ }
icon->icon_name = wNETWMGetIconName(wwin->client_win);
if (icon->icon_name)
@@ -206,6 +207,10 @@ static WIcon *wIconCreateCore(WScreen *scr, int coord_x, int coord_y)
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
icon->core->stacking->child_of = NULL;
+ /* Icon image */
+ icon->file = NULL;
+ icon->file_image = NULL;
+
return icon;
}
--
1.7.10.4