Bug 1418829 - Add MATE entry to GetCSDSupportLevel(), use GDK_DECOR_BORDER with CSD_SUPPORT_FULL only, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Mon, 20 Nov 2017 14:30:57 +0100
changeset 437566 6918d12188310921765d004d97c41f92bb83a312
parent 437565 ff5a8099c8e3955079249cb716fb87893e785ab4
child 437567 d4904d92e8bb2cd4dbb7b628f496e96a9779a306
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersjhorak
bugs1418829
milestone59.0a1
Bug 1418829 - Add MATE entry to GetCSDSupportLevel(), use GDK_DECOR_BORDER with CSD_SUPPORT_FULL only, r=jhorak Adding MATE as FLAT as it does not support the shadow borders around the window. GDK_DECOR_BORDER decoration mode means that the window manager renders borders around the window. We want the border rendering for CSD_SUPPORT_FULL only which means the border looks like shadows. We don't wand WM to render solid/bold borders around main toplevel window. MozReview-Commit-ID: BdwHi0LJRGC
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6641,17 +6641,22 @@ nsWindow::SetNonClientMargins(LayoutDevi
 
 void
 nsWindow::SetDrawsInTitlebar(bool aState)
 {
   if (!mIsCSDAvailable || aState == mIsCSDEnabled)
       return;
 
   if (mShell) {
-      gint wmd = aState ? GDK_DECOR_BORDER : ConvertBorderStyles(mBorderStyle);
+      gint wmd;
+      if (aState) {
+          wmd = GetCSDSupportLevel() == CSD_SUPPORT_FULL ? GDK_DECOR_BORDER : 0;
+      } else {
+          wmd = ConvertBorderStyles(mBorderStyle);
+      }
       gdk_window_set_decorations(gtk_widget_get_window(mShell),
                                  (GdkWMDecoration) wmd);
   }
 
   mIsCSDEnabled = aState;
 }
 
 gint
@@ -6930,33 +6935,34 @@ nsWindow::DoDrawTitlebar() const
     return mIsCSDEnabled && mSizeState == nsSizeMode_Normal;
 }
 
 nsWindow::CSDSupportLevel
 nsWindow::GetCSDSupportLevel() {
     if (sCSDSupportLevel != CSD_SUPPORT_UNKNOWN) {
         return sCSDSupportLevel;
     }
-    // TODO: MATE
     const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
     if (currentDesktop) {
         if (strcmp(currentDesktop, "GNOME") == 0) {
             sCSDSupportLevel = CSD_SUPPORT_FULL;
         } else if (strcmp(currentDesktop, "XFCE") == 0) {
             sCSDSupportLevel = CSD_SUPPORT_FULL;
         } else if (strcmp(currentDesktop, "X-Cinnamon") == 0) {
             sCSDSupportLevel = CSD_SUPPORT_FULL;
         } else if (strcmp(currentDesktop, "KDE") == 0) {
             sCSDSupportLevel = CSD_SUPPORT_FLAT;
         } else if (strcmp(currentDesktop, "LXDE") == 0) {
             sCSDSupportLevel = CSD_SUPPORT_FLAT;
         } else if (strcmp(currentDesktop, "openbox") == 0) {
             sCSDSupportLevel = CSD_SUPPORT_FLAT;
         } else if (strcmp(currentDesktop, "i3") == 0) {
             sCSDSupportLevel = CSD_SUPPORT_NONE;
+        } else if (strcmp(currentDesktop, "MATE") == 0) {
+            sCSDSupportLevel = CSD_SUPPORT_FLAT;
         } else {
             sCSDSupportLevel = CSD_SUPPORT_NONE;
         }
     }
     return sCSDSupportLevel;
 }
 
 int32_t