summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/group/group.h
blob: a715222a21b932f977b31bee0289c30eaada6f33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
#ifndef _GROUP_H
#define _GROUP_H

/**
 *
 * Beryl group plugin
 *
 * group.h
 *
 * Copyright : (C) 2006 by Patrick Niklaus, Roi Cohen, Danny Baumann
 * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com>
 *          Roi Cohen       <roico@beryl-project.org>
 *          Danny Baumann   <maniac@beryl-project.org>
 *
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 **/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <time.h>
#include <X11/Xlib.h>
#include <cairo-xlib-xrender.h>
#include <beryl.h>
#include <beryl_ipcs.h>
#include <beryl-text.h>
#include <X11/Xatom.h>

#include <math.h>
#include <limits.h>

#include "group_glow.h"

/*
 * Constants
 *
 */
#define PI 3.1415926535897

enum {
	GROUP_DISPLAY_OPTION_SELECT = 0,
	GROUP_DISPLAY_OPTION_SELECT_SINGLE,
	GROUP_DISPLAY_OPTION_GROUPING,
	GROUP_DISPLAY_OPTION_UNGROUPING,
	GROUP_DISPLAY_OPTION_REMOVING,
	GROUP_DISPLAY_OPTION_CLOSING,
	GROUP_DISPLAY_OPTION_IGNORE,
	GROUP_DISPLAY_OPTION_TABMODE,
	GROUP_DISPLAY_OPTION_CHANGE_TAB_LEFT,
	GROUP_DISPLAY_OPTION_CHANGE_TAB_RIGHT,
	GROUP_DISPLAY_OPTION_CHANGE_COLOR,
	GROUP_DISPLAY_OPTION_NUM
};

enum {
	GROUP_SCREEN_OPTION_TYPES = 0,
	GROUP_SCREEN_OPTION_OPACITY,
	GROUP_SCREEN_OPTION_SATURATION,
	GROUP_SCREEN_OPTION_BRIGHTNESS,
	GROUP_SCREEN_OPTION_GLOW,
	GROUP_SCREEN_OPTION_MOVE,
	GROUP_SCREEN_OPTION_RESIZE,
	GROUP_SCREEN_OPTION_RAISE,
	GROUP_SCREEN_OPTION_AUTO_UNGROUP,
	GROUP_SCREEN_OPTION_AUTO_GROUP,
	GROUP_SCREEN_OPTION_RELATIVE_DISTANCE,
	GROUP_SCREEN_OPTION_SELECTION_COLOR,
	GROUP_SCREEN_OPTION_LINE_COLOR,
	GROUP_SCREEN_OPTION_PRECISION,
	GROUP_SCREEN_OPTION_TABBING_SPEED,
	GROUP_SCREEN_OPTION_TABBING_TIMESTEP,
	GROUP_SCREEN_OPTION_THUMB_SIZE,
	GROUP_SCREEN_OPTION_BORDER_WIDTH,
	GROUP_SCREEN_OPTION_BORDER_RADIUS,
	GROUP_SCREEN_OPTION_TAB_BORDER_COLOR,
	GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR,
	GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR,
	GROUP_SCREEN_OPTION_TAB_STYLE,
	GROUP_SCREEN_OPTION_GLOW_SIZE,
	GROUP_SCREEN_OPTION_GLOW_TYPE,
	GROUP_SCREEN_OPTION_FADE_TIME,
	GROUP_SCREEN_OPTION_VISIBILITY_TIME,
	GROUP_SCREEN_OPTION_UNTAB_ON_CLOSE,
	GROUP_SCREEN_OPTION_TABBAR_FONTSIZE,
	GROUP_SCREEN_OPTION_FADE_TEXT_TIME,
	GROUP_SCREEN_OPTION_TABBAR_FONTCOLOR,
	GROUP_SCREEN_OPTION_TAB_CREATE_MIPMAPS,
	GROUP_SCREEN_OPTION_CHANGE_ANIMATION_TIME,
	GROUP_SCREEN_OPTION_TAB_DRAG_HOVER_TIME,
	GROUP_SCREEN_OPTION_TAB_DRAG_SPRING_K,
	GROUP_SCREEN_OPTION_TAB_DRAG_FRICTION,
	GROUP_SCREEN_OPTION_TAB_DRAG_Y_DISTANCE,
	GROUP_SCREEN_OPTION_TAB_DRAG_SPEED_LIMIT,
	GROUP_SCREEN_OPTION_SPRING_MODEL_ON_MOVE,
	GROUP_SCREEN_OPTION_AUTOTAB,
	GROUP_SCREEN_OPTION_DND_UNGROUP_WINDOW,
	GROUP_SCREEN_OPTION_RESIZE_UNMAXIMIZE,
	GROUP_SCREEN_OPTION_MINIMIZE_ALL,
	GROUP_SCREEN_OPTION_SHADE_ALL,
	GROUP_SCREEN_OPTION_NUM
};

