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

This commit is contained in:
pavlov%netscape.com 2000-06-09 21:13:31 +00:00
Родитель 42b098a06e
Коммит 3c63e65664
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -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;