fix for some window managers not setting the titlebar anymore. nsbeta2+ bug 41786. r=bryner

git-svn-id: svn://10.0.0.236/trunk@71917 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pavlov%netscape.com 2000-06-09 21:13:31 +00:00
parent bdb655cbc8
commit c0d3b2a3fa

View File

@ -1966,6 +1966,8 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsString& aTitle)
g_print("platformLen is %d\n", platformLen);
#endif
// maybe using XTextStyle would work as we want... i doubt it though.
status = XmbTextListToTextProperty(GDK_DISPLAY(), &platformText, 1, XCompoundTextStyle,
&prop);
@ -1977,6 +1979,30 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsString& aTitle)
XSetWMProperties(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(mShell->window),
&prop, &prop, NULL, 0, NULL, NULL, NULL);
// TWM sucks and doesn't support compound text.. argh
XTextProperty tmpProp;
status = XGetWMName(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(mShell->window),
&tmpProp);
if (status != Success) {
if (prop.value) // free from the previous attempt
XFree(prop.value);
int xret = XmbTextListToTextProperty(GDK_DISPLAY(), &platformText, 1, XStringStyle,
&prop);
if (xret == Success) {
XSetWMProperties(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(mShell->window),
&prop, &prop, NULL, 0, NULL, NULL, NULL);
} else {
// we're fucked, set it however we can.
gtk_window_set_title(GTK_WINDOW(mShell), nsAutoCString(aTitle));
}
} else {
if (tmpProp.value)
XFree(tmpProp.value);
}
if (prop.value)
XFree(prop.value);
nsMemory::Free(platformText);
// free properties list?
return NS_OK;