mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Fixed bug with incorrect un-escaping if there is a dot in wm_class.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
60
src/misc.c
60
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<j; i++) {
|
||||
if (!esc) {
|
||||
if (str[i]=='\\') {
|
||||
esc = True;
|
||||
} else {
|
||||
(*class)[k++] = str[i];
|
||||
}
|
||||
} else {
|
||||
esc = False;
|
||||
}
|
||||
for (i=dot+1, k=0; i<j; i++) {
|
||||
if (str[i]=='\\') {
|
||||
continue;
|
||||
} else {
|
||||
(*class)[k++] = str[i];
|
||||
}
|
||||
}
|
||||
(*class)[k] = 0;
|
||||
|
||||
|
||||
if (!*name) {
|
||||
wfree(*name);
|
||||
*name = NULL;
|
||||
|
||||
Reference in New Issue
Block a user