/*
 * Helpers
 *
 */
#define GET_GROUP_DISPLAY(d) ((GroupDisplay *) (d)->privates[displayPrivateIndex].ptr)
#define GROUP_DISPLAY(d) GroupDisplay *gd = GET_GROUP_DISPLAY (d)
#define GET_GROUP_SCREEN(s, gd) ((GroupScreen *) (s)->privates[ (gd)->screenPrivateIndex].ptr)
#define GROUP_SCREEN(s) GroupScreen *gs = GET_GROUP_SCREEN (s, GET_GROUP_DISPLAY (s->display))
#define GET_GROUP_WINDOW(w, gs) ((GroupWindow *) (w)->privates[ (gs)->windowPrivateIndex].ptr)
#define GROUP_WINDOW(w) GroupWindow *gw = GET_GROUP_WINDOW (w, GET_GROUP_SCREEN  (w->screen, GET_GROUP_DISPLAY (w->screen->display)))

#define WIN_X(w) (w->attrib.x)
#define WIN_Y(w) (w->attrib.y)
#define WIN_WIDTH(w) (w->attrib.width)
#define WIN_HEIGHT(w) (w->attrib.height)
#define WIN_BORDER(w) (w->attrib.border_width)

/* definitions used for glow painting */
#define WIN_REAL_X(w) (w->attrib.x - w->input.left)
#define WIN_REAL_Y(w) (w->attrib.y - w->input.top)
#define WIN_REAL_WIDTH(w) (w->width + 2 * w->attrib.border_width + w->input.left + w->input.right)
#define WIN_REAL_HEIGHT(w) (w->height + 2 * w->attrib.border_width + w->input.top + w->input.bottom)

#define NUM_OPTIONS(s) (sizeof ( (s)->opt) / sizeof (CompOption))
#define N_WIN_TYPE (sizeof (groupDefaultTypes) / sizeof (groupDefaultTypes[0]))
#define N_SEL_MODE (sizeof (groupSelectionModes) / sizeof (groupSelectionModes[0]))

#define REAL_POSITION(x, s) ( (x >= 0)? x: x + (s)->hsize * (s)->width )
#define VIEWPORT(x, s) ( ( REAL_POSITION(x, s) / (s)->width ) % (s)->hsize )

#define TOP_TAB(g) ((g)->topTab->window)
#define PREV_TOP_TAB(g) ((g)->prevTopTab->window)
#define NEXT_TOP_TAB(g) ((g)->nextTopTab->window)

#define HAS_TOP_WIN(group) (((group)->topTab) && ((group)->topTab->window))
#define HAS_PREV_TOP_WIN(group) (((group)->prevTopTab) && ((group)->prevTopTab->window))

#define IS_TOP_TAB(w, group) (HAS_TOP_WIN(group) && ((TOP_TAB(group)->id) == (w)->id))
#define IS_PREV_TOP_TAB(w, group) (HAS_PREV_TOP_WIN(group) && ((PREV_TOP_TAB(group)->id) == (w)->id))

