1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Fixed bug with incorrect un-escaping if there is a dot in wm_class.

This commit is contained in:
dan
2003-09-03 19:09:20 +00:00
parent 6aed0cd713
commit 847479b886
3 changed files with 27 additions and 41 deletions

View File

@@ -111,6 +111,7 @@ Changes since version 0.80.2:
- Do not use the disabled clip color for the clip's workspace navigation arrows - 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) when the clip is collapsed (it made them look like disabled)
- Fixed the 'focus flicker' problem, seen with GTK2 applications. - 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: Changes since version 0.80.1:

View File

@@ -196,7 +196,8 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
/* This is for back-compat (to allow reading of old xlfd descriptions) */ /* This is for back-compat (to allow reading of old xlfd descriptions) */
if (fontName[0]=='-' && (ptr = strchr(fontName, ','))) { if (fontName[0]=='-' && (ptr = strchr(fontName, ','))) {
fname = wmalloc(ptr - fontName + 1); // warn for deprecation
fname = wmalloc(ptr - fontName + 1);
strncpy(fname, fontName, ptr - fontName); strncpy(fname, fontName, ptr - fontName);
fname[ptr - fontName] = 0; fname[ptr - fontName] = 0;
} else { } else {
@@ -215,9 +216,11 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
font->screen = scrPtr; font->screen = scrPtr;
// remove
printf("%s\n", fname); printf("%s\n", fname);
if (fname[0] == '-') { 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); font->font = XftFontOpenXlfd(display, scrPtr->screen, fname);
} else { } else {
font->font = XftFontOpenName(display, scrPtr->screen, fname); font->font = XftFontOpenName(display, scrPtr->screen, fname);

View File

@@ -1124,7 +1124,6 @@ void
UnescapeWM_CLASS(char *str, char **name, char **class) UnescapeWM_CLASS(char *str, char **name, char **class)
{ {
int i, j, k, dot; int i, j, k, dot;
Bool esc;
j = strlen(str); j = strlen(str);
*name = wmalloc(j); *name = wmalloc(j);
@@ -1133,53 +1132,36 @@ UnescapeWM_CLASS(char *str, char **name, char **class)
**class = 0; **class = 0;
/* separate string in 2 parts */ /* separate string in 2 parts */
esc = False; dot = -1;
dot = 0;
for (i = 0; i < j; i++) { for (i = 0; i < j; i++) {
if (!esc) { if (str[i]=='\\') {
if (str[i]=='\\') { i++;
esc = True; continue;
} else if (str[i]=='.') { } else if (str[i]=='.') {
dot = i; dot = i;
break; break;
} }
} else {
esc = False;
}
} }
/* unescape strings */ /* unescape strings */
esc = False; for (i=0, k=0; i < dot; i++) {
k = 0; if (str[i]=='\\') {
for (i = 0; i < dot; i++) { continue;
if (!esc) { } else {
if (str[i]=='\\') { (*name)[k++] = str[i];
esc = True; }
} else {
(*name)[k++] = str[i];
}
} else {
(*name)[k++] = str[i];
esc = False;
}
} }
(*name)[k] = 0; (*name)[k] = 0;
esc = False; for (i=dot+1, k=0; i<j; i++) {
k = 0; if (str[i]=='\\') {
for (i = dot+1; i<j; i++) { continue;
if (!esc) { } else {
if (str[i]=='\\') { (*class)[k++] = str[i];
esc = True; }
} else {
(*class)[k++] = str[i];
}
} else {
esc = False;
}
} }
(*class)[k] = 0; (*class)[k] = 0;
if (!*name) { if (!*name) {
wfree(*name); wfree(*name);
*name = NULL; *name = NULL;