summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/group
diff options
context:
space:
mode:
authormarex <marex@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-14 20:22:43 +0000
committermarex <marex@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-14 20:22:43 +0000
commit067c0e4fbb2ddeba0d98f2428ebbf0206524d9b9 (patch)
treedf1138237fd70ec9b445e60d4e728c35fb00a15e /beryl-plugins/src/group
parent41e3702855017c65df46474afc189b173f6b1923 (diff)
downloadmarex-dev-067c0e4fbb2ddeba0d98f2428ebbf0206524d9b9.tar.gz
marex-dev-067c0e4fbb2ddeba0d98f2428ebbf0206524d9b9.tar.bz2
group: Static groups and autotabbing of all windows now works
git-svn-id: file:///beryl/trunk@4070 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/group')
-rw-r--r--beryl-plugins/src/group/group.c18
-rw-r--r--beryl-plugins/src/group/group.h10
-rw-r--r--beryl-plugins/src/group/init.c2
-rw-r--r--beryl-plugins/src/group/paint.c2
-rw-r--r--beryl-plugins/src/group/tab.c57
5 files changed, 82 insertions, 7 deletions
diff --git a/beryl-plugins/src/group/group.c b/beryl-plugins/src/group/group.c
index f9caa8a..622f95b 100644
--- a/beryl-plugins/src/group/group.c
+++ b/beryl-plugins/src/group/group.c
@@ -64,8 +64,7 @@ groupFindWindowIndex(CompWindow *w, GroupSelection *g)
* groupFindGroupByID
*
*/
-static GroupSelection*
-groupFindGroupByID(CompScreen *s, long int id)
+GroupSelection* groupFindGroupByID(CompScreen *s, long int id)
{
GroupSelection *group;
GROUP_SCREEN(s);
@@ -82,8 +81,7 @@ groupFindGroupByID(CompScreen *s, long int id)
* groupCheckWindowProperty
*
*/
-static Bool
-groupCheckWindowProperty(CompWindow *w, long int *id, Bool *tabbed)
+Bool groupCheckWindowProperty(CompWindow *w, long int *id, Bool *tabbed)
{
Atom type;
int fmt;
@@ -509,11 +507,17 @@ groupAddWindowToGroup(CompWindow * w, GroupSelection *group, long int initialIde
GroupSelection *tg;
Bool invalidID = FALSE;
+ g->identifier = gs->groups ? gs->groups->identifier : 0;
do {
- g->identifier = rand();
- for (tg = gs->groups; tg; tg = tg->next) {
- if (tg->identifier == g->identifier)
+ invalidID = FALSE;
+ for (tg = gs->groups; tg; tg = tg->next)
+ {
+ if (tg->identifier == g->identifier) {
invalidID = TRUE;
+
+ g->identifier++;
+ break;
+ }
}
} while (invalidID);
}
diff --git a/beryl-plugins/src/group/group.h b/beryl-plugins/src/group/group.h
index e313701..6a629e1 100644
--- a/beryl-plugins/src/group/group.h
+++ b/beryl-plugins/src/group/group.h
@@ -265,6 +265,10 @@ int displayPrivateIndex;
* PaintState
*/
+/* mask for screen wide actions executed in preparePaintScreen */
+#define CHECK_WINDOW_PROPERTIES (1 << 0)
+#define APPLY_AUTO_TABBING (1 << 1)
+
/* mask values for groupTabSetVisibility */
#define SHOW_BAR_INSTANTLY_MASK (1 << 0)
#define PERMANENT (1 << 1)
@@ -476,6 +480,9 @@ typedef struct _GroupScreen {
int prevX, prevY; //buffer for mouse coordinates
CompTexture glowTexture;
+
+ // pending screen wide actions
+ unsigned int screenActions;
} GroupScreen;
/*
@@ -527,6 +534,8 @@ Bool groupSetScreenOption(CompScreen * s, char *name, CompOptionValue * value);
* group.c
*/
void groupUpdateWindowProperty(CompWindow *w);
+GroupSelection* groupFindGroupByID(CompScreen *s, long int id);
+Bool groupCheckWindowProperty(CompWindow *w, long int *id, Bool *tabbed);
void groupGrabScreen(CompScreen * s, GroupScreenGrabState newState);
void groupHandleEvent(CompDisplay * d, XEvent * event);
Bool groupGroupWindows(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
@@ -555,6 +564,7 @@ Bool groupDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect);
* tab.c
*/
void groupHandleChanges(CompScreen* s);
+void groupHandleScreenActions(CompScreen *s);
void groupHandleHoverDetection(GroupSelection *group);
void groupHandleTabBarFade(GroupSelection *group, int msSinceLastPaint);
void groupHandleTextFade(GroupSelection *group, int msSinceLastPaint);
diff --git a/beryl-plugins/src/group/init.c b/beryl-plugins/src/group/init.c
index 4b29f7c..cc640cb 100644
--- a/beryl-plugins/src/group/init.c
+++ b/beryl-plugins/src/group/init.c
@@ -151,6 +151,8 @@ Bool groupInitScreen(CompPlugin * p, CompScreen * s)
gs->prevX = 0;
gs->prevY = 0;
+ gs->screenActions = (CHECK_WINDOW_PROPERTIES | APPLY_AUTO_TABBING);
+
gs->isRotating = FALSE;
/* gs->glowType is already initialized in groupScreenInitOptions */
diff --git a/beryl-plugins/src/group/paint.c b/beryl-plugins/src/group/paint.c
index 1d06f0a..eb74bba 100644
--- a/beryl-plugins/src/group/paint.c
+++ b/beryl-plugins/src/group/paint.c
@@ -584,6 +584,8 @@ void groupPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
groupHandleTextFade(group, msSinceLastPaint);
}
+ groupHandleScreenActions(s);
+
groupHandleChanges(s);
groupDrawTabAnimation(s, msSinceLastPaint);
diff --git a/beryl-plugins/src/group/tab.c b/beryl-plugins/src/group/tab.c
index 219c637..a9388a8 100644
--- a/beryl-plugins/src/group/tab.c
+++ b/beryl-plugins/src/group/tab.c
@@ -308,6 +308,63 @@ groupGetDrawOffsetForSlot(GroupTabBarSlot *slot, int *hoffset, int *voffset)
}
/*
+ * groupHandleScreenActions
+ *
+ * Description:
+ * This function handles some actions, which need to be applied
+ * on all windows but only once. This is needed for some stuff,
+ * which needs to be called on screen initial, but can't be called
+ * inside initScreen because it uses a WRAPED function.
+ * It's called from groupPreparePaintScreen.
+ *
+ */
+void groupHandleScreenActions(CompScreen *s)
+{
+ GROUP_SCREEN(s);
+
+ if (!gs->screenActions)
+ return;
+
+ CompWindow *w;
+ for(w = s->windows; w; w = w->next) {
+ GROUP_WINDOW(w);
+
+ if (gs->screenActions & CHECK_WINDOW_PROPERTIES)
+ {
+ Bool tabbed;
+ long int id;
+
+ /* read window property to see if window was grouped
+ before - if it was, regroup */
+ if (groupCheckWindowProperty(w, &id, &tabbed))
+ {
+ GroupSelection *group = groupFindGroupByID(w->screen, id);
+ groupAddWindowToGroup(w, group, id);
+ if (tabbed)
+ groupTabGroup(w);
+ }
+ }
+
+ if (gs->screenActions & APPLY_AUTO_TABBING)
+ {
+ if (gs->opt[GROUP_SCREEN_OPTION_AUTOTAB].value.b && !w->invisible && (w->type & gs->wMask))
+ {
+ if (!gw->group && (gw->windowState == WindowNormal)) {
+ groupAddWindowToGroup(w, NULL, 0);
+ groupTabGroup(w);
+ }
+ }
+ }
+ }
+
+ // clear up the pending actions
+ if (gs->screenActions & CHECK_WINDOW_PROPERTIES)
+ gs->screenActions &= ~CHECK_WINDOW_PROPERTIES;
+ if (gs->screenActions & APPLY_AUTO_TABBING)
+ gs->screenActions &= ~APPLY_AUTO_TABBING;
+}
+
+/*
* groupHandleHoverDetection
*
* Description: