>From 0c0883bd9d8ab04f1bbdca15d7a3838dd6a897c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Wed, 6 Jun 2012 11:07:19 +0200
Subject: [PATCH 05/10] New function get_name_for_instance_class
The function get_name_for_icon is renamed to get_name_for_wwin.
The previous contents of get_name_for_icon are now at the new
function get_name_for_instance_class.
---
src/icon.c | 27 ++++++++++++++++-----------
src/icon.h | 3 ++-
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/icon.c b/src/icon.c
index 36b104b..55cd251 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -398,23 +398,28 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
return !error;
}
-char *get_name_for_icon(WWindow *wwin)
+char *get_name_for_wwin(WWindow *wwin)
+{
+ return get_name_for_instance_class(wwin->wm_instance, wwin->wm_class);
+}
+
+char *get_name_for_instance_class(char *wm_instance, char *wm_class)
{
char *suffix;
int len;
- if (wwin->wm_class && wwin->wm_instance) {
- len = strlen(wwin->wm_class) + strlen(wwin->wm_instance) + 2;
+ if (wm_class && wm_instance) {
+ len = strlen(wm_class) + strlen(wm_instance) + 2;
suffix = wmalloc(len);
- snprintf(suffix, len, "%s.%s", wwin->wm_instance,
wwin->wm_class);
- } else if (wwin->wm_class) {
- len = strlen(wwin->wm_class) + 1;
+ snprintf(suffix, len, "%s.%s", wm_instance, wm_class);
+ } else if (wm_class) {
+ len = strlen(wm_class) + 1;
suffix = wmalloc(len);
- snprintf(suffix, len, "%s", wwin->wm_class);
- } else if (wwin->wm_instance) {
- len = strlen(wwin->wm_instance) + 1;
+ snprintf(suffix, len, "%s", wm_class);
+ } else if (wm_instance) {
+ len = strlen(wm_instance) + 1;
suffix = wmalloc(len);
- snprintf(suffix, len, "%s", wwin->wm_instance);
+ snprintf(suffix, len, "%s", wm_instance);
} else {
return NULL;
}
@@ -530,7 +535,7 @@ char *wIconStore(WIcon * icon)
if (!dir_path)
return NULL;
- file = get_name_for_icon(wwin);
+ file = get_name_for_wwin(wwin);
if (!file) {
wfree(dir_path);
return NULL;
diff --git a/src/icon.h b/src/icon.h
index 7da3ef9..8c25025 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -68,7 +68,8 @@ Bool wIconChangeImageFile(WIcon *icon, char *file);
RImage * wIconValidateIconSize(WScreen *scr, RImage *icon, int max_size);
char * wIconStore(WIcon *icon);
-char *get_name_for_icon(WWindow *wwin);
+char *get_name_for_wwin(WWindow *wwin);
+char *get_name_for_instance_class(char *wm_instance, char *wm_class);
#ifdef NEWAPPICON
void wIconSetHighlited(WIcon *icon, Bool flag);
--
1.7.10
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 0c0883bd9d8ab04f1bbdca15d7a3838dd6a897c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Wed, 6 Jun 2012 11:07:19 +0200
Subject: [PATCH 05/10] New function get_name_for_instance_class
The function get_name_for_icon is renamed to get_name_for_wwin.
The previous contents of get_name_for_icon are now at the new
function get_name_for_instance_class.
---
src/icon.c | 27 ++++++++++++++++-----------
src/icon.h | 3 ++-
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/icon.c b/src/icon.c
index 36b104b..55cd251 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -398,23 +398,28 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
return !error;
}
-char *get_name_for_icon(WWindow *wwin)
+char *get_name_for_wwin(WWindow *wwin)
+{
+ return get_name_for_instance_class(wwin->wm_instance, wwin->wm_class);
+}
+
+char *get_name_for_instance_class(char *wm_instance, char *wm_class)
{
char *suffix;
int len;
- if (wwin->wm_class && wwin->wm_instance) {
- len = strlen(wwin->wm_class) + strlen(wwin->wm_instance) + 2;
+ if (wm_class && wm_instance) {
+ len = strlen(wm_class) + strlen(wm_instance) + 2;
suffix = wmalloc(len);
- snprintf(suffix, len, "%s.%s", wwin->wm_instance, wwin->wm_class);
- } else if (wwin->wm_class) {
- len = strlen(wwin->wm_class) + 1;
+ snprintf(suffix, len, "%s.%s", wm_instance, wm_class);
+ } else if (wm_class) {
+ len = strlen(wm_class) + 1;
suffix = wmalloc(len);
- snprintf(suffix, len, "%s", wwin->wm_class);
- } else if (wwin->wm_instance) {
- len = strlen(wwin->wm_instance) + 1;
+ snprintf(suffix, len, "%s", wm_class);
+ } else if (wm_instance) {
+ len = strlen(wm_instance) + 1;
suffix = wmalloc(len);
- snprintf(suffix, len, "%s", wwin->wm_instance);
+ snprintf(suffix, len, "%s", wm_instance);
} else {
return NULL;
}
@@ -530,7 +535,7 @@ char *wIconStore(WIcon * icon)
if (!dir_path)
return NULL;
- file = get_name_for_icon(wwin);
+ file = get_name_for_wwin(wwin);
if (!file) {
wfree(dir_path);
return NULL;
diff --git a/src/icon.h b/src/icon.h
index 7da3ef9..8c25025 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -68,7 +68,8 @@ Bool wIconChangeImageFile(WIcon *icon, char *file);
RImage * wIconValidateIconSize(WScreen *scr, RImage *icon, int max_size);
char * wIconStore(WIcon *icon);
-char *get_name_for_icon(WWindow *wwin);
+char *get_name_for_wwin(WWindow *wwin);
+char *get_name_for_instance_class(char *wm_instance, char *wm_class);
#ifdef NEWAPPICON
void wIconSetHighlited(WIcon *icon, Bool flag);
--
1.7.10