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

--HG--
extra : rebase_source : eeef51e7326bb8be6418554b07ce5791e988f02f
This commit is contained in:
Martin Stransky 2017-11-23 14:01:35 +01:00
Родитель 74d977ad2a
Коммит 28829e9356
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -6942,21 +6942,21 @@ nsWindow::GetCSDSupportLevel() {
}
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;