/*
 * Structs
 *
 */

/*
 * tab bar styles
 */
typedef enum {
	StyleSimple = 0,
	StyleGradient,
	StyleGlass,
	StyleNum
} TabBarStyle;

/*
 * window states  
 */
typedef enum {
	WindowNormal = 0,
	WindowMinimized,
	WindowShaded
} GroupWindowState;

/*
 * screengrab states
 */
typedef enum {
	ScreenGrabNone = 0,
	ScreenGrabSelect,
	ScreenGrabTabDrag
} GroupScreenGrabState;

/*
 * ungrouping states
 */
typedef enum {
	UngroupNone = 0,
	UngroupAll,
	UngroupSingle
} GroupUngroupState;

/*
 * rotation direction for change tab animation
 */
typedef enum {
	RotateUncertain = 0,
	RotateLeft,
	RotateRight
} ChangeTabAnimationDirection;

/*
 * structs for glow type
 */
typedef enum {
	GlowTextureRectangular = 0,
	GlowTextureRing,
	GlowTextureNum
} GlowTextureType;

static const char *glowTextureName[] = {
	N_("Rectangular glow"),
	N_("Glow ring")
};
static const int nGlowTextureNames =
    sizeof (glowTextureName) / sizeof (glowTextureName[0]);

typedef struct _GlowTextureProperties {
	char * textureData;
	int textureSize;
	int glowOffset;
} GlowTextureProperties;

static const GlowTextureProperties glowTextureProperties[GlowTextureNum] = {
	// GlowTextureRectangular
	{glowTexRect, 32, 21},
	// GlowTextureRing
	{glowTexRing, 32, 16}
};

/*
 * structs for pending callbacks
 */
typedef struct _GroupPendingMoves GroupPendingMoves;
struct _GroupPendingMoves {
	CompWindow *w;
	int dx;
	int dy;
	Bool immediate;
	Bool sync;
	GroupPendingMoves *next;
};

typedef struct _GroupPendingGrabs GroupPendingGrabs;
struct _GroupPendingGrabs {
	CompWindow *w;
	int x;
	int y;
	unsigned int state;
	unsigned int mask;
	GroupPendingGrabs *next;
};

typedef struct _GroupPendingUngrabs GroupPendingUngrabs;
struct _GroupPendingUngrabs {
	CompWindow *w;
	GroupPendingUngrabs *next;
};

/*
 * pointer to display list
 */
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)

/* mask values for tabbing animation */
#define IS_ANIMATED		(1 << 0)
#define FINISHED_ANIMATION	(1 << 1)
#define CONSTRAINED_X		(1 << 2)
#define CONSTRAINED_Y		(1 << 3)
#define DONT_CONSTRAIN		(1 << 4)

typedef enum {
	PaintOff = 0,
	PaintFadeIn,
	PaintFadeOut,
	PaintOn,
	PaintPermanentOn
} PaintState;


typedef struct _GroupCairoLayer {
	unsigned char		*texBuf;
	CompTexture		texture;
	cairo_surface_t		*surface;
	cairo_t			*cairo;

	int texWidth, texHeight;

	PaintState		state;
	int			animationTime;
} GroupCairoLayer;

/*
 * GroupTabBarSlot
 */
typedef struct _GroupTabBarSlot GroupTabBarSlot;
struct _GroupTabBarSlot {
	GroupTabBarSlot	*prev;
	GroupTabBarSlot	*next;

	Region		region;

	char		*name;
	CompWindow	*window;
	
	//for DnD animations.
	int		springX;
	int		speed;
	float		msSinceLastMove;
};

/*
 * GroupTabBar
 */
