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
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6628,17 +6628,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
@@ -6917,33 +6922,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