Bug 1420820 - Added MOZ_GTK_TITLEBAR_DECORATION to override window manager detection and set window decoration type, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Mon, 04 Dec 2017 15:19:00 +0100
changeset 394949 b9b43214fcdc2aa04368be5edc7ef00032f1224c
parent 394948 a726c48b254057c983e52c254a6fc169dd5e1981
child 394950 aaaa51a8bf64cde9a2a47647902518502d3dd88e
push id97987
push usernerli@mozilla.com
push dateTue, 05 Dec 2017 13:52:50 +0000
treeherdermozilla-inbound@8842dba7396b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1420820
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 1420820 - Added MOZ_GTK_TITLEBAR_DECORATION to override window manager detection and set window decoration type, r=jhorak Enables override window manager default with those values: MOZ_GTK_TITLEBAR_DECORATION=none - Firefox does not mess with decoration MOZ_GTK_TITLEBAR_DECORATION=client - Firefox tries to disable titlebar rendering and draws shadows by client side decorations. MOZ_GTK_TITLEBAR_DECORATION=system - Firefox tries to disable titlebar rendering and leave system (window manager) to draw window decorations. MozReview-Commit-ID: G60QS3g1TD0
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6935,16 +6935,29 @@ nsWindow::DoDrawTitlebar() const
     return mIsCSDEnabled && mSizeState == nsSizeMode_Normal;
 }
 
 nsWindow::CSDSupportLevel
 nsWindow::GetCSDSupportLevel() {
     if (sCSDSupportLevel != CSD_SUPPORT_UNKNOWN) {
         return sCSDSupportLevel;
     }
+
+    const char* decorationOverride = getenv("MOZ_GTK_TITLEBAR_DECORATION");
+    if (decorationOverride) {
+        if (strcmp(decorationOverride, "none") == 0) {
+            sCSDSupportLevel = CSD_SUPPORT_NONE;
+        } else if (strcmp(decorationOverride, "client") == 0) {
+            sCSDSupportLevel = CSD_SUPPORT_FLAT;
+        } else if (strcmp(decorationOverride, "system") == 0) {
+            sCSDSupportLevel = CSD_SUPPORT_FULL;
+        }
+        return sCSDSupportLevel;
+    }
+
     const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
     if (currentDesktop) {
         if (strstr(currentDesktop, "GNOME") != nullptr) {
             sCSDSupportLevel = CSD_SUPPORT_FULL;
         } else if (strstr(currentDesktop, "XFCE") != nullptr) {
             sCSDSupportLevel = CSD_SUPPORT_FLAT;
         } else if (strstr(currentDesktop, "X-Cinnamon") != nullptr) {
             sCSDSupportLevel = CSD_SUPPORT_FULL;