diff --git a/ChangeLog b/ChangeLog index fa1f6e3d..ae59a036 100644 --- a/ChangeLog +++ b/ChangeLog @@ -111,6 +111,7 @@ Changes since version 0.80.2: - Do not use the disabled clip color for the clip's workspace navigation arrows when the clip is collapsed (it made them look like disabled) - Fixed the 'focus flicker' problem, seen with GTK2 applications. +- Fixed bug with incorrect un-escaping if there is a dot in wm_class. Changes since version 0.80.1: diff --git a/WINGs/wfont.c b/WINGs/wfont.c index a625d329..54af9df5 100644 --- a/WINGs/wfont.c +++ b/WINGs/wfont.c @@ -196,7 +196,8 @@ WMCreateFont(WMScreen *scrPtr, char *fontName) /* This is for back-compat (to allow reading of old xlfd descriptions) */ if (fontName[0]=='-' && (ptr = strchr(fontName, ','))) { - fname = wmalloc(ptr - fontName + 1); + // warn for deprecation + fname = wmalloc(ptr - fontName + 1); strncpy(fname, fontName, ptr - fontName); fname[ptr - fontName] = 0; } else { @@ -215,9 +216,11 @@ WMCreateFont(WMScreen *scrPtr, char *fontName) font->screen = scrPtr; + // remove printf("%s\n", fname); + if (fname[0] == '-') { - /* Backward compat thing. Remove in a later version */ + // Backward compat thing. Remove in a later version font->font = XftFontOpenXlfd(display, scrPtr->screen, fname); } else { font->font = XftFontOpenName(display, scrPtr->screen, fname); diff --git a/src/misc.c b/src/misc.c index 05954885..d3ddf523 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1124,7 +1124,6 @@ void UnescapeWM_CLASS(char *str, char **name, char **class) { int i, j, k, dot; - Bool esc; j = strlen(str); *name = wmalloc(j); @@ -1133,53 +1132,36 @@ UnescapeWM_CLASS(char *str, char **name, char **class) **class = 0; /* separate string in 2 parts */ - esc = False; - dot = 0; + dot = -1; for (i = 0; i < j; i++) { - if (!esc) { - if (str[i]=='\\') { - esc = True; - } else if (str[i]=='.') { - dot = i; - break; - } - } else { - esc = False; - } + if (str[i]=='\\') { + i++; + continue; + } else if (str[i]=='.') { + dot = i; + break; + } } /* unescape strings */ - esc = False; - k = 0; - for (i = 0; i < dot; i++) { - if (!esc) { - if (str[i]=='\\') { - esc = True; - } else { - (*name)[k++] = str[i]; - } - } else { - (*name)[k++] = str[i]; - esc = False; - } + for (i=0, k=0; i < dot; i++) { + if (str[i]=='\\') { + continue; + } else { + (*name)[k++] = str[i]; + } } (*name)[k] = 0; - esc = False; - k = 0; - for (i = dot+1; i