On Thu, 01 Nov 2012, BALATON Zoltan escribió:

> On Thu, 1 Nov 2012, Carlos R. Mafra wrote:
> >On Thu,  1 Nov 2012 at  1:09:52 +0100, Rodolfo García Peñas wrote:
> >>>The icons are now better, all with titles :-) The question is:
> >>>Should we use the window name in icons?
> >>
> >>Perhaps, do something like "use the icon name", but if it is
> >>NULL, "use the window name"?
> 
> According to the relevant standard this is what's intended:
> http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html
> 
> Regards,
> BALATON Zoltan

Patch is attached. Thanks for your replies.

kix

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 227b12f34911d99918be7a8e6e101c58ff3fb732 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Thu, 1 Nov 2012 12:00:51 +0100
Subject: [PATCH] wNETWMGetIconName set window name for unnamed icons

The function wNETWMGetIconName get the application icon name. If
the application don't set the icon name, then the title is empty.

Now wNETWMGetIconName gets the icon name, but if is empty, then
set the icon name using the window name (using wNETWMGetWindowName()).
---
 src/wmspec.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/wmspec.c b/src/wmspec.c
index 6bd51ce..6f1a6d5 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -1500,16 +1500,13 @@ int wNETWMGetPidForWindow(Window window)
 
 char *wNETWMGetWindowName(Window window)
 {
-	char *name;
-	char *ret;
+	char *name = NULL, *ret = NULL;
 	int size;
 
 	name = (char *)PropGetCheckProperty(window, net_wm_name, utf8_string, 0, 0, &size);
 	if (name) {
 		ret = wstrndup(name, size);
 		XFree(name);
-	} else {
-		ret = NULL;
 	}
 
 	return ret;
@@ -1517,16 +1514,17 @@ char *wNETWMGetWindowName(Window window)
 
 char *wNETWMGetIconName(Window window)
 {
-	char *name;
-	char *ret;
+	char *name = NULL, *ret = NULL;
 	int size;
 
+	/* Get the icon name */
 	name = (char *)PropGetCheckProperty(window, net_wm_icon_name, utf8_string, 0, 0, &size);
 	if (name) {
 		ret = wstrndup(name, size);
 		XFree(name);
 	} else {
-		ret = NULL;
+		/* Icon doesn't have name, using window name */
+		ret = wNETWMGetWindowName(window);
 	}
 
 	return ret;
-- 
1.7.10.4

Reply via email to