raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=680dee1daf2a2942bcc08bc7724ffcc52743202a

commit 680dee1daf2a2942bcc08bc7724ffcc52743202a
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Sat Apr 25 14:44:23 2020 +0100

    efreet - work around conconforming apps putting startupwmclass in quotes
    
    riot does
    
    StartupWMClass="Riot"
    
    
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
    
    does not allow for quoting here. you can quote fields in an exec line
    - for shell and replacement purposes, but not other fields like this
    above. this is a workaround a broken app so matching window to desktop
    file works.
    
    @fix
---
 src/lib/efreet/efreet_desktop.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/lib/efreet/efreet_desktop.c b/src/lib/efreet/efreet_desktop.c
index f0c46d4c33..4e97dc1efb 100644
--- a/src/lib/efreet/efreet_desktop.c
+++ b/src/lib/efreet/efreet_desktop.c
@@ -777,7 +777,22 @@ efreet_desktop_application_fields_parse(Efreet_Desktop 
*desktop, Efreet_Ini *ini
     if (val) desktop->path = strdup(val);
 
     val = efreet_ini_string_get(ini, "StartupWMClass");
-    if (val) desktop->startup_wm_class = strdup(val);
+    if ((val) && (val[0]) && (val[1]))
+    {
+        size_t len = strlen(val);
+        if (((val[0] == '"')  && (val[len - 1] == '"') ) ||
+            ((val[0] == '\'') && (val[len - 1] == '\'')))
+        {
+            // fixup for some spec-violating apps that put startupwmclass
+            // in quotes... spec doesnt allow for this. just escapes.
+            char *tmpval = alloca(len - 1);
+            strncpy(tmpval, val + 1, len - 2);
+            tmpval[len - 2] = '\0';
+            desktop->startup_wm_class = strdup(tmpval);
+        }
+        else
+            desktop->startup_wm_class = strdup(val);
+    }
 
     val = efreet_ini_string_get(ini, "Categories");
     if (val)

-- 


Reply via email to