Bug 1426384 - call gdk_window_set_decorations() on mShell GdkWindow only, r?jhorak
To have any effect we need to call gdk_window_set_decorations() on top-level GdkWindow only.
When rendering to mContainer the mGdkWindow belongs to mContainer so we need to get the window
from mShell explicitly.
MozReview-Commit-ID: KLKlVJbgg3
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -5090,42 +5090,49 @@ nsWindow::SetWindowDecoration(nsBorderSt
nsWindow *topWindow = get_window_for_gtk_widget(topWidget);
if (!topWindow)
return;
topWindow->SetWindowDecoration(aStyle);
return;
}
+ // We can't use mGdkWindow directly here as it can be
+ // derived from mContainer which is not a top-level GdkWindow.
+ GdkWindow *window = gtk_widget_get_window(mShell);
+
// Sawfish, metacity, and presumably other window managers get
// confused if we change the window decorations while the window
// is visible.
bool wasVisible = false;
- if (gdk_window_is_visible(mGdkWindow)) {
- gdk_window_hide(mGdkWindow);
+ if (gdk_window_is_visible(window)) {
+ gdk_window_hide(window);
wasVisible = true;
}
gint wmd = ConvertBorderStyles(aStyle);
if (wmd != -1)
- gdk_window_set_decorations(mGdkWindow, (GdkWMDecoration) wmd);
+ gdk_window_set_decorations(window, (GdkWMDecoration) wmd);
if (wasVisible)
- gdk_window_show(mGdkWindow);
+ gdk_window_show(window);
// For some window managers, adding or removing window decorations
// requires unmapping and remapping our toplevel window. Go ahead
// and flush the queue here so that we don't end up with a BadWindow
// error later when this happens (when the persistence timer fires
// and GetWindowPos is called)
#ifdef MOZ_X11
- XSync(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()) , False);
-#else
- gdk_flush ();
+ if (mIsX11Display) {
+ XSync(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()) , False);
+ } else
#endif /* MOZ_X11 */
+ {
+ gdk_flush ();
+ }
}
void
nsWindow::HideWindowChrome(bool aShouldHide)
{
SetWindowDecoration(aShouldHide ? eBorderStyle_none : mBorderStyle);
}