diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2011-10-01 15:53:57 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2011-10-01 15:53:57 +0000 |
| commit | 8e95ba0700562b196a461f54e1970b3fa427f18e (patch) | |
| tree | 7d1b9b4815f6a632f8a7547ed16be3c1802db639 /src | |
| parent | 8709753e1b9d3292a2dbf2bebde38777ea1eef71 (diff) | |
STR 2713: less restrictive XClass handling.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9110 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_x.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 360981ed8..83c68dd2a 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -1748,16 +1748,17 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap) // set the class property, which controls the icon used: if (win->xclass()) { char buffer[1024]; - char *p; const char *q; - // truncate on any punctuation, because they break XResource lookup: - for (p = buffer, q = win->xclass(); isalnum(*q)||(*q&128);) *p++ = *q++; - *p++ = 0; + const char *xclass = win->xclass(); + const int len = strlen(xclass); + // duplicate the xclass string for use as XA_WM_CLASS + strcpy(buffer, xclass); + strcpy(buffer + len + 1, xclass); // create the capitalized version: - q = buffer; - *p = toupper(*q++); if (*p++ == 'X') *p++ = toupper(*q++); - while ((*p++ = *q++)); + buffer[len + 1] = toupper(buffer[len + 1]); + if (buffer[len + 1] == 'X') + buffer[len + 2] = toupper(buffer[len + 2]); XChangeProperty(fl_display, xp->xid, XA_WM_CLASS, XA_STRING, 8, 0, - (unsigned char *)buffer, p-buffer-1); + (unsigned char *)buffer, len * 2 + 2); } if (win->non_modal() && xp->next && !fl_disable_transient_for) { |