typedef struct _GroupTabBar {
	GroupTabBarSlot	*slots;
	GroupTabBarSlot	*revSlots;
	int		nSlots;

	GroupTabBarSlot	*hoveredSlot;
	GroupTabBarSlot *textSlot;

	GroupCairoLayer	*textLayer;
	GroupCairoLayer	*bgLayer;
	GroupCairoLayer	*selectionLayer;

	PaintState	state;
	int		timeoutHandle;
	int		animationTime;
	Region		region;
	
	//for DnD animations.
	int		leftSpringX, rightSpringX;
	int		leftSpeed, rightSpeed;
	float		leftMsSinceLastMove, rightMsSinceLastMove;
} GroupTabBar;

/*
 * GroupGlow
 */

typedef struct _GlowQuad {
	BoxRec box;
	CompMatrix matrix;
} GlowQuad;

#define GLOWQUAD_TOPLEFT	0
#define GLOWQUAD_TOPRIGHT	1
#define GLOWQUAD_BOTTOMLEFT	2
#define GLOWQUAD_BOTTOMRIGHT	3
#define GLOWQUAD_TOP		4
#define GLOWQUAD_BOTTOM		5
#define GLOWQUAD_LEFT		6
#define GLOWQUAD_RIGHT		7
#define NUM_GLOWQUADS		8

/*
 * GroupSelection
 */
typedef struct _GroupSelection GroupSelection;
struct _GroupSelection {
	GroupSelection *prev;
	GroupSelection *next;

	CompScreen *screen;
	CompWindow **windows;
	int nWins;

	// unique identifier for this group
	long int identifier;

	GroupTabBarSlot* topTab;
	GroupTabBarSlot* prevTopTab;
	
	//Those two are only for the change-tab animation, when the tab was changed again during animation.
	//Another animation should be started again, switching for this window.
	ChangeTabAnimationDirection nextDirection;
	GroupTabBarSlot* nextTopTab;	
	
	GroupTabBarSlot* activateTab;

	GroupTabBar *tabBar;

	int changeAnimationTime;
	int changeAnimationDirection;
	PaintState changeState;
	Bool	changeTab;

	Bool doTabbing;
	PaintState tabbingState;

	GroupUngroupState ungroupState;

	Window grabWindow;
	unsigned int grabMask;

	int oldTopTabCenterX;
	int oldTopTabCenterY;

	Window inputPrevention;

	GLushort color[4];
};

/*
 * GroupDisplay structure
 */
typedef struct _GroupDisplay {
	int screenPrivateIndex;
	CompOption opt[GROUP_DISPLAY_OPTION_NUM];
	HandleEventProc handleEvent;

	GroupSelection tmpSel;
	Bool ignoreMode;

	Atom groupWinPropertyAtom;
	
	CompTimeoutHandle timeoutHandle;
} GroupDisplay;

/*
 * GroupScreen structure
 */
typedef struct _GroupScreen {
	int windowPrivateIndex;
	CompOption opt[GROUP_SCREEN_OPTION_NUM];

	WindowMoveNotifyProc windowMoveNotify;
	WindowResizeNotifyProc windowResizeNotify;
	GetOutputExtentsForWindowProc getOutputExtentsForWindow;
	PreparePaintScreenProc preparePaintScreen;
	PaintScreenProc paintScreen;
	DrawWindowProc drawWindow;
	PaintWindowProc paintWindow;
	PaintTransformedScreenProc paintTransformedScreen;
	DonePaintScreenProc donePaintScreen;
	WindowGrabNotifyProc windowGrabNotify;
	WindowUngrabNotifyProc windowUngrabNotify;
	DamageWindowRectProc damageWindowRect;
	WindowStateChangeNotifyProc windowStateChangeNotify;
	GroupPendingMoves *pendingMoves;
	GroupPendingGrabs *pendingGrabs;
	GroupPendingUngrabs *pendingUngrabs;

	GroupSelection *groups;

	int wMask;
	Bool queued;
	Bool tabBarVisible;

	TabBarStyle tabBarStyle;
	GlowTextureType glowType; 

	GroupScreenGrabState grabState;
	int grabIndex;

	// for selection
	Bool painted;
	int vpX, vpY;
	Bool isRotating;
	int x1;
	int y1;
	int x2;
	int y2;
	
	//For d&d
	GroupTabBarSlot	*draggedSlot;
	int dragHoverTimeoutHandle;
	Bool dragged;
	int prevX, prevY;	//buffer for mouse coordinates

	CompTexture glowTexture;

	// pending screen wide actions
	unsigned int screenActions;
} GroupScreen;

