Bug 1419460 - search XDG_CURRENT_DESKTOP for desktop environment type substring, r?jhorak
We need apply various titlebar/border configuration which is based on active
window manager and desktop type. The XDG_CURRENT_DESKTOP shell variable contains active
desktop environment which we use at GetCSDSupportLevel().
Unfortunately Ubuntu adds "ubuntu:" prefix at XDG_CURRENT_DESKTOP so we can't do
plain string compare but rather search for DE substring at GetCSDSupportLevel().
MozReview-Commit-ID: GmAZ30p47eI
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6937,31 +6937,31 @@ nsWindow::DoDrawTitlebar() const
nsWindow::CSDSupportLevel
nsWindow::GetCSDSupportLevel() {
if (sCSDSupportLevel != CSD_SUPPORT_UNKNOWN) {
return sCSDSupportLevel;
}
const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
if (currentDesktop) {
- if (strcmp(currentDesktop, "GNOME") == 0) {
+ if (strstr(currentDesktop, "GNOME") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_FULL;
- } else if (strcmp(currentDesktop, "XFCE") == 0) {
+ } else if (strstr(currentDesktop, "XFCE") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_FLAT;
- } else if (strcmp(currentDesktop, "X-Cinnamon") == 0) {
+ } else if (strstr(currentDesktop, "X-Cinnamon") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_FULL;
- } else if (strcmp(currentDesktop, "KDE") == 0) {
+ } else if (strstr(currentDesktop, "KDE") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_FLAT;
- } else if (strcmp(currentDesktop, "LXDE") == 0) {
+ } else if (strstr(currentDesktop, "LXDE") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_FLAT;
- } else if (strcmp(currentDesktop, "openbox") == 0) {
+ } else if (strstr(currentDesktop, "openbox") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_FLAT;
- } else if (strcmp(currentDesktop, "i3") == 0) {
+ } else if (strstr(currentDesktop, "i3") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_NONE;
- } else if (strcmp(currentDesktop, "MATE") == 0) {
+ } else if (strstr(currentDesktop, "MATE") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_FLAT;
} else {
sCSDSupportLevel = CSD_SUPPORT_NONE;
}
}
return sCSDSupportLevel;
}