1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 14:42:29 +01:00

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.
This commit is contained in:
Rodolfo García Peñas (kix)
2012-06-06 11:07:19 +02:00
committed by Carlos R. Mafra
parent 9d3d34599f
commit cedf620543
2 changed files with 18 additions and 12 deletions

View File

@@ -398,23 +398,28 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
return !error; return !error;
} }
char *get_name_for_icon(WWindow *wwin) static 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; char *suffix;
int len; int len;
if (wwin->wm_class && wwin->wm_instance) { if (wm_class && wm_instance) {
len = strlen(wwin->wm_class) + strlen(wwin->wm_instance) + 2; len = strlen(wm_class) + strlen(wm_instance) + 2;
suffix = wmalloc(len); suffix = wmalloc(len);
snprintf(suffix, len, "%s.%s", wwin->wm_instance, wwin->wm_class); snprintf(suffix, len, "%s.%s", wm_instance, wm_class);
} else if (wwin->wm_class) { } else if (wm_class) {
len = strlen(wwin->wm_class) + 1; len = strlen(wm_class) + 1;
suffix = wmalloc(len); suffix = wmalloc(len);
snprintf(suffix, len, "%s", wwin->wm_class); snprintf(suffix, len, "%s", wm_class);
} else if (wwin->wm_instance) { } else if (wm_instance) {
len = strlen(wwin->wm_instance) + 1; len = strlen(wm_instance) + 1;
suffix = wmalloc(len); suffix = wmalloc(len);
snprintf(suffix, len, "%s", wwin->wm_instance); snprintf(suffix, len, "%s", wm_instance);
} else { } else {
return NULL; return NULL;
} }
@@ -485,7 +490,7 @@ char *wIconStore(WIcon * icon)
if (!dir_path) if (!dir_path)
return NULL; return NULL;
file = get_name_for_icon(wwin); file = get_name_for_wwin(wwin);
if (!file) { if (!file) {
wfree(dir_path); wfree(dir_path);
return NULL; return NULL;

View File

@@ -67,7 +67,8 @@ Bool wIconChangeImageFile(WIcon *icon, char *file);
RImage * wIconValidateIconSize(WScreen *scr, RImage *icon, int max_size); RImage * wIconValidateIconSize(WScreen *scr, RImage *icon, int max_size);
char * wIconStore(WIcon *icon); char *wIconStore(WIcon *icon);
char *get_name_for_instance_class(char *wm_instance, char *wm_class);
#ifdef NEWAPPICON #ifdef NEWAPPICON
void wIconSetHighlited(WIcon *icon, Bool flag); void wIconSetHighlited(WIcon *icon, Bool flag);