kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=b65a31e3d43ddeec8e5c4d656b53a51f56394e19
commit b65a31e3d43ddeec8e5c4d656b53a51f56394e19 Author: Kim Woelders <[email protected]> Date: Mon May 4 18:50:35 2020 +0200 snaps: Fix snapshot group remembering when all groups are deleted When all groups were deleted from a window it would stop remembering group membership. Unfortunately this fix is not backwards compatible. If downgrading setups where some windows have multiple groups some group memberships will be lost. --- src/snaps.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/snaps.c b/src/snaps.c index b0fdf4d1..2b434775 100644 --- a/src/snaps.c +++ b/src/snaps.c @@ -1135,10 +1135,12 @@ SnapshotsSaveReal(void) if (sn->use_flags & SNAP_USE_SHADOW) fprintf(f, "SHADOW: %i\n", sn->shadow); #endif - if (sn->groups) + if (sn->use_flags & SNAP_USE_GROUPS) { + fprintf(f, "GROUP:"); for (j = 0; j < sn->num_groups; j++) - fprintf(f, "GROUP: %i\n", sn->groups[j]); + fprintf(f, " %i", sn->groups[j]); + fprintf(f, "\n"); } fprintf(f, "\n"); } @@ -1192,7 +1194,7 @@ _SnapshotsLoad(FILE * fs) continue; *s++ = '\0'; s = Estrtrim(s); - if (!buf[0] || !s[0]) + if (!buf[0]) continue; if (!strcmp(buf, "NEW")) { @@ -1348,11 +1350,17 @@ _SnapshotsLoad(FILE * fs) else if (!strcmp(buf, "GROUP")) { sn->use_flags |= SNAP_USE_GROUPS; - sn->num_groups++; - sn->groups = EREALLOC(int, sn->groups, sn->num_groups); - - sn->groups[sn->num_groups - 1] = atoi(s); - GroupRememberByGid(sn->groups[sn->num_groups - 1]); + for (;; s += b) + { + b = 0; + sscanf(s, "%d %n", &a, &b); + if (b <= 0) + break; + sn->num_groups++; + sn->groups = EREALLOC(int, sn->groups, sn->num_groups); + sn->groups[sn->num_groups - 1] = a; + GroupRememberByGid(a); + } } #if USE_COMPOSITE else if (!strcmp(buf, "OPACITY")) --