/*
 * GroupWindow structure
 */
typedef struct _GroupWindow {
	GroupSelection *group;
	Bool inSelection;

	// for the tab bar
	GroupTabBarSlot *slot;
	int oldWindowState;

	// for resize notify...
	Bool needsPosSync;

	GlowQuad *glowQuads;

	GroupWindowState windowState;

	// for tab animation
	Bool ungroup;
	int animateState;
	XPoint mainTabOffset;
	XPoint destination;
	XPoint orgPos;
	float tx,ty;
	float xVelocity, yVelocity;

	int lastState;
} GroupWindow;

/*
 * Pre-Definitions
 *
 */

/*
 * options.c
 */
void groupDisplayInitOptions(GroupDisplay * gd);
CompOption *groupGetDisplayOptions(CompDisplay * d, int *count);
Bool groupSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value);
void groupScreenInitOptions(GroupScreen * gs);
CompOption *groupGetScreenOptions(CompScreen * s, int *count);
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);
Bool groupUnGroupWindows(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
int groupFindWindowIndex(CompWindow *w, GroupSelection *g);
void groupDeleteGroupWindow(CompWindow * w, Bool allowRegroup);
void groupDeleteGroup(GroupSelection *group);
void groupAddWindowToGroup(CompWindow * w, GroupSelection *group, long int initialIdent);
void groupSyncWindows(GroupSelection *group);
void groupRaiseWindows(CompWindow * top, GroupSelection *group);
Bool groupRemoveWindow(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupCloseWindows(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupChangeColor(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupSetIgnore(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupUnsetIgnore(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
void groupWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth, int dheight, Bool preview);
void groupWindowGrabNotify(CompWindow * w, int x, int y, unsigned int state, unsigned int mask);
void groupWindowUngrabNotify(CompWindow * w);
void groupWindowMoveNotify(CompWindow * w, int dx, int dy, Bool immediate);
void groupWindowStateChangeNotify(CompWindow *w);
void groupGetOutputExtentsForWindow(CompWindow * w, CompWindowExtents * output);

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);
void groupDrawTabAnimation(CompScreen * s, int msSinceLastPaint);
Bool groupUpdateTabBars(void* display);
void groupCheckForVisibleTabBars(CompScreen *s);
void groupGetDrawOffsetForSlot(GroupTabBarSlot *slot, int *hoffset, int *voffset);
void groupTabSetVisibility(GroupSelection *group, Bool visible, unsigned int mask);
Bool groupGetCurrentMousePosition(CompScreen *s, int *x, int *y);
void groupClearCairoLayer(GroupCairoLayer *layer);
void groupDestroyCairoLayer(CompScreen *s, GroupCairoLayer *layer);
GroupCairoLayer *groupRebuildCairoLayer(CompScreen *s, GroupCairoLayer *layer, int width, int height);
GroupCairoLayer *groupCreateCairoLayer(CompScreen *s, int width, int height);
void groupRecalcTabBarPos(GroupSelection *group, int middleX, int minX1, int maxX2);
void groupInsertTabBarSlotAfter(GroupTabBar *bar, GroupTabBarSlot *slot, GroupTabBarSlot *prevSlot);
void groupInsertTabBarSlotBefore(GroupTabBar *bar, GroupTabBarSlot *slot, GroupTabBarSlot *nextSlot);
void groupInsertTabBarSlot(GroupTabBar *bar, GroupTabBarSlot *slot);
void groupUnhookTabBarSlot(GroupTabBar *bar, GroupTabBarSlot *slot, Bool temporary);
void groupDeleteTabBarSlot(GroupTabBar *bar, GroupTabBarSlot *slot);
void groupCreateSlot(GroupSelection *group, CompWindow *w);
void groupApplyForces(CompScreen *s, GroupTabBar *bar, GroupTabBarSlot* draggedSlot);
void groupApplySpeeds(CompScreen* s, GroupTabBar* bar, int msSinceLastRepaint);
void groupInitTabBar(GroupSelection *group, CompWindow* topTab);
void groupDeleteTabBar(GroupSelection *group);
void groupStartTabbingAnimation(GroupSelection *group, Bool tab);
void groupTabGroup(CompWindow * main);
void groupUntabGroup(GroupSelection *group);
Bool groupInitTab(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupChangeTab(GroupTabBarSlot* topTab, ChangeTabAnimationDirection direction);
Bool groupChangeTabLeft(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupChangeTabRight(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
void groupUpdateInputPreventionWindow(GroupSelection* group);
void groupSwitchTopTabInput(GroupSelection *group, Bool enable);
void groupCreateInputPreventionWindow(GroupSelection* group); 
void groupDestroyInputPreventionWindow(GroupSelection* group); 
Region groupGetClippingRegion(CompWindow *w);

/*
 * paint.c
 */
void groupRecomputeGlow(CompScreen *s);
void groupComputeGlowQuads(CompWindow *w, CompMatrix *matrix);
void groupRenderTopTabHighlight(GroupSelection *group);
void groupRenderTabBarBackground(GroupSelection *group);
void groupRenderWindowTitle(GroupSelection *group);
void groupPaintThumb(GroupSelection *group, GroupTabBarSlot *slot, const CompTransform *transform, int targetOpacity);
void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib, const CompTransform *transform, unsigned int mask, Region clipRegion);
void groupPreparePaintScreen(CompScreen * s, int msSinceLastPaint);
Bool groupPaintScreen(CompScreen * s, const ScreenPaintAttrib * sAttrib, const CompTransform *transform, Region region, int output, unsigned int mask);
void groupPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa, const CompTransform *transform, Region region, int output, unsigned int mask);
void groupDonePaintScreen(CompScreen * s);
Bool groupDrawWindow(CompWindow * w, const CompTransform *transform, const FragmentAttrib * attrib, Region region, unsigned int mask);
Bool groupPaintWindow(CompWindow * w, const WindowPaintAttrib * attrib, const CompTransform *transform, Region region, unsigned int mask);

/*
 * init.c
 */
Bool groupInitDisplay(CompPlugin * p, CompDisplay * d);
void groupFiniDisplay(CompPlugin * p, CompDisplay * d);
Bool groupInitScreen(CompPlugin * p, CompScreen * s);
void groupFiniScreen(CompPlugin * p, CompScreen * s);
Bool groupInitWindow(CompPlugin * p, CompWindow * w);
void groupFiniWindow(CompPlugin * p, CompWindow * w);
Bool groupInit(CompPlugin * p);
void groupFini(CompPlugin * p);

/*
 * queues.c
 */
void groupEnqueueMoveNotify (CompWindow *w, int dx, int dy, Bool immediate, Bool sync);
void groupDequeueMoveNotifies (CompScreen *s);
void groupEnqueueGrabNotify (CompWindow *w, int x, int y, unsigned int state, unsigned int mask);
void groupDequeueGrabNotifies (CompScreen *s);
void groupEnqueueUngrabNotify (CompWindow *w);
void groupDequeueUngrabNotifies (CompScreen *s);

/*
 * selection.c
 */
CompWindow **groupFindWindowsInRegion(CompScreen * s, Region reg, int *c);
void groupDeleteSelectionWindow(CompDisplay * d, CompWindow * w);
void groupAddWindowToSelection(CompDisplay * d, CompWindow * w);
void groupSelectWindow(CompDisplay * d, CompWindow * w);
Bool groupSelectSingle(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupSelect(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
Bool groupSelectTerminate(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
void groupDamageSelectionRect(CompScreen* s, int xRoot, int yRoot);

#endif