Bug 1426384 - call gdk_window_set_decorations() on mShell GdkWindow only, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Wed, 20 Dec 2017 16:31:13 +0100
changeset 448906 b8a34037609130830a104c73c61a8722e4fb5bd1
parent 448905 87289743490850225764cb0c0f65ea9ceb1e72b2
child 448907 c0f87918768e1f058a8b49b6ac55166002738a20
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1426384
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -5097,42 +5097,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);
 }