Bug 1419460 - search XDG_CURRENT_DESKTOP for desktop environment type substring, r?jhorak draft
authorMartin Stransky <stransky@redhat.com>
Thu, 23 Nov 2017 14:01:35 +0100
changeset 705007 8a5ba59b17b1f9d1c81614bfaebb7a933a2d45ca
parent 702588 b6bed1b710c3e22cab49f22f1b5f44d80286bcb9
child 742219 d30ef0841d3ad70afa4fb6b44f3c3acd8f6c8811
push id91316
push userstransky@redhat.com
push dateWed, 29 Nov 2017 09:12:29 +0000
reviewersjhorak
bugs1419460
milestone59.0a1
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
widget/gtk/nsWindow.cpp
--- 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;
 }