summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--beryl-plugins/src/group/group.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/beryl-plugins/src/group/group.c b/beryl-plugins/src/group/group.c
index 0118268..f9caa8a 100644
--- a/beryl-plugins/src/group/group.c
+++ b/beryl-plugins/src/group/group.c
@@ -488,11 +488,6 @@ groupAddWindowToGroup(CompWindow * w, GroupSelection *group, long int initialIde
g->ungroupState = UngroupNone;
g->tabBar = NULL;
- if (initialIdent)
- g->identifier = (long int) w->id;
- else
- g->identifier = initialIdent;
-
g->grabWindow = None;
g->grabMask = 0;
@@ -508,6 +503,21 @@ groupAddWindowToGroup(CompWindow * w, GroupSelection *group, long int initialIde
g->color[2] = rand() % 0xFFFF;
g->color[3] = 0xFFFF;
+ if (initialIdent)
+ g->identifier = initialIdent;
+ else {
+ GroupSelection *tg;
+ Bool invalidID = FALSE;
+
+ do {
+ g->identifier = rand();
+ for (tg = gs->groups; tg; tg = tg->next) {
+ if (tg->identifier == g->identifier)
+ invalidID = TRUE;
+ }
+ } while (invalidID);
+ }
+
// relink stack
if (gs->groups) {
gs->groups->prev = g;