summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-14 15:07:14 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-14 15:07:14 +0000
commit08858eaea1898abd1850caa4fe4e1cb692953e73 (patch)
tree04a1043058b3158db1b762955095d5ef5d22ce50
parentbd7758006a76da32c6efc4420ed48e545a03650e (diff)
downloadmarex-dev-08858eaea1898abd1850caa4fe4e1cb692953e73.tar.gz
marex-dev-08858eaea1898abd1850caa4fe4e1cb692953e73.tar.bz2
group plugin: fixed group identifier creation
git-svn-id: file:///beryl/trunk@4062 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-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;