libdockapp: Fix for missing windowname and one more.
- "Untitled window" appears in xfce4-wmdock-plugin's enumeration of dockapps using libdockapp. - Reference to string buffer that might not live long enough.
This commit is contained in:
parent
9f23c97912
commit
deb3acc132
|
@ -130,9 +130,11 @@ DACreateIcon(char *name, unsigned width, unsigned height, int argc, char **argv)
|
||||||
{
|
{
|
||||||
XClassHint *classHint;
|
XClassHint *classHint;
|
||||||
XWMHints *wmHints;
|
XWMHints *wmHints;
|
||||||
|
XTextProperty window_name;
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
unsigned long valueMask;
|
unsigned long valueMask;
|
||||||
char *resourceValue;
|
char *resourceValue;
|
||||||
|
char class[100];
|
||||||
|
|
||||||
if (!_daContext)
|
if (!_daContext)
|
||||||
_daContext = DAContextInit(argc, argv);
|
_daContext = DAContextInit(argc, argv);
|
||||||
|
@ -161,15 +163,19 @@ DACreateIcon(char *name, unsigned width, unsigned height, int argc, char **argv)
|
||||||
if (!_daContext->windowed) {
|
if (!_daContext->windowed) {
|
||||||
classHint->res_class = RES_CLASSNAME;
|
classHint->res_class = RES_CLASSNAME;
|
||||||
} else {
|
} else {
|
||||||
char class[100];
|
|
||||||
snprintf(class, 100, "%c%s", toupper(name[0]), name + 1);
|
snprintf(class, 100, "%c%s", toupper(name[0]), name + 1);
|
||||||
classHint->res_class = class;
|
classHint->res_class = class;
|
||||||
}
|
}
|
||||||
classHint->res_name = name;
|
classHint->res_name = name;
|
||||||
|
|
||||||
XSetClassHint(DADisplay, DALeader, classHint);
|
XSetClassHint(DADisplay, DALeader, classHint);
|
||||||
XFree(classHint);
|
XFree(classHint);
|
||||||
|
|
||||||
|
/* Set WMName */
|
||||||
|
if (XStringListToTextProperty(&name, 1, &window_name) == 0)
|
||||||
|
printf("%s: can't allocate window name.\n",
|
||||||
|
_daContext->programName), exit(1);
|
||||||
|
XSetWMName(DADisplay, DALeader, &window_name);
|
||||||
|
|
||||||
/* Set WMHints */
|
/* Set WMHints */
|
||||||
wmHints = XAllocWMHints();
|
wmHints = XAllocWMHints();
|
||||||
if (!wmHints)
|
if (!wmHints)
|
||||||
|
|
Loading…
Reference in a new issue