summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2007-09-10 11:40:05 +0200
committerDanny Baumann <dannybaumann@web.de>2007-09-10 11:40:05 +0200
commit620a403cfd3fe8b70e1cd291e60fa26f9ba74005 (patch)
treecfd2348806886ae9d1e2548d9af7e7ed3ff3be68
parent57b0175fc4c4f65f237d0b0b10003beaf2eb8624 (diff)
downloadgroup-620a403cfd3fe8b70e1cd291e60fa26f9ba74005.tar.gz
group-620a403cfd3fe8b70e1cd291e60fa26f9ba74005.tar.bz2
Compiz indention style.
-rw-r--r--cairo.c1139
-rw-r--r--group-internal.h722
-rw-r--r--group.c3082
-rw-r--r--init.c755
-rw-r--r--paint.c1776
-rw-r--r--queues.c253
-rw-r--r--selection.c488
-rw-r--r--tab.c3782
8 files changed, 6003 insertions, 5994 deletions
diff --git a/cairo.c b/cairo.c
index 8d2b82d..da59146 100644
--- a/cairo.c
+++ b/cairo.c
@@ -30,22 +30,22 @@
*/
GroupCairoLayer*
groupRebuildCairoLayer (CompScreen *s,
- GroupCairoLayer *layer,
- int width,
- int height)
+ GroupCairoLayer *layer,
+ int width,
+ int height)
{
- int timeBuf = layer->animationTime;
- PaintState stateBuf = layer->state;
+ int timeBuf = layer->animationTime;
+ PaintState stateBuf = layer->state;
- groupDestroyCairoLayer (s, layer);
- layer = groupCreateCairoLayer (s, width, height);
- if (!layer)
- return NULL;
+ groupDestroyCairoLayer (s, layer);
+ layer = groupCreateCairoLayer (s, width, height);
+ if (!layer)
+ return NULL;
- layer->animationTime = timeBuf;
- layer->state = stateBuf;
+ layer->animationTime = timeBuf;
+ layer->state = stateBuf;
- return layer;
+ return layer;
}
/*
@@ -55,12 +55,12 @@ groupRebuildCairoLayer (CompScreen *s,
void
groupClearCairoLayer (GroupCairoLayer *layer)
{
- cairo_t *cr = layer->cairo;
+ cairo_t *cr = layer->cairo;
- cairo_save (cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
- cairo_restore (cr);
+ cairo_save (cr);
+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (cr);
+ cairo_restore (cr);
}
/*
@@ -69,20 +69,20 @@ groupClearCairoLayer (GroupCairoLayer *layer)
*/
void
groupDestroyCairoLayer (CompScreen *s,
- GroupCairoLayer *layer)
+ GroupCairoLayer *layer)
{
- if (layer->cairo)
- cairo_destroy (layer->cairo);
+ if (layer->cairo)
+ cairo_destroy (layer->cairo);
+
+ if (layer->surface)
+ cairo_surface_destroy (layer->surface);
- if (layer->surface)
- cairo_surface_destroy (layer->surface);
+ finiTexture (s, &layer->texture);
- finiTexture (s, &layer->texture);
-
- if (layer->buffer)
- free (layer->buffer);
+ if (layer->buffer)
+ free (layer->buffer);
- free (layer);
+ free (layer);
}
/*
@@ -91,54 +91,59 @@ groupDestroyCairoLayer (CompScreen *s,
*/
GroupCairoLayer*
groupCreateCairoLayer (CompScreen *s,
- int width,
- int height)
+ int width,
+ int height)
{
- GroupCairoLayer *layer;
+ GroupCairoLayer *layer;
-
- layer = malloc (sizeof (GroupCairoLayer));
- layer->surface = NULL;
- layer->cairo = NULL;
- layer->buffer = NULL;
- layer->animationTime = 0;
- layer->state = PaintOff;
- layer->texWidth = width;
- layer->texHeight = height;
+ layer = malloc (sizeof (GroupCairoLayer));
- initTexture (s, &layer->texture);
+ layer->surface = NULL;
+ layer->cairo = NULL;
+ layer->buffer = NULL;
- layer->buffer = calloc (4 * width * height, sizeof (unsigned char));
- if (!layer->buffer)
- {
- printf ("ERROR: Failed to alloc buffer!\n");
- groupDestroyCairoLayer (s, layer);
- return NULL;
- }
+ layer->animationTime = 0;
+ layer->state = PaintOff;
- layer->surface = cairo_image_surface_create_for_data (layer->buffer,
- CAIRO_FORMAT_ARGB32,
- width, height,
- 4 * width);
- if (cairo_surface_status (layer->surface) != CAIRO_STATUS_SUCCESS)
- {
- printf ("ERROR: Failed to create surface!\n");
- groupDestroyCairoLayer (s, layer);
- return NULL;
- }
+ layer->texWidth = width;
+ layer->texHeight = height;
- layer->cairo = cairo_create (layer->surface);
- if (cairo_status (layer->cairo) != CAIRO_STATUS_SUCCESS)
- {
- printf ("ERROR: Failed to create context!\n");
- groupDestroyCairoLayer (s, layer);
- return NULL;
- }
+ initTexture (s, &layer->texture);
+
+ layer->buffer = calloc (4 * width * height, sizeof (unsigned char));
+ if (!layer->buffer)
+ {
+ compLogMessage (s->display, "group", CompLogLevelError,
+ "Failed to allocate cairo layer buffer.");
+ groupDestroyCairoLayer (s, layer);
+ return NULL;
+ }
+
+ layer->surface = cairo_image_surface_create_for_data (layer->buffer,
+ CAIRO_FORMAT_ARGB32,
+ width, height,
+ 4 * width);
+ if (cairo_surface_status (layer->surface) != CAIRO_STATUS_SUCCESS)
+ {
+ compLogMessage (s->display, "group", CompLogLevelError,
+ "Failed to create cairo layer surface.");
+ groupDestroyCairoLayer (s, layer);
+ return NULL;
+ }
+
+ layer->cairo = cairo_create (layer->surface);
+ if (cairo_status (layer->cairo) != CAIRO_STATUS_SUCCESS)
+ {
+ compLogMessage (s->display, "group", CompLogLevelError,
+ "Failed to create cairo layer context.");
+ groupDestroyCairoLayer (s, layer);
+ return NULL;
+ }
- groupClearCairoLayer (layer);
+ groupClearCairoLayer (layer);
- return layer;
+ return layer;
}
/*
@@ -148,57 +153,55 @@ groupCreateCairoLayer (CompScreen *s,
void
groupRenderTopTabHighlight (GroupSelection *group)
{
- GroupTabBar *bar;
- GroupCairoLayer *layer;
- cairo_t *cr;
- int width, height;
-
- if (!group->tabBar || !HAS_TOP_WIN (group) ||
- !group->tabBar->selectionLayer ||
- !group->tabBar->selectionLayer->cairo)
- {
- return;
- }
-
- bar = group->tabBar;
- width = group->topTab->region->extents.x2 -
- group->topTab->region->extents.x1;
- height = group->topTab->region->extents.y2 -
- group->topTab->region->extents.y1;
-
- bar->selectionLayer = groupRebuildCairoLayer (group->screen,
- bar->selectionLayer,
- width, height);
- if (!bar->selectionLayer)
- return;
-
- layer = bar->selectionLayer;
- cr = bar->selectionLayer->cairo;
-
- /* fill */
- cairo_set_line_width (cr, 2);
- cairo_set_source_rgba (cr,
- (group->color[0] / 65535.0f),
- (group->color[1] / 65535.0f),
- (group->color[2] / 65535.0f),
- (group->color[3] / (65535.0f*2)));
-
- cairo_move_to (cr, 0, 0);
- cairo_rectangle (cr, 0, 0, width, height);
-
- cairo_fill_preserve (cr);
-
- /* outline */
- cairo_set_source_rgba (cr,
- (group->color[0] / 65535.0f),
- (group->color[1] / 65535.0f),
- (group->color[2] / 65535.0f),
- (group->color[3] / 65535.0f));
- cairo_stroke (cr);
-
- imageBufferToTexture (group->screen,
- &layer->texture, (char*) layer->buffer,
- layer->texWidth, layer->texHeight);
+ GroupTabBar *bar = group->tabBar;
+ GroupCairoLayer *layer;
+ cairo_t *cr;
+ int width, height;
+
+ if (!bar || !HAS_TOP_WIN (group) ||
+ !bar->selectionLayer || !bar->selectionLayer->cairo)
+ {
+ return;
+ }
+
+ width = group->topTab->region->extents.x2 -
+ group->topTab->region->extents.x1;
+ height = group->topTab->region->extents.y2 -
+ group->topTab->region->extents.y1;
+
+ bar->selectionLayer = groupRebuildCairoLayer (group->screen,
+ bar->selectionLayer,
+ width, height);
+ if (!bar->selectionLayer)
+ return;
+
+ layer = bar->selectionLayer;
+ cr = bar->selectionLayer->cairo;
+
+ /* fill */
+ cairo_set_line_width (cr, 2);
+ cairo_set_source_rgba (cr,
+ (group->color[0] / 65535.0f),
+ (group->color[1] / 65535.0f),
+ (group->color[2] / 65535.0f),
+ (group->color[3] / (65535.0f * 2)));
+
+ cairo_move_to (cr, 0, 0);
+ cairo_rectangle (cr, 0, 0, width, height);
+
+ cairo_fill_preserve (cr);
+
+ /* outline */
+ cairo_set_source_rgba (cr,
+ (group->color[0] / 65535.0f),
+ (group->color[1] / 65535.0f),
+ (group->color[2] / 65535.0f),
+ (group->color[3] / 65535.0f));
+ cairo_stroke (cr);
+
+ imageBufferToTexture (group->screen,
+ &layer->texture, (char*) layer->buffer,
+ layer->texWidth, layer->texHeight);
}
/*
@@ -208,403 +211,404 @@ groupRenderTopTabHighlight (GroupSelection *group)
void
groupRenderTabBarBackground(GroupSelection *group)
{
- GroupTabBar *bar;
- GroupCairoLayer *layer;
- cairo_t *cr;
- int width, height, radius;
- int borderWidth;
- float r, g, b, a;
- double x0, y0, x1, y1;
-
- if (!group->tabBar || !HAS_TOP_WIN (group) ||
- !group->tabBar->bgLayer ||
- !group->tabBar->bgLayer->cairo)
- {
- return;
- }
+ GroupCairoLayer *layer;
+ cairo_t *cr;
+ int width, height, radius;
+ int borderWidth;
+ float r, g, b, a;
+ double x0, y0, x1, y1;
+ CompScreen *s = group->screen;
+ GroupTabBar *bar = group->tabBar;
+
+ if (!bar || !HAS_TOP_WIN (group) || !bar->bgLayer || !bar->bgLayer->cairo)
+ return;
- bar = group->tabBar;
+ width = bar->region->extents.x2 - bar->region->extents.x1;
+ height = bar->region->extents.y2 - bar->region->extents.y1;
+ radius = groupGetBorderRadius (s);
- width = bar->region->extents.x2 - bar->region->extents.x1;
- height = bar->region->extents.y2 - bar->region->extents.y1;
- radius = groupGetBorderRadius (group->screen);
+ if (width > bar->bgLayer->texWidth)
+ width = bar->bgLayer->texWidth;
- if (width > bar->bgLayer->texWidth)
- width = bar->bgLayer->texWidth;
+ if (radius > width / 2)
+ radius = width / 2;
- if (radius > width / 2)
- radius = width / 2;
+ layer = bar->bgLayer;
+ cr = layer->cairo;
- layer = bar->bgLayer;
- cr = layer->cairo;
+ groupClearCairoLayer (layer);
- groupClearCairoLayer (layer);
+ borderWidth = groupGetBorderWidth (s);
+ cairo_set_line_width (cr, borderWidth);
- borderWidth = groupGetBorderWidth (group->screen);
- cairo_set_line_width (cr, borderWidth);
+ cairo_save (cr);
- cairo_save (cr);
+ x0 = borderWidth / 2.0f;
+ y0 = borderWidth / 2.0f;
+ x1 = width - borderWidth / 2.0f;
+ y1 = height - borderWidth / 2.0f;
+ cairo_move_to (cr, x0 + radius, y0);
+ cairo_arc (cr, x1 - radius, y0 + radius, radius, M_PI * 1.5, M_PI * 2.0);
+ cairo_arc (cr, x1 - radius, y1 - radius, radius, 0.0, M_PI * 0.5);
+ cairo_arc (cr, x0 + radius, y1 - radius, radius, M_PI * 0.5, M_PI);
+ cairo_arc (cr, x0 + radius, y0 + radius, radius, M_PI, M_PI * 1.5);
- x0 = borderWidth / 2.0f;
- y0 = borderWidth / 2.0f;
- x1 = width - borderWidth / 2.0f;
- y1 = height - borderWidth / 2.0f;
- cairo_move_to (cr, x0 + radius, y0);
- cairo_arc (cr, x1 - radius, y0 + radius, radius, M_PI * 1.5, M_PI * 2.0);
- cairo_arc (cr, x1 - radius, y1 - radius, radius, 0.0, M_PI * 0.5);
- cairo_arc (cr, x0 + radius, y1 - radius, radius, M_PI * 0.5, M_PI);
- cairo_arc (cr, x0 + radius, y0 + radius, radius, M_PI, M_PI * 1.5);
+ cairo_close_path (cr);
- cairo_close_path (cr);
+ switch (groupGetTabStyle (s)) {
+ case TabStyleSimple:
+ {
+ /* base color */
+ r = groupGetTabBaseColorRed (s) / 65535.0f;
+ g = groupGetTabBaseColorGreen (s) / 65535.0f;
+ b = groupGetTabBaseColorBlue (s) / 65535.0f;
+ a = groupGetTabBaseColorAlpha (s) / 65535.0f;
+ cairo_set_source_rgba (cr, r, g, b, a);
+
+ cairo_fill_preserve (cr);
+ break;
+ }
+
+ case TabStyleGradient:
+ {
+ /* fill */
+ cairo_pattern_t *pattern;
+ pattern = cairo_pattern_create_linear (0, 0, width, height);
+
+ /* highlight color */
+ r = groupGetTabHighlightColorRed (s) / 65535.0f;
+ g = groupGetTabHighlightColorGreen (s) / 65535.0f;
+ b = groupGetTabHighlightColorBlue (s) / 65535.0f;
+ a = groupGetTabHighlightColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
+
+ /* base color */
+ r = groupGetTabBaseColorRed (s) / 65535.0f;
+ g = groupGetTabBaseColorGreen (s) / 65535.0f;
+ b = groupGetTabBaseColorBlue (s) / 65535.0f;
+ a = groupGetTabBaseColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
+
+ cairo_set_source (cr, pattern);
+ cairo_fill_preserve (cr);
+ cairo_pattern_destroy (pattern);
+ break;
+ }
+
+ case TabStyleGlass:
+ {
+ cairo_pattern_t *pattern;
+
+ cairo_save (cr);
+
+ /* clip width rounded rectangle */
+ cairo_clip (cr);
+
+ /* ===== HIGHLIGHT ===== */
+
+ /* make draw the shape for the highlight and
+ create a pattern for it */
+ cairo_rectangle (cr, 0, 0, width, height / 2);
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+
+ /* highlight color */
+ r = groupGetTabHighlightColorRed (s) / 65535.0f;
+ g = groupGetTabHighlightColorGreen (s) / 65535.0f;
+ b = groupGetTabHighlightColorBlue (s) / 65535.0f;
+ a = groupGetTabHighlightColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
+
+ /* base color */
+ r = groupGetTabBaseColorRed (s) / 65535.0f;
+ g = groupGetTabBaseColorGreen (s) / 65535.0f;
+ b = groupGetTabBaseColorBlue (s) / 65535.0f;
+ a = groupGetTabBaseColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 0.6f, r, g, b, a);
+
+ cairo_set_source (cr, pattern);
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
+
+ /* ==== SHADOW ===== */
+
+ /* make draw the shape for the show and create a pattern for it */
+ cairo_rectangle (cr, 0, height / 2, width, height);
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+
+ /* we don't want to use a full highlight here
+ so we mix the colors */
+ r = (groupGetTabHighlightColorRed (s) +
+ groupGetTabBaseColorRed (s)) / (2 * 65535.0f);
+ g = (groupGetTabHighlightColorGreen (s) +
+ groupGetTabBaseColorGreen (s)) / (2 * 65535.0f);
+ b = (groupGetTabHighlightColorBlue (s) +
+ groupGetTabBaseColorBlue (s)) / (2 * 65535.0f);
+ a = (groupGetTabHighlightColorAlpha (s) +
+ groupGetTabBaseColorAlpha (s)) / (2 * 65535.0f);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
+
+ /* base color */
+ r = groupGetTabBaseColorRed (s) / 65535.0f;
+ g = groupGetTabBaseColorGreen (s) / 65535.0f;
+ b = groupGetTabBaseColorBlue (s) / 65535.0f;
+ a = groupGetTabBaseColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 0.5f, r, g, b, a);
+
+ cairo_set_source (cr, pattern);
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
+
+ cairo_restore (cr);
+
+ /* draw shape again for the outline */
+ cairo_move_to (cr, x0 + radius, y0);
+ cairo_arc (cr, x1 - radius, y0 + radius,
+ radius, M_PI * 1.5, M_PI * 2.0);
+ cairo_arc (cr, x1 - radius, y1 - radius,
+ radius, 0.0, M_PI * 0.5);
+ cairo_arc (cr, x0 + radius, y1 - radius,
+ radius, M_PI * 0.5, M_PI);
+ cairo_arc (cr, x0 + radius, y0 + radius,
+ radius, M_PI, M_PI * 1.5);
+
+ break;
+ }
+
+ case TabStyleMetal:
+ {
+ /* fill */
+ cairo_pattern_t *pattern;
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+
+ /* base color #1 */
+ r = groupGetTabBaseColorRed (s) / 65535.0f;
+ g = groupGetTabBaseColorGreen (s) / 65535.0f;
+ b = groupGetTabBaseColorBlue (s) / 65535.0f;
+ a = groupGetTabBaseColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
+
+ /* highlight color */
+ r = groupGetTabHighlightColorRed (s) / 65535.0f;
+ g = groupGetTabHighlightColorGreen (s) / 65535.0f;
+ b = groupGetTabHighlightColorBlue (s) / 65535.0f;
+ a = groupGetTabHighlightColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 0.55f, r, g, b, a);
+
+ /* base color #2 */
+ r = groupGetTabBaseColorRed (s) / 65535.0f;
+ g = groupGetTabBaseColorGreen (s) / 65535.0f;
+ b = groupGetTabBaseColorBlue (s) / 65535.0f;
+ a = groupGetTabBaseColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
+
+ cairo_set_source (cr, pattern);
+ cairo_fill_preserve (cr);
+ cairo_pattern_destroy (pattern);
+ break;
+ }
+
+ case TabStyleMurrina:
+ {
+ double ratio, transX;
+ cairo_pattern_t *pattern;
+
+ cairo_save (cr);
+
+ /* clip width rounded rectangle */
+ cairo_clip_preserve (cr);
+
+ /* ==== TOP ==== */
+
+ x0 = borderWidth / 2.0;
+ y0 = borderWidth / 2.0;
+ x1 = width - borderWidth / 2.0;
+ y1 = height - borderWidth / 2.0;
+ radius = (y1 - y0) / 2;
+
+ /* setup pattern */
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+
+ /* we don't want to use a full highlight here
+ so we mix the colors */
+ r = (groupGetTabHighlightColorRed (s) +
+ groupGetTabBaseColorRed (s)) / (2 * 65535.0f);
+ g = (groupGetTabHighlightColorGreen (s) +
+ groupGetTabBaseColorGreen (s)) / (2 * 65535.0f);
+ b = (groupGetTabHighlightColorBlue (s) +
+ groupGetTabBaseColorBlue (s)) / (2 * 65535.0f);
+ a = (groupGetTabHighlightColorAlpha (s) +
+ groupGetTabBaseColorAlpha (s)) / (2 * 65535.0f);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
+
+ /* highlight color */
+ r = groupGetTabHighlightColorRed (s) / 65535.0f;
+ g = groupGetTabHighlightColorGreen (s) / 65535.0f;
+ b = groupGetTabHighlightColorBlue (s) / 65535.0f;
+ a = groupGetTabHighlightColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
+
+ cairo_set_source (cr, pattern);
+
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
+
+ /* ==== BOTTOM ===== */
+
+ x0 = borderWidth / 2.0;
+ y0 = borderWidth / 2.0;
+ x1 = width - borderWidth / 2.0;
+ y1 = height - borderWidth / 2.0;
+ radius = (y1 - y0) / 2;
+
+ ratio = (double)width / (double)height;
+ transX = width - (width * ratio);
+
+ cairo_move_to (cr, x1, y1);
+ cairo_line_to (cr, x1, y0);
+ if (width < height)
+ {
+ cairo_translate (cr, transX, 0);
+ cairo_scale (cr, ratio, 1.0);
+ }
+ cairo_arc (cr, x1 - radius, y0, radius, 0.0, M_PI * 0.5);
+ if (width < height)
+ {
+ cairo_scale (cr, 1.0 / ratio, 1.0);
+ cairo_translate (cr, -transX, 0);
+ cairo_scale (cr, ratio, 1.0);
+ }
+ cairo_arc_negative (cr, x0 + radius, y1,
+ radius, M_PI * 1.5, M_PI);
+ cairo_close_path (cr);
+
+ /* setup pattern */
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+
+ /* base color */
+ r = groupGetTabBaseColorRed (s) / 65535.0f;
+ g = groupGetTabBaseColorGreen (s) / 65535.0f;
+ b = groupGetTabBaseColorBlue (s) / 65535.0f;
+ a = groupGetTabBaseColorAlpha (s) / 65535.0f;
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
+
+ /* we don't want to use a full highlight here
+ so we mix the colors */
+ r = (groupGetTabHighlightColorRed (s) +
+ groupGetTabBaseColorRed (s)) / (2 * 65535.0f);
+ g = (groupGetTabHighlightColorGreen (s) +
+ groupGetTabBaseColorGreen (s)) / (2 * 65535.0f);
+ b = (groupGetTabHighlightColorBlue (s) +
+ groupGetTabBaseColorBlue (s)) / (2 * 65535.0f);
+ a = (groupGetTabHighlightColorAlpha (s) +
+ groupGetTabBaseColorAlpha (s)) / (2 * 65535.0f);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
+
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_set_source (cr, pattern);
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
+ cairo_restore (cr);
+
+ /* draw shape again for the outline */
+ x0 = borderWidth / 2.0;
+ y0 = borderWidth / 2.0;
+ x1 = width - borderWidth / 2.0;
+ y1 = height - borderWidth / 2.0;
+ radius = groupGetBorderRadius (s);
+
+ cairo_move_to (cr, x0 + radius, y0);
+ cairo_arc (cr, x1 - radius, y0 + radius,
+ radius, M_PI * 1.5, M_PI * 2.0);
+ cairo_arc (cr, x1 - radius, y1 - radius,
+ radius, 0.0, M_PI * 0.5);
+ cairo_arc (cr, x0 + radius, y1 - radius,
+ radius, M_PI * 0.5, M_PI);
+ cairo_arc (cr, x0 + radius, y0 + radius,
+ radius, M_PI, M_PI * 1.5);
+
+ break;
+ }
+
+ default:
+ break;
+ }
- switch (groupGetTabStyle (group->screen))
+ /* outline */
+ r = groupGetTabBorderColorRed (s) / 65535.0f;
+ g = groupGetTabBorderColorGreen (s) / 65535.0f;
+ b = groupGetTabBorderColorBlue (s) / 65535.0f;
+ a = groupGetTabBorderColorAlpha (s) / 65535.0f;
+ cairo_set_source_rgba (cr, r, g, b, a);
+
+ if (bar->bgAnimation != AnimationNone)
+ cairo_stroke_preserve (cr);
+ else
+ cairo_stroke (cr);
+
+ switch (bar->bgAnimation) {
+ case AnimationPulse:
{
- case TabStyleSimple:
- {
- /* base color */
- r = groupGetTabBaseColorRed (group->screen) / 65535.0f;
- g = groupGetTabBaseColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBaseColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBaseColorAlpha (group->screen) / 65535.0f;
- cairo_set_source_rgba (cr, r, g, b, a);
-
- cairo_fill_preserve (cr);
- break;
- }
-
- case TabStyleGradient:
- {
- /* fill */
- cairo_pattern_t *pattern;
- pattern = cairo_pattern_create_linear (0, 0, width, height);
-
- /* highlight color */
- r = groupGetTabHighlightColorRed (group->screen) / 65535.0f;
- g = groupGetTabHighlightColorGreen (group->screen) / 65535.0f;
- b = groupGetTabHighlightColorBlue (group->screen) / 65535.0f;
- a = groupGetTabHighlightColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
-
- /* base color */
- r = groupGetTabBaseColorRed (group->screen) / 65535.0f;
- g = groupGetTabBaseColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBaseColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBaseColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
-
- cairo_set_source (cr, pattern);
- cairo_fill_preserve (cr);
- cairo_pattern_destroy (pattern);
- break;
- }
-
- case TabStyleGlass:
- {
- cairo_pattern_t *pattern;
-
- cairo_save (cr);
-
- /* clip width rounded rectangle */
- cairo_clip (cr);
-
- /* ===== HIGHLIGHT ===== */
-
- /* make draw the shape for the highlight and
- create a pattern for it */
- cairo_rectangle (cr, 0, 0, width, height / 2);
- pattern = cairo_pattern_create_linear (0, 0, 0, height);
-
- /* highlight color */
- r = groupGetTabHighlightColorRed (group->screen) / 65535.0f;
- g = groupGetTabHighlightColorGreen (group->screen) / 65535.0f;
- b = groupGetTabHighlightColorBlue (group->screen) / 65535.0f;
- a = groupGetTabHighlightColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
-
- /* base color */
- r = groupGetTabBaseColorRed (group->screen) / 65535.0f;
- g = groupGetTabBaseColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBaseColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBaseColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 0.6f, r, g, b, a);
-
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
-
- /* ==== SHADOW ===== */
-
- /* make draw the shape for the show and create a pattern for it */
- cairo_rectangle (cr, 0, height / 2, width, height);
- pattern = cairo_pattern_create_linear (0, 0, 0, height);
-
- /* we don't want to use a full highlight here
- so we mix the colors */
- r = (groupGetTabHighlightColorRed (group->screen) +
- groupGetTabBaseColorRed (group->screen)) / (2 * 65535.0f);
- g = (groupGetTabHighlightColorGreen (group->screen) +
- groupGetTabBaseColorGreen (group->screen)) / (2 * 65535.0f);
- b = (groupGetTabHighlightColorBlue (group->screen) +
- groupGetTabBaseColorBlue (group->screen)) / (2 * 65535.0f);
- a = (groupGetTabHighlightColorAlpha (group->screen) +
- groupGetTabBaseColorAlpha (group->screen)) / (2 * 65535.0f);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
-
- /* base color */
- r = groupGetTabBaseColorRed (group->screen) / 65535.0f;
- g = groupGetTabBaseColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBaseColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBaseColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 0.5f, r, g, b, a);
-
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
-
- cairo_restore (cr);
-
- /* draw shape again for the outline */
- cairo_move_to (cr, x0 + radius, y0);
- cairo_arc (cr, x1 - radius, y0 + radius,
- radius, M_PI * 1.5, M_PI * 2.0);
- cairo_arc (cr, x1 - radius, y1 - radius, radius, 0.0, M_PI * 0.5);
- cairo_arc (cr, x0 + radius, y1 - radius, radius, M_PI * 0.5, M_PI);
- cairo_arc (cr, x0 + radius, y0 + radius, radius, M_PI, M_PI * 1.5);
-
- break;
- }
-
- case TabStyleMetal:
- {
- /* fill */
- cairo_pattern_t *pattern;
- pattern = cairo_pattern_create_linear (0, 0, 0, height);
-
- /* base color #1 */
- r = groupGetTabBaseColorRed (group->screen) / 65535.0f;
- g = groupGetTabBaseColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBaseColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBaseColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
-
- /* highlight color */
- r = groupGetTabHighlightColorRed (group->screen) / 65535.0f;
- g = groupGetTabHighlightColorGreen (group->screen) / 65535.0f;
- b = groupGetTabHighlightColorBlue (group->screen) / 65535.0f;
- a = groupGetTabHighlightColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 0.55f, r, g, b, a);
-
- /* base color #2 */
- r = groupGetTabBaseColorRed (group->screen) / 65535.0f;
- g = groupGetTabBaseColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBaseColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBaseColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
-
- cairo_set_source (cr, pattern);
- cairo_fill_preserve (cr);
- cairo_pattern_destroy (pattern);
- break;
- }
-
- case TabStyleMurrina:
- {
- double ratio, transX;
- cairo_pattern_t *pattern;
-
- cairo_save (cr);
-
- /* clip width rounded rectangle */
- cairo_clip_preserve (cr);
-
- /* ==== TOP ==== */
-
- x0 = borderWidth / 2.0;
- y0 = borderWidth / 2.0;
- x1 = width - borderWidth / 2.0;
- y1 = height - borderWidth / 2.0;
- radius = (y1 - y0) / 2;
-
- /* setup pattern */
- pattern = cairo_pattern_create_linear (0, 0, 0, height);
-
- /* we don't want to use a full highlight here
- so we mix the colors */
- r = (groupGetTabHighlightColorRed (group->screen) +
- groupGetTabBaseColorRed (group->screen)) / (2 * 65535.0f);
- g = (groupGetTabHighlightColorGreen (group->screen) +
- groupGetTabBaseColorGreen (group->screen)) / (2 * 65535.0f);
- b = (groupGetTabHighlightColorBlue (group->screen) +
- groupGetTabBaseColorBlue (group->screen)) / (2 * 65535.0f);
- a = (groupGetTabHighlightColorAlpha (group->screen) +
- groupGetTabBaseColorAlpha (group->screen)) / (2 * 65535.0f);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
-
- /* highlight color */
- r = groupGetTabHighlightColorRed (group->screen) / 65535.0f;
- g = groupGetTabHighlightColorGreen (group->screen) / 65535.0f;
- b = groupGetTabHighlightColorBlue (group->screen) / 65535.0f;
- a = groupGetTabHighlightColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
-
- cairo_set_source (cr, pattern);
-
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
-
- /* ==== BOTTOM ===== */
-
- x0 = borderWidth / 2.0;
- y0 = borderWidth / 2.0;
- x1 = width - borderWidth / 2.0;
- y1 = height - borderWidth / 2.0;
- radius = (y1 - y0) / 2;
-
- ratio = (double)width / (double)height;
- transX = width - (width * ratio);
-
- cairo_move_to (cr, x1, y1);
- cairo_line_to (cr, x1, y0);
- if (width < height)
- {
- cairo_translate (cr, transX, 0);
- cairo_scale (cr, ratio, 1.0);
- }
- cairo_arc (cr, x1 - radius, y0, radius, 0.0, M_PI * 0.5);
- if (width < height)
- {
- cairo_scale (cr, 1.0 / ratio, 1.0);
- cairo_translate (cr, -transX, 0);
- cairo_scale (cr, ratio, 1.0);
- }
- cairo_arc_negative (cr, x0 + radius, y1, radius, M_PI * 1.5, M_PI);
- cairo_close_path (cr);
-
- /* setup pattern */
- pattern = cairo_pattern_create_linear (0, 0, 0, height);
-
- /* base color */
- r = groupGetTabBaseColorRed (group->screen) / 65535.0f;
- g = groupGetTabBaseColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBaseColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBaseColorAlpha (group->screen) / 65535.0f;
- cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
-
- /* we don't want to use a full highlight here
- so we mix the colors */
- r = (groupGetTabHighlightColorRed (group->screen) +
- groupGetTabBaseColorRed (group->screen)) / (2 * 65535.0f);
- g = (groupGetTabHighlightColorGreen (group->screen) +
- groupGetTabBaseColorGreen (group->screen)) / (2 * 65535.0f);
- b = (groupGetTabHighlightColorBlue (group->screen) +
- groupGetTabBaseColorBlue (group->screen)) / (2 * 65535.0f);
- a = (groupGetTabHighlightColorAlpha (group->screen) +
- groupGetTabBaseColorAlpha (group->screen)) / (2 * 65535.0f);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
-
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-
- cairo_restore (cr);
-
- /* draw shape again for the outline */
- x0 = borderWidth / 2.0;
- y0 = borderWidth / 2.0;
- x1 = width - borderWidth / 2.0;
- y1 = height - borderWidth / 2.0;
- radius = groupGetBorderRadius (group->screen);
- cairo_move_to (cr, x0 + radius, y0);
- cairo_arc (cr, x1 - radius, y0 + radius,
- radius, M_PI * 1.5, M_PI * 2.0);
- cairo_arc (cr, x1 - radius, y1 - radius, radius, 0.0, M_PI * 0.5);
- cairo_arc (cr, x0 + radius, y1 - radius, radius, M_PI * 0.5, M_PI);
- cairo_arc (cr, x0 + radius, y0 + radius, radius, M_PI, M_PI * 1.5);
-
- break;
- }
-
- default:
- break;
+ double animationProgress;
+ double alpha;
+
+ animationProgress = bar->bgAnimationTime /
+ (groupGetPulseTime (s) * 1000.0);
+ alpha = fabs (sin (PI * animationProgress)) * 0.75;
+ if (alpha <= 0)
+ break;
+
+ cairo_save (cr);
+ cairo_clip (cr);
+ cairo_set_operator (cr, CAIRO_OPERATOR_XOR);
+ cairo_rectangle (cr, 0.0, 0.0, width, height);
+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha);
+ cairo_fill (cr);
+ cairo_restore (cr);
+ break;
}
- /* outline */
- r = groupGetTabBorderColorRed (group->screen) / 65535.0f;
- g = groupGetTabBorderColorGreen (group->screen) / 65535.0f;
- b = groupGetTabBorderColorBlue (group->screen) / 65535.0f;
- a = groupGetTabBorderColorAlpha (group->screen) / 65535.0f;
- cairo_set_source_rgba (cr, r, g, b, a);
- if (bar->bgAnimation != AnimationNone)
- cairo_stroke_preserve (cr);
- else
- cairo_stroke (cr);
-
- switch (bar->bgAnimation)
+ case AnimationReflex:
{
- case AnimationPulse:
- {
- double animationProgress;
- double alpha;
-
- animationProgress = bar->bgAnimationTime /
- (groupGetPulseTime (group->screen) * 1000.0);
- alpha = fabs (sin (PI * animationProgress)) * 0.75;
- if (alpha <= 0)
- break;
-
- cairo_save (cr);
- cairo_clip (cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_XOR);
- cairo_rectangle (cr, 0.0, 0.0, width, height);
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha);
- cairo_fill (cr);
- cairo_restore (cr);
- break;
- }
-
- case AnimationReflex:
- {
- double animationProgress;
- double reflexWidth;
- double posX, alpha;
- cairo_pattern_t *pattern;
-
- animationProgress = bar->bgAnimationTime /
- (groupGetReflexTime (group->screen) * 1000.0);
- reflexWidth = (bar->nSlots / 2.0) * 30;
- posX = (width + reflexWidth * 2.0) * animationProgress;
- alpha = sin (PI * animationProgress) * 0.55;
- if (alpha <= 0)
- break;
-
- cairo_save (cr);
- cairo_clip (cr);
- pattern = cairo_pattern_create_linear (posX - reflexWidth,
- 0.0, posX, height);
- cairo_pattern_add_color_stop_rgba (pattern,
- 0.0f, 1.0, 1.0, 1.0, 0.0);
- cairo_pattern_add_color_stop_rgba (pattern,
- 0.5f, 1.0, 1.0, 1.0, alpha);
- cairo_pattern_add_color_stop_rgba (pattern,
- 1.0f, 1.0, 1.0, 1.0, 0.0);
- cairo_rectangle (cr, 0.0, 0.0, width, height);
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
- cairo_restore (cr);
- break;
- }
-
- case AnimationNone:
- default:
- break;
+ double animationProgress;
+ double reflexWidth;
+ double posX, alpha;
+ cairo_pattern_t *pattern;
+
+ animationProgress = bar->bgAnimationTime /
+ (groupGetReflexTime (s) * 1000.0);
+ reflexWidth = (bar->nSlots / 2.0) * 30;
+ posX = (width + reflexWidth * 2.0) * animationProgress;
+ alpha = sin (PI * animationProgress) * 0.55;
+ if (alpha <= 0)
+ break;
+
+ cairo_save (cr);
+ cairo_clip (cr);
+ pattern = cairo_pattern_create_linear (posX - reflexWidth,
+ 0.0, posX, height);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 0.0f, 1.0, 1.0, 1.0, 0.0);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 0.5f, 1.0, 1.0, 1.0, alpha);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 1.0f, 1.0, 1.0, 1.0, 0.0);
+ cairo_rectangle (cr, 0.0, 0.0, width, height);
+ cairo_set_source (cr, pattern);
+ cairo_fill (cr);
+ cairo_restore (cr);
+ break;
}
- cairo_restore (cr);
- imageBufferToTexture (group->screen,
- &layer->texture, (char*) layer->buffer,
- layer->texWidth, layer->texHeight);
+ case AnimationNone:
+ default:
+ break;
+ }
+
+ cairo_restore (cr);
+ imageBufferToTexture (s, &layer->texture, (char*) layer->buffer,
+ layer->texWidth, layer->texHeight);
}
/*
@@ -614,86 +618,83 @@ groupRenderTabBarBackground(GroupSelection *group)
void
groupRenderWindowTitle (GroupSelection *group)
{
- GroupTabBar *bar;
- GroupCairoLayer *layer;
- void *data = NULL;
- int width, height;
- int stride;
- Bool hasText = FALSE;
- CompTextAttrib textAttrib;
- CompDisplay *d = group->screen->display;
-
- GROUP_DISPLAY (d);
-
- if (!group->tabBar || !HAS_TOP_WIN(group) || !group->tabBar->textLayer)
- return;
-
- bar = group->tabBar;
-
- width = bar->region->extents.x2 - bar->region->extents.x1;
- height = bar->region->extents.y2 - bar->region->extents.y1;
-
- bar->textLayer = groupRebuildCairoLayer (group->screen,
- bar->textLayer, width, height);
- layer = bar->textLayer;
- if (!layer)
- return;
-
- textAttrib.family = "Sans";
- textAttrib.size = groupGetTabbarFontSize (group->screen);
- textAttrib.style = TEXT_STYLE_BOLD;
- textAttrib.color[0] = groupGetTabbarFontColorRed (group->screen);
- textAttrib.color[1] = groupGetTabbarFontColorGreen (group->screen);
- textAttrib.color[2] = groupGetTabbarFontColorBlue (group->screen);
- textAttrib.color[3] = groupGetTabbarFontColorAlpha (group->screen);
- textAttrib.ellipsize = TRUE;
-
- textAttrib.maxWidth = width;
- textAttrib.maxHeight = height;
- textAttrib.screen = group->screen;
- textAttrib.renderMode = TextRenderWindowTitle;
-
- if (bar->textSlot && bar->textSlot->window)
- textAttrib.data = (void*) bar->textSlot->window->id;
- else
- textAttrib.data = 0;
-
- if (gd->textAvailable)
- hasText = (*d->fileToImage) (d, TEXT_ID, (const char*) &textAttrib,
- &width, &height, &stride, &data);
-
- if (!hasText)
+ GroupCairoLayer *layer;
+ void *data = NULL;
+ int width, height;
+ int stride;
+ Bool hasText = FALSE;
+ CompTextAttrib textAttrib;
+ CompScreen *s = group->screen;
+ CompDisplay *d = s->display;
+ GroupTabBar *bar = group->tabBar;
+
+ GROUP_DISPLAY (d);
+
+ if (!bar || !HAS_TOP_WIN (group) || !bar->textLayer)
+ return;
+
+ width = bar->region->extents.x2 - bar->region->extents.x1;
+ height = bar->region->extents.y2 - bar->region->extents.y1;
+
+ bar->textLayer = groupRebuildCairoLayer (s, bar->textLayer, width, height);
+ layer = bar->textLayer;
+ if (!layer)
+ return;
+
+ textAttrib.family = "Sans";
+ textAttrib.size = groupGetTabbarFontSize (s);
+ textAttrib.style = TEXT_STYLE_BOLD;
+ textAttrib.color[0] = groupGetTabbarFontColorRed (s);
+ textAttrib.color[1] = groupGetTabbarFontColorGreen (s);
+ textAttrib.color[2] = groupGetTabbarFontColorBlue (s);
+ textAttrib.color[3] = groupGetTabbarFontColorAlpha (s);
+ textAttrib.ellipsize = TRUE;
+
+ textAttrib.maxWidth = width;
+ textAttrib.maxHeight = height;
+ textAttrib.screen = s;
+ textAttrib.renderMode = TextRenderWindowTitle;
+
+ if (bar->textSlot && bar->textSlot->window)
+ textAttrib.data = (void*) bar->textSlot->window->id;
+ else
+ textAttrib.data = 0;
+
+ if (gd->textAvailable)
+ hasText = (*d->fileToImage) (d, TEXT_ID, (const char*) &textAttrib,
+ &width, &height, &stride, &data);
+
+ if (!hasText)
+ {
+ /* getting the pixmap failed, so create an empty one */
+ Pixmap emptyPixmap;
+ emptyPixmap = XCreatePixmap (d->display, s->root, width, height, 32);
+
+ if (emptyPixmap)
{
- /* getting the pixmap failed, so create an empty one */
- Pixmap emptyPixmap;
- emptyPixmap = XCreatePixmap (d->display, group->screen->root,
- width, height, 32);
-
- if (emptyPixmap)
- {
- XGCValues gcv;
- GC gc;
+ XGCValues gcv;
+ GC gc;
- gcv.foreground = 0x00000000;
- gcv.plane_mask = 0xffffffff;
+ gcv.foreground = 0x00000000;
+ gcv.plane_mask = 0xffffffff;
- gc = XCreateGC (d->display, emptyPixmap,
- GCForeground, &gcv);
+ gc = XCreateGC (d->display, emptyPixmap,
+ GCForeground, &gcv);
- XFillRectangle (d->display, emptyPixmap, gc,
- 0, 0, width, height);
+ XFillRectangle (d->display, emptyPixmap, gc,
+ 0, 0, width, height);
- XFreeGC (d->display, gc);
+ XFreeGC (d->display, gc);
- data = (void*) emptyPixmap;
- }
+ data = (void*) emptyPixmap;
}
+ }
- layer->texWidth = width;
- layer->texHeight = height;
+ layer->texWidth = width;
+ layer->texHeight = height;
- if (data)
- bindPixmapToTexture (group->screen, &layer->texture, (Pixmap) data,
- layer->texWidth, layer->texHeight, 32);
+ if (data)
+ bindPixmapToTexture (s, &layer->texture, (Pixmap) data,
+ layer->texWidth, layer->texHeight, 32);
}
diff --git a/group-internal.h b/group-internal.h
index 283ced4..ad20e69 100644
--- a/group-internal.h
+++ b/group-internal.h
@@ -66,24 +66,24 @@
((GroupWindow *) (w)->base.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)))
+ 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_CENTER_X(w) (WIN_X(w) + (WIN_WIDTH(w) / 2))
-#define WIN_CENTER_Y(w) (WIN_Y(w) + (WIN_HEIGHT(w) / 2))
+#define WIN_CENTER_X(w) (WIN_X (w) + (WIN_WIDTH (w) / 2))
+#define WIN_CENTER_Y(w) (WIN_Y (w) + (WIN_HEIGHT (w) / 2))
/* 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)
+ w->input.left + w->input.right)
#define WIN_REAL_HEIGHT(w) (w->height + 2 * w->attrib.border_width + \
- w->input.top + w->input.bottom)
+ w->input.top + w->input.bottom)
#define TOP_TAB(g) ((g)->topTab->window)
#define PREV_TOP_TAB(g) ((g)->prevTopTab->window)
@@ -91,12 +91,12 @@
#define HAS_TOP_WIN(group) (((group)->topTab) && ((group)->topTab->window))
#define HAS_PREV_TOP_WIN(group) (((group)->prevTopTab) && \
- ((group)->prevTopTab->window))
+ ((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))
+#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
@@ -107,42 +107,42 @@
* Window states
*/
typedef enum {
- WindowNormal = 0,
- WindowMinimized,
- WindowShaded
+ WindowNormal = 0,
+ WindowMinimized,
+ WindowShaded
} GroupWindowState;
/*
* Screengrab states
*/
typedef enum {
- ScreenGrabNone = 0,
- ScreenGrabSelect,
- ScreenGrabTabDrag
+ ScreenGrabNone = 0,
+ ScreenGrabSelect,
+ ScreenGrabTabDrag
} GroupScreenGrabState;
/*
* Ungrouping states
*/
typedef enum {
- UngroupNone = 0,
- UngroupAll,
- UngroupSingle
+ UngroupNone = 0,
+ UngroupAll,
+ UngroupSingle
} GroupUngroupState;
/*
* Rotation direction for change tab animation
*/
typedef enum {
- RotateUncertain = 0,
- RotateLeft,
- RotateRight
+ RotateUncertain = 0,
+ RotateLeft,
+ RotateRight
} ChangeTabAnimationDirection;
typedef struct _GlowTextureProperties {
- char *textureData;
- int textureSize;
- int glowOffset;
+ char *textureData;
+ int textureSize;
+ int glowOffset;
} GlowTextureProperties;
/*
@@ -150,28 +150,28 @@ typedef struct _GlowTextureProperties {
*/
typedef struct _GroupPendingMoves GroupPendingMoves;
struct _GroupPendingMoves {
- CompWindow *w;
- int dx;
- int dy;
- Bool immediate;
- Bool sync;
- GroupPendingMoves *next;
+ 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;
+ CompWindow *w;
+ int x;
+ int y;
+ unsigned int state;
+ unsigned int mask;
+ GroupPendingGrabs *next;
};
typedef struct _GroupPendingUngrabs GroupPendingUngrabs;
struct _GroupPendingUngrabs {
- CompWindow *w;
- GroupPendingUngrabs *next;
+ CompWindow *w;
+ GroupPendingUngrabs *next;
};
/*
@@ -184,54 +184,54 @@ extern int groupDisplayPrivateIndex;
*/
/* Mask values for groupTabSetVisibility */
-#define SHOW_BAR_INSTANTLY_MASK (1 << 0)
-#define PERMANENT (1 << 1)
+#define SHOW_BAR_INSTANTLY_MASK (1 << 0)
+#define PERMANENT (1 << 1)
/* Mask values for tabbing animation */
-#define IS_ANIMATED (1 << 0)
+#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)
-#define IS_UNGROUPING (1 << 5)
+#define IS_UNGROUPING (1 << 5)
typedef enum {
- PaintOff = 0,
- PaintFadeIn,
- PaintFadeOut,
- PaintOn,
- PaintPermanentOn
+ PaintOff = 0,
+ PaintFadeIn,
+ PaintFadeOut,
+ PaintOn,
+ PaintPermanentOn
} PaintState;
typedef enum {
- AnimationNone = 0,
- AnimationPulse,
- AnimationReflex
+ AnimationNone = 0,
+ AnimationPulse,
+ AnimationReflex
} GroupAnimationType;
typedef enum {
- NoTabChange = 0,
- TabChangeOldOut,
- TabChangeNewIn
+ NoTabChange = 0,
+ TabChangeOldOut,
+ TabChangeNewIn
} TabChangeState;
typedef enum {
- NoTabbing = 0,
- Tabbing,
- Untabbing
+ NoTabbing = 0,
+ Tabbing,
+ Untabbing
} TabbingState;
typedef struct _GroupCairoLayer {
- unsigned char *buffer;
- CompTexture texture;
- cairo_surface_t *surface;
- cairo_t *cairo;
+ unsigned char *buffer;
+ CompTexture texture;
+ cairo_surface_t *surface;
+ cairo_t *cairo;
- int texWidth;
- int texHeight;
+ int texWidth;
+ int texHeight;
- PaintState state;
- int animationTime;
+ PaintState state;
+ int animationTime;
} GroupCairoLayer;
/*
@@ -239,48 +239,48 @@ typedef struct _GroupCairoLayer {
*/
typedef struct _GroupTabBarSlot GroupTabBarSlot;
struct _GroupTabBarSlot {
- GroupTabBarSlot *prev;
- GroupTabBarSlot *next;
+ GroupTabBarSlot *prev;
+ GroupTabBarSlot *next;
- Region region;
+ Region region;
- CompWindow *window;
+ CompWindow *window;
- /* For DnD animations */
- int springX;
- int speed;
- float msSinceLastMove;
+ /* 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;
-
- /* For animations */
- int bgAnimationTime;
- GroupAnimationType bgAnimation;
-
- PaintState state;
- int timeoutHandle;
- int animationTime;
- Region region;
- int oldWidth;
-
- /* For DnD animations */
- int leftSpringX, rightSpringX;
- int leftSpeed, rightSpeed;
- float leftMsSinceLastMove, rightMsSinceLastMove;
+ GroupTabBarSlot *slots;
+ GroupTabBarSlot *revSlots;
+ int nSlots;
+
+ GroupTabBarSlot *hoveredSlot;
+ GroupTabBarSlot *textSlot;
+
+ GroupCairoLayer *textLayer;
+ GroupCairoLayer *bgLayer;
+ GroupCairoLayer *selectionLayer;
+
+ /* For animations */
+ int bgAnimationTime;
+ GroupAnimationType bgAnimation;
+
+ PaintState state;
+ int timeoutHandle;
+ int animationTime;
+ Region region;
+ int oldWidth;
+
+ /* For DnD animations */
+ int leftSpringX, rightSpringX;
+ int leftSpeed, rightSpeed;
+ float leftMsSinceLastMove, rightMsSinceLastMove;
} GroupTabBar;
/*
@@ -288,14 +288,14 @@ typedef struct _GroupTabBar {
*/
typedef struct _GlowQuad {
- BoxRec box;
- CompMatrix matrix;
+ BoxRec box;
+ CompMatrix matrix;
} GlowQuad;
#define GLOWQUAD_TOPLEFT 0
#define GLOWQUAD_TOPRIGHT 1
#define GLOWQUAD_BOTTOMLEFT 2
-#define GLOWQUAD_BOTTOMRIGHT 3
+#define GLOWQUAD_BOTTOMRIGHT 3
#define GLOWQUAD_TOP 4
#define GLOWQUAD_BOTTOM 5
#define GLOWQUAD_LEFT 6
@@ -307,166 +307,166 @@ typedef struct _GlowQuad {
*/
typedef struct _GroupSelection GroupSelection;
struct _GroupSelection {
- GroupSelection *prev;
- GroupSelection *next;
+ GroupSelection *prev;
+ GroupSelection *next;
- CompScreen *screen;
- CompWindow **windows;
- int nWins;
+ CompScreen *screen;
+ CompWindow **windows;
+ int nWins;
- /* Unique identifier for this group */
- long int identifier;
+ /* Unique identifier for this group */
+ long int identifier;
- GroupTabBarSlot* topTab;
- GroupTabBarSlot* prevTopTab;
+ GroupTabBarSlot* topTab;
+ GroupTabBarSlot* prevTopTab;
- /* needed for untabbing animation */
- CompWindow *lastTopTab;
+ /* needed for untabbing animation */
+ CompWindow *lastTopTab;
- /* 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;
+ /* 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;
+ GroupTabBarSlot *activateTab;
- GroupTabBar *tabBar;
+ GroupTabBar *tabBar;
- int changeAnimationTime;
- int changeAnimationDirection;
- TabChangeState changeState;
+ int changeAnimationTime;
+ int changeAnimationDirection;
+ TabChangeState changeState;
- TabbingState tabbingState;
+ TabbingState tabbingState;
- GroupUngroupState ungroupState;
+ GroupUngroupState ungroupState;
- Window grabWindow;
- unsigned int grabMask;
+ Window grabWindow;
+ unsigned int grabMask;
- Window inputPrevention;
- Bool ipwMapped;
+ Window inputPrevention;
+ Bool ipwMapped;
- GLushort color[4];
+ GLushort color[4];
};
typedef struct _GroupWindowHideInfo {
- Window frameWindow;
+ Window frameWindow;
- unsigned long skipState;
- unsigned long shapeMask;
+ unsigned long skipState;
+ unsigned long shapeMask;
- XRectangle *inputRects;
- int nInputRects;
- int inputRectOrdering;
+ XRectangle *inputRects;
+ int nInputRects;
+ int inputRectOrdering;
} GroupWindowHideInfo;
typedef struct _GroupResizeInfo {
- CompWindow *resizedWindow;
- XRectangle origGeometry;
+ CompWindow *resizedWindow;
+ XRectangle origGeometry;
} GroupResizeInfo;
/*
* GroupDisplay structure
*/
typedef struct _GroupDisplay {
- int screenPrivateIndex;
+ int screenPrivateIndex;
- HandleEventProc handleEvent;
+ HandleEventProc handleEvent;
- Bool ignoreMode;
+ Bool ignoreMode;
- GroupResizeInfo *resizeInfo;
+ GroupResizeInfo *resizeInfo;
- GlowTextureProperties *glowTextureProperties;
+ GlowTextureProperties *glowTextureProperties;
- GroupSelection *lastRestackedGroup;
+ GroupSelection *lastRestackedGroup;
- Atom groupWinPropertyAtom;
- Atom resizeNotifyAtom;
+ Atom groupWinPropertyAtom;
+ Atom resizeNotifyAtom;
- Bool textAvailable;
+ Bool textAvailable;
} GroupDisplay;
/*
* GroupScreen structure
*/
typedef struct _GroupScreen {
- int windowPrivateIndex;
-
- WindowMoveNotifyProc windowMoveNotify;
- WindowResizeNotifyProc windowResizeNotify;
- GetOutputExtentsForWindowProc getOutputExtentsForWindow;
- PreparePaintScreenProc preparePaintScreen;
- PaintOutputProc paintOutput;
- DrawWindowProc drawWindow;
- PaintWindowProc paintWindow;
- PaintTransformedOutputProc paintTransformedOutput;
- DonePaintScreenProc donePaintScreen;
- WindowGrabNotifyProc windowGrabNotify;
- WindowUngrabNotifyProc windowUngrabNotify;
- DamageWindowRectProc damageWindowRect;
- WindowStateChangeNotifyProc windowStateChangeNotify;
-
- GroupPendingMoves *pendingMoves;
- GroupPendingGrabs *pendingGrabs;
- GroupPendingUngrabs *pendingUngrabs;
- Bool dequeueTimerSet;
-
- GroupSelection *groups;
- GroupSelection tmpSel;
-
- Bool queued;
-
- GroupScreenGrabState grabState;
- int grabIndex;
-
- GroupSelection *lastHoveredGroup;
-
- int showDelayTimeoutHandle;
-
- /* For selection */
- Bool painted;
- int vpX, vpY;
- int x1, y1, x2, y2;
-
- /* For d&d */
- GroupTabBarSlot *draggedSlot;
- int dragHoverTimeoutHandle;
- Bool dragged;
- int prevX, prevY; /* Buffer for mouse coordinates */
-
- CompTexture glowTexture;
+ int windowPrivateIndex;
+
+ WindowMoveNotifyProc windowMoveNotify;
+ WindowResizeNotifyProc windowResizeNotify;
+ GetOutputExtentsForWindowProc getOutputExtentsForWindow;
+ PreparePaintScreenProc preparePaintScreen;
+ PaintOutputProc paintOutput;
+ DrawWindowProc drawWindow;
+ PaintWindowProc paintWindow;
+ PaintTransformedOutputProc paintTransformedOutput;
+ DonePaintScreenProc donePaintScreen;
+ WindowGrabNotifyProc windowGrabNotify;
+ WindowUngrabNotifyProc windowUngrabNotify;
+ DamageWindowRectProc damageWindowRect;
+ WindowStateChangeNotifyProc windowStateChangeNotify;
+
+ GroupPendingMoves *pendingMoves;
+ GroupPendingGrabs *pendingGrabs;
+ GroupPendingUngrabs *pendingUngrabs;
+ Bool dequeueTimerSet;
+
+ GroupSelection *groups;
+ GroupSelection tmpSel;
+
+ Bool queued;
+
+ GroupScreenGrabState grabState;
+ int grabIndex;
+
+ GroupSelection *lastHoveredGroup;
+
+ CompTimeoutHandle showDelayTimeoutHandle;
+
+ /* For selection */
+ Bool painted;
+ int vpX, vpY;
+ int x1, y1, x2, y2;
+
+ /* For d&d */
+ GroupTabBarSlot *draggedSlot;
+ CompTimeoutHandle dragHoverTimeoutHandle;
+ Bool dragged;
+ int prevX, prevY; /* Buffer for mouse coordinates */
+
+ CompTexture glowTexture;
} GroupScreen;
/*
* GroupWindow structure
*/
typedef struct _GroupWindow {
- GroupSelection *group;
- Bool inSelection;
+ GroupSelection *group;
+ Bool inSelection;
- /* For the tab bar */
- GroupTabBarSlot *slot;
+ /* For the tab bar */
+ GroupTabBarSlot *slot;
- Bool needsPosSync;
+ Bool needsPosSync;
- GlowQuad *glowQuads;
+ GlowQuad *glowQuads;
- GroupWindowState windowState;
- GroupWindowHideInfo *windowHideInfo;
+ GroupWindowState windowState;
+ GroupWindowHideInfo *windowHideInfo;
- XRectangle *resizeGeometry;
+ XRectangle *resizeGeometry;
- /* For tab animation */
- int animateState;
- XPoint mainTabOffset;
- XPoint destination;
- XPoint orgPos;
+ /* For tab animation */
+ int animateState;
+ XPoint mainTabOffset;
+ XPoint destination;
+ XPoint orgPos;
- float tx,ty;
- float xVelocity, yVelocity;
+ float tx,ty;
+ float xVelocity, yVelocity;
} GroupWindow;
/*
@@ -483,17 +483,17 @@ groupUpdateWindowProperty (CompWindow *w);
Bool
groupCheckWindowProperty (CompWindow *w,
- long int *id,
- Bool *tabbed,
- GLushort *color);
+ long int *id,
+ Bool *tabbed,
+ GLushort *color);
void
groupGrabScreen (CompScreen *s,
- GroupScreenGrabState newState);
+ GroupScreenGrabState newState);
void
groupHandleEvent (CompDisplay *d,
- XEvent *event);
+ XEvent *event);
void
groupDeleteGroupWindow (CompWindow *w);
@@ -506,93 +506,93 @@ groupDeleteGroup (GroupSelection *group);
void
groupAddWindowToGroup (CompWindow *w,
- GroupSelection *group,
- long int initialIdent);
+ GroupSelection *group,
+ long int initialIdent);
Bool
groupGroupWindows (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupUnGroupWindows (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupRemoveWindow (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupCloseWindows (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupChangeColor (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupSetIgnore (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupUnsetIgnore (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
void
groupWindowResizeNotify (CompWindow *w,
- int dx,
- int dy,
- int dwidth,
- int dheight);
+ int dx,
+ int dy,
+ int dwidth,
+ int dheight);
void
groupWindowGrabNotify (CompWindow *w,
- int x,
- int y,
- unsigned int state,
- unsigned int mask);
+ int x,
+ int y,
+ unsigned int state,
+ unsigned int mask);
void
groupWindowUngrabNotify (CompWindow *w);
void
groupWindowMoveNotify (CompWindow *w,
- int dx,
- int dy,
- Bool immediate);
+ int dx,
+ int dy,
+ Bool immediate);
void
groupWindowStateChangeNotify (CompWindow *w,
- unsigned int lastState);
+ unsigned int lastState);
void
groupGetOutputExtentsForWindow (CompWindow *w,
- CompWindowExtents *output);
+ CompWindowExtents *output);
Bool
groupDamageWindowRect (CompWindow *w,
- Bool initial,
- BoxPtr rect);
+ Bool initial,
+ BoxPtr rect);
/*
@@ -604,18 +604,18 @@ groupClearCairoLayer (GroupCairoLayer *layer);
void
groupDestroyCairoLayer (CompScreen *s,
- GroupCairoLayer *layer);
+ GroupCairoLayer *layer);
GroupCairoLayer*
groupRebuildCairoLayer (CompScreen *s,
- GroupCairoLayer *layer,
- int width,
- int height);
+ GroupCairoLayer *layer,
+ int width,
+ int height);
GroupCairoLayer*
groupCreateCairoLayer (CompScreen *s,
- int width,
- int height);
+ int width,
+ int height);
void
groupRenderTopTabHighlight (GroupSelection *group);
@@ -633,11 +633,11 @@ groupRenderWindowTitle (GroupSelection *group);
void
groupSetWindowVisibility (CompWindow *w,
- Bool visible);
+ Bool visible);
void
groupClearWindowInputShape (CompWindow *w,
- GroupWindowHideInfo *hideInfo);
+ GroupWindowHideInfo *hideInfo);
void
groupHandleAnimation (GroupSelection *group);
@@ -647,92 +647,92 @@ groupHandleHoverDetection (GroupSelection *group);
void
groupHandleTabBarFade (GroupSelection *group,
- int msSinceLastPaint);
+ int msSinceLastPaint);
void
groupHandleTabBarAnimation (GroupSelection *group,
- int msSinceLastPaint);
+ int msSinceLastPaint);
void
groupHandleTextFade (GroupSelection *group,
- int msSinceLastPaint);
+ int msSinceLastPaint);
void
groupDrawTabAnimation (GroupSelection *group,
- int msSinceLastPaint);
+ int msSinceLastPaint);
void
groupUpdateTabBars (CompScreen *s,
- Window enteredWin);
+ Window enteredWin);
void
groupGetDrawOffsetForSlot (GroupTabBarSlot *slot,
- int *hoffset,
- int *voffset);
+ int *hoffset,
+ int *voffset);
void
groupTabSetVisibility (GroupSelection *group,
- Bool visible,
- unsigned int mask);
+ Bool visible,
+ unsigned int mask);
Bool
groupGetCurrentMousePosition (CompScreen *s,
- int *x,
- int *y);
+ int *x,
+ int *y);
void
groupRecalcTabBarPos (GroupSelection *group,
- int middleX,
- int minX1,
- int maxX2);
+ int middleX,
+ int minX1,
+ int maxX2);
void
groupInsertTabBarSlotAfter (GroupTabBar *bar,
- GroupTabBarSlot *slot,
- GroupTabBarSlot *prevSlot);
+ GroupTabBarSlot *slot,
+ GroupTabBarSlot *prevSlot);
void
groupInsertTabBarSlotBefore (GroupTabBar *bar,
- GroupTabBarSlot *slot,
- GroupTabBarSlot *nextSlot);
+ GroupTabBarSlot *slot,
+ GroupTabBarSlot *nextSlot);
void
groupInsertTabBarSlot (GroupTabBar *bar,
- GroupTabBarSlot *slot);
+ GroupTabBarSlot *slot);
void
groupUnhookTabBarSlot (GroupTabBar *bar,
- GroupTabBarSlot *slot,
- Bool temporary);
+ GroupTabBarSlot *slot,
+ Bool temporary);
void
groupDeleteTabBarSlot (GroupTabBar *bar,
- GroupTabBarSlot *slot);
+ GroupTabBarSlot *slot);
void
groupCreateSlot (GroupSelection *group,
- CompWindow *w);
+ CompWindow *w);
void
groupApplyForces (CompScreen *s,
- GroupTabBar *bar,
- GroupTabBarSlot *draggedSlot);
+ GroupTabBar *bar,
+ GroupTabBarSlot *draggedSlot);
void
groupApplySpeeds (CompScreen *s,
- GroupSelection *group,
- int msSinceLastRepaint);
+ GroupSelection *group,
+ int msSinceLastRepaint);
void
groupInitTabBar (GroupSelection *group,
- CompWindow *topTab);
+ CompWindow *topTab);
void
groupDeleteTabBar (GroupSelection *group);
void
groupStartTabbingAnimation (GroupSelection *group,
- Bool tab);
+ Bool tab);
void
groupTabGroup (CompWindow *main);
@@ -742,32 +742,32 @@ groupUntabGroup (GroupSelection *group);
Bool
groupInitTab (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupChangeTab (GroupTabBarSlot *topTab,
- ChangeTabAnimationDirection direction);
+ ChangeTabAnimationDirection direction);
Bool
groupChangeTabLeft (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupChangeTabRight (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
void
groupSwitchTopTabInput (GroupSelection *group,
- Bool enable);
+ Bool enable);
void
groupCreateInputPreventionWindow (GroupSelection *group);
@@ -780,14 +780,14 @@ groupGetClippingRegion (CompWindow *w);
void
groupMoveTabBarRegion (GroupSelection *group,
- int dx,
- int dy,
- Bool syncIPW);
+ int dx,
+ int dy,
+ Bool syncIPW);
void
groupResizeTabBarRegion (GroupSelection *group,
- XRectangle *box,
- Bool syncIPW);
+ XRectangle *box,
+ Bool syncIPW);
void
groupDamageTabBarRegion (GroupSelection *group);
@@ -799,54 +799,54 @@ groupDamageTabBarRegion (GroupSelection *group);
void
groupComputeGlowQuads (CompWindow *w,
- CompMatrix *matrix);
+ CompMatrix *matrix);
void
groupPreparePaintScreen (CompScreen *s,
- int msSinceLastPaint);
+ int msSinceLastPaint);
Bool
groupPaintOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask);
+ const ScreenPaintAttrib *sAttrib,
+ const CompTransform *transform,
+ Region region,
+ CompOutput *output,
+ unsigned int mask);
void
groupPaintTransformedOutput (CompScreen *s,
- const ScreenPaintAttrib *sa,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask);
+ const ScreenPaintAttrib *sa,
+ const CompTransform *transform,
+ Region region,
+ CompOutput *output,
+ unsigned int mask);
void
groupDonePaintScreen (CompScreen *s);
Bool
groupDrawWindow (CompWindow *w,
- const CompTransform *transform,
- const FragmentAttrib *attrib,
- Region region,
- unsigned int mask);
+ const CompTransform *transform,
+ const FragmentAttrib *attrib,
+ Region region,
+ unsigned int mask);
void
groupGetStretchRectangle (CompWindow *w,
- BoxPtr pBox,
- float *xScale,
- float *yScale);
+ BoxPtr pBox,
+ float *xScale,
+ float *yScale);
void
groupDamagePaintRectangle (CompScreen *s,
- BoxPtr pBox);
+ BoxPtr pBox);
Bool
groupPaintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask);
+ const WindowPaintAttrib *attrib,
+ const CompTransform *transform,
+ Region region,
+ unsigned int mask);
/*
@@ -855,20 +855,20 @@ groupPaintWindow (CompWindow *w,
void
groupEnqueueMoveNotify (CompWindow *w,
- int dx,
- int dy,
- Bool immediate,
- Bool sync);
+ 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);
+ int x,
+ int y,
+ unsigned int state,
+ unsigned int mask);
void
groupEnqueueUngrabNotify (CompWindow *w);
@@ -879,27 +879,27 @@ groupEnqueueUngrabNotify (CompWindow *w);
Bool
groupSelectSingle (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool groupSelect (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
Bool
groupSelectTerminate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption);
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
void
groupDamageSelectionRect (CompScreen *s,
- int xRoot,
- int yRoot);
+ int xRoot,
+ int yRoot);
#endif
diff --git a/group.c b/group.c
index d833491..b54a057 100644
--- a/group.c
+++ b/group.c
@@ -34,25 +34,25 @@
static Bool
groupDragHoverTimeout (void* closure)
{
- CompWindow *w = (CompWindow *) closure;
- if (!w)
- return FALSE;
+ CompWindow *w = (CompWindow *) closure;
+ if (!w)
+ return FALSE;
- GROUP_SCREEN (w->screen);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (w->screen);
+ GROUP_WINDOW (w);
- if (groupGetBarAnimations (w->screen))
- {
- GroupTabBar *bar = gw->group->tabBar;
+ if (groupGetBarAnimations (w->screen))
+ {
+ GroupTabBar *bar = gw->group->tabBar;
- bar->bgAnimation = AnimationPulse;
- bar->bgAnimationTime = groupGetPulseTime (w->screen) * 1000;
- }
+ bar->bgAnimation = AnimationPulse;
+ bar->bgAnimationTime = groupGetPulseTime (w->screen) * 1000;
+ }
- activateWindow (w);
- gs->dragHoverTimeoutHandle = 0;
+ activateWindow (w);
+ gs->dragHoverTimeoutHandle = 0;
- return FALSE;
+ return FALSE;
}
/*
@@ -61,42 +61,44 @@ groupDragHoverTimeout (void* closure)
*/
Bool
groupCheckWindowProperty (CompWindow *w,
- long int *id,
- Bool *tabbed,
- GLushort *color)
+ long int *id,
+ Bool *tabbed,
+ GLushort *color)
{
- Atom type;
- int fmt;
- unsigned long nitems, exbyte;
- long int *data;
+ Atom type;
+ int retval, fmt;
+ unsigned long nitems, exbyte;
+ long int *data;
- GROUP_DISPLAY (w->screen->display);
+ GROUP_DISPLAY (w->screen->display);
- if (XGetWindowProperty (w->screen->display->display, w->id,
- gd->groupWinPropertyAtom, 0, 5,
- False, XA_CARDINAL, &type, &fmt,
- &nitems, &exbyte,
- (unsigned char **)&data) == Success)
- {
- if (type == XA_CARDINAL && fmt == 32 && nitems == 5)
- {
- if (id)
- *id = data[0];
- if (tabbed)
- *tabbed = (Bool) data[1];
- if (color) {
- color[0] = (GLushort) data[2];
- color[1] = (GLushort) data[3];
- color[2] = (GLushort) data[4];
- }
+ retval = XGetWindowProperty (w->screen->display->display, w->id,
+ gd->groupWinPropertyAtom, 0, 5, False,
+ XA_CARDINAL, &type, &fmt, &nitems, &exbyte,
+ (unsigned char **)&data);
- XFree (data);
- return TRUE;
- }
- else if (fmt != 0)
- XFree (data);
+ if (retval == Success)
+ {
+ if (type == XA_CARDINAL && fmt == 32 && nitems == 5)
+ {
+ if (id)
+ *id = data[0];
+ if (tabbed)
+ *tabbed = (Bool) data[1];
+ if (color) {
+ color[0] = (GLushort) data[2];
+ color[1] = (GLushort) data[3];
+ color[2] = (GLushort) data[4];
+ }
+
+ XFree (data);
+ return TRUE;
}
- return FALSE;
+ else if (fmt != 0)
+ XFree (data);
+ }
+
+ return FALSE;
}
/*
@@ -106,99 +108,99 @@ groupCheckWindowProperty (CompWindow *w,
void
groupUpdateWindowProperty (CompWindow *w)
{
- CompDisplay *d = w->screen->display;
-
- GROUP_WINDOW (w);
- GROUP_DISPLAY (d);
-
- if (gw->group)
- {
- long int buffer[5];
-
- buffer[0] = gw->group->identifier;
- buffer[1] = (gw->slot) ? TRUE : FALSE;
-
- /* group color RGB */
- buffer[2] = gw->group->color[0];
- buffer[3] = gw->group->color[1];
- buffer[4] = gw->group->color[2];
-
- XChangeProperty (d->display, w->id, gd->groupWinPropertyAtom,
- XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *) buffer, 5);
- }
- else
- {
- XDeleteProperty (d->display, w->id, gd->groupWinPropertyAtom);
- }
+ CompDisplay *d = w->screen->display;
+
+ GROUP_WINDOW (w);
+ GROUP_DISPLAY (d);
+
+ if (gw->group)
+ {
+ long int buffer[5];
+
+ buffer[0] = gw->group->identifier;
+ buffer[1] = (gw->slot) ? TRUE : FALSE;
+
+ /* group color RGB */
+ buffer[2] = gw->group->color[0];
+ buffer[3] = gw->group->color[1];
+ buffer[4] = gw->group->color[2];
+
+ XChangeProperty (d->display, w->id, gd->groupWinPropertyAtom,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) buffer, 5);
+ }
+ else
+ {
+ XDeleteProperty (d->display, w->id, gd->groupWinPropertyAtom);
+ }
}
static unsigned int
groupUpdateResizeRectangle (CompWindow *w,
- XRectangle *masterGeometry,
- Bool damage)
+ XRectangle *masterGeometry,
+ Bool damage)
{
- XRectangle newGeometry;
- unsigned int mask = 0;
- int newWidth, newHeight;
- int widthDiff, heightDiff;
-
- GROUP_WINDOW (w);
- GROUP_DISPLAY (w->screen->display);
-
- if (!gw->resizeGeometry || !gd->resizeInfo)
- return 0;
-
- newGeometry.x = WIN_X (w) + (masterGeometry->x -
- gd->resizeInfo->origGeometry.x);
- newGeometry.y = WIN_Y (w) + (masterGeometry->y -
- gd->resizeInfo->origGeometry.y);
-
- widthDiff = masterGeometry->width - gd->resizeInfo->origGeometry.width;
- newGeometry.width = MAX (1, WIN_WIDTH (w) + widthDiff);
- heightDiff = masterGeometry->height - gd->resizeInfo->origGeometry.height;
- newGeometry.height = MAX (1, WIN_HEIGHT (w) + heightDiff);
-
- if (constrainNewWindowSize (w,
- newGeometry.width, newGeometry.height,
- &newWidth, &newHeight))
+ XRectangle newGeometry;
+ unsigned int mask = 0;
+ int newWidth, newHeight;
+ int widthDiff, heightDiff;
+
+ GROUP_WINDOW (w);
+ GROUP_DISPLAY (w->screen->display);
+
+ if (!gw->resizeGeometry || !gd->resizeInfo)
+ return 0;
+
+ newGeometry.x = WIN_X (w) + (masterGeometry->x -
+ gd->resizeInfo->origGeometry.x);
+ newGeometry.y = WIN_Y (w) + (masterGeometry->y -
+ gd->resizeInfo->origGeometry.y);
+
+ widthDiff = masterGeometry->width - gd->resizeInfo->origGeometry.width;
+ newGeometry.width = MAX (1, WIN_WIDTH (w) + widthDiff);
+ heightDiff = masterGeometry->height - gd->resizeInfo->origGeometry.height;
+ newGeometry.height = MAX (1, WIN_HEIGHT (w) + heightDiff);
+
+ if (constrainNewWindowSize (w,
+ newGeometry.width, newGeometry.height,
+ &newWidth, &newHeight))
+ {
+
+ newGeometry.width = newWidth;
+ newGeometry.height = newHeight;
+ }
+
+ if (damage)
+ {
+ if (memcmp (&newGeometry, gw->resizeGeometry,
+ sizeof (newGeometry)) != 0)
{
-
- newGeometry.width = newWidth;
- newGeometry.height = newHeight;
- }
-
- if (damage)
- {
- if (memcmp (&newGeometry, gw->resizeGeometry,
- sizeof (newGeometry)) != 0)
- {
- addWindowDamage (w);
- }
- }
-
- if (newGeometry.x != gw->resizeGeometry->x)
- {
- gw->resizeGeometry->x = newGeometry.x;
- mask |= CWX;
- }
- if (newGeometry.y != gw->resizeGeometry->y)
- {
- gw->resizeGeometry->y = newGeometry.y;
- mask |= CWY;
- }
- if (newGeometry.width != gw->resizeGeometry->width)
- {
- gw->resizeGeometry->width = newGeometry.width;
- mask |= CWWidth;
- }
- if (newGeometry.height != gw->resizeGeometry->height)
- {
- gw->resizeGeometry->height = newGeometry.height;
- mask |= CWHeight;
+ addWindowDamage (w);
}
-
- return mask;
+ }
+
+ if (newGeometry.x != gw->resizeGeometry->x)
+ {
+ gw->resizeGeometry->x = newGeometry.x;
+ mask |= CWX;
+ }
+ if (newGeometry.y != gw->resizeGeometry->y)
+ {
+ gw->resizeGeometry->y = newGeometry.y;
+ mask |= CWY;
+ }
+ if (newGeometry.width != gw->resizeGeometry->width)
+ {
+ gw->resizeGeometry->width = newGeometry.width;
+ mask |= CWWidth;
+ }
+ if (newGeometry.height != gw->resizeGeometry->height)
+ {
+ gw->resizeGeometry->height = newGeometry.height;
+ mask |= CWHeight;
+ }
+
+ return mask;
}
/*
@@ -207,26 +209,26 @@ groupUpdateResizeRectangle (CompWindow *w,
*/
void
groupGrabScreen (CompScreen *s,
- GroupScreenGrabState newState)
+ GroupScreenGrabState newState)
{
- GROUP_SCREEN (s);
-
- if ((gs->grabState != newState) && gs->grabIndex)
- {
- removeScreenGrab (s, gs->grabIndex, NULL);
- gs->grabIndex = 0;
- }
-
- if (newState == ScreenGrabSelect)
- {
- gs->grabIndex = pushScreenGrab (s, None, "group");
- }
- else if (newState == ScreenGrabTabDrag)
- {
- gs->grabIndex = pushScreenGrab (s, None, "group-drag");
- }
-
- gs->grabState = newState;
+ GROUP_SCREEN (s);
+
+ if ((gs->grabState != newState) && gs->grabIndex)
+ {
+ removeScreenGrab (s, gs->grabIndex, NULL);
+ gs->grabIndex = 0;
+ }
+
+ if (newState == ScreenGrabSelect)
+ {
+ gs->grabIndex = pushScreenGrab (s, None, "group");
+ }
+ else if (newState == ScreenGrabTabDrag)
+ {
+ gs->grabIndex = pushScreenGrab (s, None, "group-drag");
+ }
+
+ gs->grabState = newState;
}
/*
@@ -235,30 +237,30 @@ groupGrabScreen (CompScreen *s,
*/
static void
groupRaiseWindows (CompWindow *top,
- GroupSelection *group)
+ GroupSelection *group)
{
- CompWindow **stack;
- CompWindow *w;
- int count = 0, i;
+ CompWindow **stack;
+ CompWindow *w;
+ int count = 0, i;
- if (group->nWins == 1)
- return;
+ if (group->nWins == 1)
+ return;
- stack = malloc ((group->nWins - 1) * sizeof (CompWindow *));
- if (!stack)
- return;
+ stack = malloc ((group->nWins - 1) * sizeof (CompWindow *));
+ if (!stack)
+ return;
- for (w = group->screen->windows; w; w = w->next)
- {
- GROUP_WINDOW (w);
- if ((w->id != top->id) && (gw->group == group))
- stack[count++] = w;
- }
+ for (w = group->screen->windows; w; w = w->next)
+ {
+ GROUP_WINDOW (w);
+ if ((w->id != top->id) && (gw->group == group))
+ stack[count++] = w;
+ }
- for (i = 0; i < count; i++)
- restackWindowBelow (stack[i], top);
+ for (i = 0; i < count; i++)
+ restackWindowBelow (stack[i], top);
- free (stack);
+ free (stack);
}
/*
@@ -267,21 +269,21 @@ groupRaiseWindows (CompWindow *top,
*/
static void
groupMinimizeWindows (CompWindow *top,
- GroupSelection *group,
- Bool minimize)
+ GroupSelection *group,
+ Bool minimize)
{
- int i;
- for (i = 0; i < group->nWins; i++)
- {
- CompWindow *w = group->windows[i];
- if (w->id == top->id)
- continue;
-
- if (minimize)
- minimizeWindow (w);
- else
- unminimizeWindow (w);
- }
+ int i;
+ for (i = 0; i < group->nWins; i++)
+ {
+ CompWindow *w = group->windows[i];
+ if (w->id == top->id)
+ continue;
+
+ if (minimize)
+ minimizeWindow (w);
+ else
+ unminimizeWindow (w);
+ }
}
/*
@@ -290,26 +292,26 @@ groupMinimizeWindows (CompWindow *top,
*/
static void
groupShadeWindows (CompWindow *top,
- GroupSelection *group,
- Bool shade)
+ GroupSelection *group,
+ Bool shade)
{
- int i;
- unsigned int state;
+ int i;
+ unsigned int state;
- for (i = 0; i < group->nWins; i++)
- {
- CompWindow *w = group->windows[i];
- if (w->id == top->id)
- continue;
+ for (i = 0; i < group->nWins; i++)
+ {
+ CompWindow *w = group->windows[i];
+ if (w->id == top->id)
+ continue;
- if (shade)
- state = w->state | CompWindowStateShadedMask;
- else
- state = w->state & ~CompWindowStateShadedMask;
+ if (shade)
+ state = w->state | CompWindowStateShadedMask;
+ else
+ state = w->state & ~CompWindowStateShadedMask;
- changeWindowState (w, state);
- updateWindowAttributes (w, CompStackingUpdateModeNone);
- }
+ changeWindowState (w, state);
+ updateWindowAttributes (w, CompStackingUpdateModeNone);
+ }
}
/*
@@ -319,145 +321,145 @@ groupShadeWindows (CompWindow *top,
void
groupDeleteGroupWindow (CompWindow *w)
{
- GroupSelection *group;
+ GroupSelection *group;
- GROUP_WINDOW (w);
- GROUP_SCREEN (w->screen);
+ GROUP_WINDOW (w);
+ GROUP_SCREEN (w->screen);
- if (!gw->group)
- return;
+ if (!gw->group)
+ return;
- group = gw->group;
+ group = gw->group;
- if (group->tabBar && gw->slot)
+ if (group->tabBar && gw->slot)
+ {
+ if (gs->draggedSlot && gs->dragged &&
+ gs->draggedSlot->window->id == w->id)
{
- if (gs->draggedSlot && gs->dragged &&
- gs->draggedSlot->window->id == w->id)
- {
- groupUnhookTabBarSlot (group->tabBar, gw->slot, FALSE);
- }
- else
- groupDeleteTabBarSlot (group->tabBar, gw->slot);
+ groupUnhookTabBarSlot (group->tabBar, gw->slot, FALSE);
}
+ else
+ groupDeleteTabBarSlot (group->tabBar, gw->slot);
+ }
- if (group->nWins && group->windows)
- {
- CompWindow **buf = group->windows;
-
- if (group->nWins > 1)
- {
- int counter = 0;
- int i;
-
- group->windows = calloc (group->nWins - 1, sizeof(CompWindow *));
-
- for (i = 0; i < group->nWins; i++)
- {
- if (buf[i]->id == w->id)
- continue;
- group->windows[counter++] = buf[i];
- }
- group->nWins = counter;
+ if (group->nWins && group->windows)
+ {
+ CompWindow **buf = group->windows;
- if (group->nWins == 1)
- {
- /* Glow was removed from this window, too */
- damageWindowOutputExtents (group->windows[0]);
- updateWindowOutputExtents (group->windows[0]);
-
- if (groupGetAutoUngroup (w->screen))
- {
- if (group->changeState != NoTabChange)
- {
- /* a change animation is pending: this most
- likely means that a window must be moved
- back onscreen, so we do that here */
- CompWindow *lw = group->windows[0];
-
- groupSetWindowVisibility (lw, TRUE);
- }
- if (!groupGetAutotabCreate (w->screen))
- groupDeleteGroup (group);
- }
- }
- }
- else
+ if (group->nWins > 1)
+ {
+ int counter = 0;
+ int i;
+
+ group->windows = calloc (group->nWins - 1, sizeof(CompWindow *));
+
+ for (i = 0; i < group->nWins; i++)
+ {
+ if (buf[i]->id == w->id)
+ continue;
+ group->windows[counter++] = buf[i];
+ }
+ group->nWins = counter;
+
+ if (group->nWins == 1)
+ {
+ /* Glow was removed from this window, too */
+ damageWindowOutputExtents (group->windows[0]);
+ updateWindowOutputExtents (group->windows[0]);
+
+ if (groupGetAutoUngroup (w->screen))
{
- group->windows = NULL;
+ if (group->changeState != NoTabChange)
+ {
+ /* a change animation is pending: this most
+ likely means that a window must be moved
+ back onscreen, so we do that here */
+ CompWindow *lw = group->windows[0];
+
+ groupSetWindowVisibility (lw, TRUE);
+ }
+ if (!groupGetAutotabCreate (w->screen))
groupDeleteGroup (group);
}
+ }
+ }
+ else
+ {
+ group->windows = NULL;
+ groupDeleteGroup (group);
+ }
- free (buf);
+ free (buf);
- damageWindowOutputExtents (w);
- gw->group = NULL;
- updateWindowOutputExtents (w);
- groupUpdateWindowProperty (w);
- }
+ damageWindowOutputExtents (w);
+ gw->group = NULL;
+ updateWindowOutputExtents (w);
+ groupUpdateWindowProperty (w);
+ }
}
void
groupRemoveWindowFromGroup (CompWindow *w)
{
- GROUP_WINDOW (w);
-
- if (!gw->group)
- return;
-
- if (gw->group->tabBar && !(gw->animateState & IS_UNGROUPING) &&
- (gw->group->nWins > 1))
- {
- GroupSelection *group = gw->group;
+ GROUP_WINDOW (w);
- /* if the group is tabbed, setup untabbing animation. The
- window will be deleted from the group at the
- end of the untabbing. */
- if (HAS_TOP_WIN (group))
- {
- CompWindow *tw = TOP_TAB (group);
- int oldX = gw->orgPos.x;
- int oldY = gw->orgPos.y;
+ if (!gw->group)
+ return;
- gw->orgPos.x = WIN_CENTER_X (tw) - (WIN_WIDTH (w) / 2);
- gw->orgPos.y = WIN_CENTER_Y (tw) - (WIN_HEIGHT (w) / 2);
+ if (gw->group->tabBar && !(gw->animateState & IS_UNGROUPING) &&
+ (gw->group->nWins > 1))
+ {
+ GroupSelection *group = gw->group;
- gw->destination.x = gw->orgPos.x + gw->mainTabOffset.x;
- gw->destination.y = gw->orgPos.y + gw->mainTabOffset.y;
+ /* if the group is tabbed, setup untabbing animation. The
+ window will be deleted from the group at the
+ end of the untabbing. */
+ if (HAS_TOP_WIN (group))
+ {
+ CompWindow *tw = TOP_TAB (group);
+ int oldX = gw->orgPos.x;
+ int oldY = gw->orgPos.y;
- gw->mainTabOffset.x = oldX;
- gw->mainTabOffset.y = oldY;
+ gw->orgPos.x = WIN_CENTER_X (tw) - (WIN_WIDTH (w) / 2);
+ gw->orgPos.y = WIN_CENTER_Y (tw) - (WIN_HEIGHT (w) / 2);
- if (gw->tx || gw->ty)
- {
- gw->tx -= (gw->orgPos.x - oldX);
- gw->ty -= (gw->orgPos.y - oldY);
- }
+ gw->destination.x = gw->orgPos.x + gw->mainTabOffset.x;
+ gw->destination.y = gw->orgPos.y + gw->mainTabOffset.y;
- gw->animateState = IS_ANIMATED;
- gw->xVelocity = gw->yVelocity = 0.0f;
- }
+ gw->mainTabOffset.x = oldX;
+ gw->mainTabOffset.y = oldY;
- /* Although when there is no top-tab, it will never really
- animate anything, if we don't start the animation,
- the window will never get removed. */
- groupStartTabbingAnimation (group, FALSE);
+ if (gw->tx || gw->ty)
+ {
+ gw->tx -= (gw->orgPos.x - oldX);
+ gw->ty -= (gw->orgPos.y - oldY);
+ }
- groupSetWindowVisibility (w, TRUE);
- group->ungroupState = UngroupSingle;
- gw->animateState |= IS_UNGROUPING;
+ gw->animateState = IS_ANIMATED;
+ gw->xVelocity = gw->yVelocity = 0.0f;
}
- else
- {
- /* no tab bar - delete immediately */
- groupDeleteGroupWindow (w);
- if (groupGetAutotabCreate (w->screen) &&
- matchEval (groupGetWindowMatch (w->screen), w))
- {
- groupAddWindowToGroup (w, NULL, 0);
- groupTabGroup (w);
- }
+ /* Although when there is no top-tab, it will never really
+ animate anything, if we don't start the animation,
+ the window will never get removed. */
+ groupStartTabbingAnimation (group, FALSE);
+
+ groupSetWindowVisibility (w, TRUE);
+ group->ungroupState = UngroupSingle;
+ gw->animateState |= IS_UNGROUPING;
+ }
+ else
+ {
+ /* no tab bar - delete immediately */
+ groupDeleteGroupWindow (w);
+
+ if (groupGetAutotabCreate (w->screen) &&
+ matchEval (groupGetWindowMatch (w->screen), w))
+ {
+ groupAddWindowToGroup (w, NULL, 0);
+ groupTabGroup (w);
}
+ }
}
/*
@@ -467,82 +469,82 @@ groupRemoveWindowFromGroup (CompWindow *w)
void
groupDeleteGroup (GroupSelection *group)
{
- GroupSelection *next, *prev;
- CompScreen *s = group->screen;
+ GroupSelection *next, *prev;
+ CompScreen *s = group->screen;
- GROUP_SCREEN (s);
- GROUP_DISPLAY (s->display);
+ GROUP_SCREEN (s);
+ GROUP_DISPLAY (s->display);
- if (group->windows)
- {
- int i;
+ if (group->windows)
+ {
+ int i;
- if (group->tabBar)
- {
- /* set up untabbing animation and delete the group
- at the end of the animation */
- groupUntabGroup (group);
- group->ungroupState = UngroupAll;
- return;
- }
+ if (group->tabBar)
+ {
+ /* set up untabbing animation and delete the group
+ at the end of the animation */
+ groupUntabGroup (group);
+ group->ungroupState = UngroupAll;
+ return;
+ }
- for (i = 0; i < group->nWins; i++)
- {
- CompWindow *cw = group->windows[i];
- GROUP_WINDOW (cw);
+ for (i = 0; i < group->nWins; i++)
+ {
+ CompWindow *cw = group->windows[i];
+ GROUP_WINDOW (cw);
+
+ damageWindowOutputExtents (cw);
+ gw->group = NULL;
+ updateWindowOutputExtents (cw);
+ groupUpdateWindowProperty (cw);
+
+ if (groupGetAutotabCreate (s) &&
+ matchEval (groupGetWindowMatch (s), cw))
+ {
+ groupAddWindowToGroup (cw, NULL, 0);
+ groupTabGroup (cw);
+ }
+ }
- damageWindowOutputExtents (cw);
- gw->group = NULL;
- updateWindowOutputExtents (cw);
- groupUpdateWindowProperty (cw);
+ free (group->windows);
+ group->windows = NULL;
+ }
+ else if (group->tabBar)
+ groupDeleteTabBar (group);
- if (groupGetAutotabCreate (s) &&
- matchEval (groupGetWindowMatch (s), cw))
- {
- groupAddWindowToGroup (cw, NULL, 0);
- groupTabGroup (cw);
- }
- }
+ prev = group->prev;
+ next = group->next;
- free (group->windows);
- group->windows = NULL;
+ /* relink stack */
+ if (prev || next)
+ {
+ if (prev)
+ {
+ if (next)
+ prev->next = next;
+ else
+ prev->next = NULL;
}
- else if (group->tabBar)
- groupDeleteTabBar (group);
-
- prev = group->prev;
- next = group->next;
-
- /* relink stack */
- if (prev || next)
+ if (next)
{
- if (prev)
- {
- if (next)
- prev->next = next;
- else
- prev->next = NULL;
- }
- if (next)
- {
- if (prev)
- next->prev = prev;
- else
- {
- next->prev = NULL;
- gs->groups = next;
- }
- }
+ if (prev)
+ next->prev = prev;
+ else
+ {
+ next->prev = NULL;
+ gs->groups = next;
+ }
}
- else
- gs->groups = NULL;
+ }
+ else
+ gs->groups = NULL;
- if (group == gs->lastHoveredGroup)
- gs->lastHoveredGroup = NULL;
- if (group == gd->lastRestackedGroup)
- gd->lastRestackedGroup = NULL;
+ if (group == gs->lastHoveredGroup)
+ gs->lastHoveredGroup = NULL;
+ if (group == gd->lastRestackedGroup)
+ gd->lastRestackedGroup = NULL;
- free (group);
+ free (group);
}
/*
@@ -551,139 +553,144 @@ groupDeleteGroup (GroupSelection *group)
*/
void
groupAddWindowToGroup (CompWindow *w,
- GroupSelection *group,
- long int initialIdent)
+ GroupSelection *group,
+ long int initialIdent)
{
- GROUP_SCREEN (w->screen);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (w->screen);
+ GROUP_WINDOW (w);
- if (gw->group)
- return;
+ if (gw->group)
+ return;
+
+ if (group)
+ {
+ CompWindow *topTab = NULL;
- if (group)
+ group->windows = realloc (group->windows,
+ sizeof (CompWindow *) * (group->nWins + 1));
+ group->windows[group->nWins] = w;
+ group->nWins++;
+ gw->group = group;
+
+ updateWindowOutputExtents (w);
+ groupUpdateWindowProperty (w);
+
+ if (group->nWins == 2)
{
- CompWindow *topTab = NULL;
+ /* first window in the group got its glow, too */
+ updateWindowOutputExtents (group->windows[0]);
+ }
- group->windows = realloc (group->windows,
- sizeof (CompWindow *) * (group->nWins + 1));
- group->windows[group->nWins] = w;
- group->nWins++;
- gw->group = group;
+ if (group->tabBar)
+ {
+ if (HAS_TOP_WIN (group))
+ topTab = TOP_TAB (group);
+ else if (HAS_PREV_TOP_WIN (group))
+ {
+ topTab = PREV_TOP_TAB (group);
+ group->topTab = group->prevTopTab;
+ group->prevTopTab = NULL;
+ }
+
+ if (topTab)
+ {
+ if (!gw->slot)
+ groupCreateSlot (group, w);
+
+ gw->destination.x = WIN_CENTER_X (topTab) - (WIN_WIDTH (w) / 2);
+ gw->destination.y = WIN_CENTER_Y (topTab) -
+ (WIN_HEIGHT (w) / 2);
+ gw->mainTabOffset.x = WIN_X (w) - gw->destination.x;
+ gw->mainTabOffset.y = WIN_Y (w) - gw->destination.y;
+ gw->orgPos.x = WIN_X (w);
+ gw->orgPos.y = WIN_Y (w);
+
+ gw->xVelocity = gw->yVelocity = 0.0f;
+
+ gw->animateState = IS_ANIMATED;
+
+ groupStartTabbingAnimation (group, TRUE);
+
+ addWindowDamage (w);
+ }
+ }
+ }
+ else
+ {
+ /* create new group */
+ GroupSelection *g = malloc (sizeof (GroupSelection));
- updateWindowOutputExtents (w);
- groupUpdateWindowProperty (w);
+ g->windows = malloc (sizeof (CompWindow *));
- if (group->nWins == 2)
- {
- /* first window in the group got its glow, too */
- updateWindowOutputExtents (group->windows[0]);
- }
+ g->windows[0] = w;
+ g->screen = w->screen;
+ g->nWins = 1;
- if (group->tabBar)
- {
- if (HAS_TOP_WIN (group))
- topTab = TOP_TAB (group);
- else if (HAS_PREV_TOP_WIN (group))
- {
- topTab = PREV_TOP_TAB (group);
- group->topTab = group->prevTopTab;
- group->prevTopTab = NULL;
- }
+ g->topTab = NULL;
+ g->prevTopTab = NULL;
+ g->nextTopTab = NULL;
+ g->activateTab = NULL;
- if (topTab)
- {
- if (!gw->slot)
- groupCreateSlot (group, w);
+ g->changeAnimationTime = 0;
+ g->changeAnimationDirection = 0;
- gw->destination.x = WIN_CENTER_X (topTab) - (WIN_WIDTH (w) / 2);
- gw->destination.y = WIN_CENTER_Y (topTab) -
- (WIN_HEIGHT (w) / 2);
- gw->mainTabOffset.x = WIN_X (w) - gw->destination.x;
- gw->mainTabOffset.y = WIN_Y (w) - gw->destination.y;
- gw->orgPos.x = WIN_X (w);
- gw->orgPos.y = WIN_Y (w);
+ g->changeState = NoTabChange;
+ g->tabbingState = NoTabbing;
+ g->ungroupState = UngroupNone;
- gw->xVelocity = gw->yVelocity = 0.0f;
+ g->tabBar = NULL;
- gw->animateState = IS_ANIMATED;
+ g->grabWindow = None;
+ g->grabMask = 0;
- groupStartTabbingAnimation (group, TRUE);
+ g->inputPrevention = None;
+ g->ipwMapped = FALSE;
- addWindowDamage (w);
- }
- }
- }
+ /* glow color */
+ g->color[0] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
+ g->color[1] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
+ g->color[2] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
+ g->color[3] = 0xffff;
+
+ if (initialIdent)
+ g->identifier = initialIdent;
else
{
- /* create new group */
- GroupSelection *g = malloc (sizeof (GroupSelection));
-
- g->windows = calloc(1, sizeof (CompWindow *));
- g->windows[0] = w;
- g->screen = w->screen;
- g->nWins = 1;
- g->topTab = NULL;
- g->prevTopTab = NULL;
- g->nextTopTab = NULL;
- g->activateTab = NULL;
- g->changeAnimationTime = 0;
- g->changeAnimationDirection = 0;
- g->changeState = NoTabChange;
- g->tabbingState = NoTabbing;
- g->ungroupState = UngroupNone;
- g->tabBar = NULL;
-
- g->grabWindow = None;
- g->grabMask = 0;
-
- g->inputPrevention = None;
- g->ipwMapped = FALSE;
-
- /* glow color */
- g->color[0] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
- g->color[1] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
- g->color[2] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
- g->color[3] = 0xffff;
-
- if (initialIdent)
- g->identifier = initialIdent;
- else
+ /* we got no valid group Id passed, so find out a new valid
+ unique one */
+ GroupSelection *tg;
+ Bool invalidID = FALSE;
+
+ g->identifier = gs->groups ? gs->groups->identifier : 0;
+ do
+ {
+ invalidID = FALSE;
+ for (tg = gs->groups; tg; tg = tg->next)
{
- /* we got no valid group Id passed, so find out a new valid
- unique one */
- GroupSelection *tg;
- Bool invalidID = FALSE;
+ if (tg->identifier == g->identifier)
+ {
+ invalidID = TRUE;
- g->identifier = gs->groups ? gs->groups->identifier : 0;
- do
- {
- invalidID = FALSE;
- for (tg = gs->groups; tg; tg = tg->next)
- {
- if (tg->identifier == g->identifier)
- {
- invalidID = TRUE;
-
- g->identifier++;
- break;
- }
- }
- }
- while (invalidID);
+ g->identifier++;
+ break;
+ }
}
+ }
+ while (invalidID);
+ }
- /* relink stack */
- if (gs->groups)
- gs->groups->prev = g;
-
- g->next = gs->groups;
- g->prev = NULL;
- gs->groups = g;
+ /* relink stack */
+ if (gs->groups)
+ gs->groups->prev = g;
- gw->group = g;
+ g->next = gs->groups;
+ g->prev = NULL;
+ gs->groups = g;
- groupUpdateWindowProperty (w);
- }
+ gw->group = g;
+
+ groupUpdateWindowProperty (w);
+ }
}
/*
@@ -692,76 +699,76 @@ groupAddWindowToGroup (CompWindow *w,
*/
Bool
groupGroupWindows (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
+
+ xid = getIntOptionNamed (option, nOption, "root", 0);
+ s = findScreenAtDisplay (d, xid);
- xid = getIntOptionNamed (option, nOption, "root", 0);
- s = findScreenAtDisplay (d, xid);
+ if (s)
+ {
+ GROUP_SCREEN (s);
- if (s)
+ if (gs->tmpSel.nWins > 0)
{
- GROUP_SCREEN (s);
+ int i;
+ CompWindow *cw;
+ GroupSelection *group = NULL;
+ Bool tabbed = FALSE;
+
+ for (i = 0; i < gs->tmpSel.nWins; i++)
+ {
+ cw = gs->tmpSel.windows[i];
+ GROUP_WINDOW (cw);
- if (gs->tmpSel.nWins > 0)
+ if (gw->group)
{
- int i;
- CompWindow *cw;
- GroupSelection *group = NULL;
- Bool tabbed = FALSE;
-
- for (i = 0; i < gs->tmpSel.nWins; i++)
- {
- cw = gs->tmpSel.windows[i];
- GROUP_WINDOW (cw);
-
- if (gw->group)
- {
- if (!tabbed || group->tabBar)
- group = gw->group;
+ if (!tabbed || group->tabBar)
+ group = gw->group;
- if (group->tabBar)
- tabbed = TRUE;
- }
- }
+ if (group->tabBar)
+ tabbed = TRUE;
+ }
+ }
- /* we need to do one first to get the pointer of a new group */
- cw = gs->tmpSel.windows[0];
- GROUP_WINDOW (cw);
+ /* we need to do one first to get the pointer of a new group */
+ cw = gs->tmpSel.windows[0];
+ GROUP_WINDOW (cw);
- if (gw->group && (group != gw->group))
- groupDeleteGroupWindow (cw);
- groupAddWindowToGroup (cw, group, 0);
- addWindowDamage (cw);
+ if (gw->group && (group != gw->group))
+ groupDeleteGroupWindow (cw);
+ groupAddWindowToGroup (cw, group, 0);
+ addWindowDamage (cw);
- gw->inSelection = FALSE;
- group = gw->group;
+ gw->inSelection = FALSE;
+ group = gw->group;
- for (i = 1; i < gs->tmpSel.nWins; i++)
- {
- cw = gs->tmpSel.windows[i];
- GROUP_WINDOW (cw);
+ for (i = 1; i < gs->tmpSel.nWins; i++)
+ {
+ cw = gs->tmpSel.windows[i];
+ GROUP_WINDOW (cw);
- if (gw->group && (group != gw->group))
- groupDeleteGroupWindow (cw);
- groupAddWindowToGroup (cw, group, 0);
- addWindowDamage (cw);
+ if (gw->group && (group != gw->group))
+ groupDeleteGroupWindow (cw);
+ groupAddWindowToGroup (cw, group, 0);
+ addWindowDamage (cw);
- gw->inSelection = FALSE;
- }
+ gw->inSelection = FALSE;
+ }
- /* exit selection */
- free (gs->tmpSel.windows);
- gs->tmpSel.windows = NULL;
- gs->tmpSel.nWins = 0;
- }
+ /* exit selection */
+ free (gs->tmpSel.windows);
+ gs->tmpSel.windows = NULL;
+ gs->tmpSel.nWins = 0;
}
+ }
- return FALSE;
+ return FALSE;
}
/*
@@ -770,23 +777,23 @@ groupGroupWindows (CompDisplay *d,
*/
Bool
groupUnGroupWindows (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- CompWindow *w;
+ CompWindow *w;
- w = findTopLevelWindowAtDisplay (d, d->activeWindow);
- if (w)
- {
- GROUP_WINDOW (w);
+ w = findTopLevelWindowAtDisplay (d, d->activeWindow);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- if (gw->group)
- groupDeleteGroup (gw->group);
- }
+ if (gw->group)
+ groupDeleteGroup (gw->group);
+ }
- return FALSE;
+ return FALSE;
}
/*
@@ -795,23 +802,23 @@ groupUnGroupWindows (CompDisplay *d,
*/
Bool
groupRemoveWindow (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- CompWindow *w;
+ CompWindow *w;
- w = findWindowAtDisplay (d, d->activeWindow);
- if (w)
- {
- GROUP_WINDOW (w);
+ w = findWindowAtDisplay (d, d->activeWindow);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- if (gw->group)
- groupRemoveWindowFromGroup (w);
- }
+ if (gw->group)
+ groupRemoveWindowFromGroup (w);
+ }
- return FALSE;
+ return FALSE;
}
/*
@@ -820,29 +827,29 @@ groupRemoveWindow (CompDisplay *d,
*/
Bool
groupCloseWindows (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- CompWindow *w;
+ CompWindow *w;
- w = findWindowAtDisplay (d, d->activeWindow);
- if (w)
- {
- GROUP_WINDOW (w);
+ w = findWindowAtDisplay (d, d->activeWindow);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- if (gw->group)
- {
- int i;
+ if (gw->group)
+ {
+ int i;
- for (i = 0; i < gw->group->nWins; i++)
- closeWindow (gw->group->windows[i],
- getCurrentTimeFromDisplay (d));
- }
+ for (i = 0; i < gw->group->nWins; i++)
+ closeWindow (gw->group->windows[i],
+ getCurrentTimeFromDisplay (d));
}
+ }
- return FALSE;
+ return FALSE;
}
/*
@@ -851,32 +858,32 @@ groupCloseWindows (CompDisplay *d,
*/
Bool
groupChangeColor (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- CompWindow *w;
+ CompWindow *w;
- w = findWindowAtDisplay (d, d->activeWindow);
- if (w)
- {
- GROUP_WINDOW (w);
+ w = findWindowAtDisplay (d, d->activeWindow);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- if (gw->group)
- {
- GLushort *color = gw->group->color;
+ if (gw->group)
+ {
+ GLushort *color = gw->group->color;
- color[0] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
- color[1] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
- color[2] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
+ color[0] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
+ color[1] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
+ color[2] = (int)(rand () / (((double)RAND_MAX + 1) / 0xffff));
- groupRenderTopTabHighlight (gw->group);
- damageScreen (w->screen);
- }
+ groupRenderTopTabHighlight (gw->group);
+ damageScreen (w->screen);
}
+ }
- return FALSE;
+ return FALSE;
}
/*
@@ -885,19 +892,19 @@ groupChangeColor (CompDisplay *d,
*/
Bool
groupSetIgnore (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- GROUP_DISPLAY (d);
+ GROUP_DISPLAY (d);
- gd->ignoreMode = TRUE;
+ gd->ignoreMode = TRUE;
- if (state & CompActionStateInitKey)
- action->state |= CompActionStateTermKey;
+ if (state & CompActionStateInitKey)
+ action->state |= CompActionStateTermKey;
- return FALSE;
+ return FALSE;
}
/*
@@ -906,18 +913,18 @@ groupSetIgnore (CompDisplay *d,
*/
Bool
groupUnsetIgnore (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- GROUP_DISPLAY (d);
+ GROUP_DISPLAY (d);
- gd->ignoreMode = FALSE;
+ gd->ignoreMode = FALSE;
- action->state &= ~CompActionStateTermKey;
+ action->state &= ~CompActionStateTermKey;
- return FALSE;
+ return FALSE;
}
/*
@@ -926,88 +933,88 @@ groupUnsetIgnore (CompDisplay *d,
*/
static void
groupHandleButtonPressEvent (CompScreen *s,
- XEvent *event)
+ XEvent *event)
{
- GroupSelection *group;
- int xRoot, yRoot, button;
+ GroupSelection *group;
+ int xRoot, yRoot, button;
- GROUP_SCREEN (s);
+ GROUP_SCREEN (s);
- xRoot = event->xbutton.x_root;
- yRoot = event->xbutton.y_root;
- button = event->xbutton.button;
+ xRoot = event->xbutton.x_root;
+ yRoot = event->xbutton.y_root;
+ button = event->xbutton.button;
- for (group = gs->groups; group; group = group->next)
- {
- if (group->inputPrevention != event->xbutton.window)
- continue;
+ for (group = gs->groups; group; group = group->next)
+ {
+ if (group->inputPrevention != event->xbutton.window)
+ continue;
- if (!group->tabBar)
- continue;
+ if (!group->tabBar)
+ continue;
- switch (button) {
- case Button1:
- {
- GroupTabBarSlot *slot;
-
- for (slot = group->tabBar->slots; slot; slot = slot->next)
- {
- if (XPointInRegion (slot->region, xRoot, yRoot))
- {
- gs->draggedSlot = slot;
- /* The slot isn't dragged yet */
- gs->dragged = FALSE;
- gs->prevX = xRoot;
- gs->prevY = yRoot;
-
- if (!otherScreenGrabExist(s, "group", "group-drag"))
- groupGrabScreen (s, ScreenGrabTabDrag);
- }
- }
- break;
- }
+ switch (button) {
+ case Button1:
+ {
+ GroupTabBarSlot *slot;
- case Button4:
- case Button5:
- {
- CompWindow *topTab = NULL;
- GroupWindow *gw;
-
- if (group->nextTopTab)
- topTab = NEXT_TOP_TAB (group);
- else if (group->topTab)
- {
- /* If there are no tabbing animations,
- topTab is never NULL. */
- topTab = TOP_TAB (group);
- }
-
- if (!topTab)
- return;
-
- gw = GET_GROUP_WINDOW (topTab, gs);
-
- if (button == Button4)
- {
- if (gw->slot->prev)
- groupChangeTab (gw->slot->prev, RotateLeft);
- else
- groupChangeTab (gw->group->tabBar->revSlots,
- RotateLeft);
- }
- else
- {
- if (gw->slot->next)
- groupChangeTab (gw->slot->next, RotateRight);
- else
- groupChangeTab (gw->group->tabBar->slots, RotateRight);
- }
- break;
- }
+ for (slot = group->tabBar->slots; slot; slot = slot->next)
+ {
+ if (XPointInRegion (slot->region, xRoot, yRoot))
+ {
+ gs->draggedSlot = slot;
+ /* The slot isn't dragged yet */
+ gs->dragged = FALSE;
+ gs->prevX = xRoot;
+ gs->prevY = yRoot;
+
+ if (!otherScreenGrabExist(s, "group", "group-drag"))
+ groupGrabScreen (s, ScreenGrabTabDrag);
+ }
}
+ }
+ break;
+
+ case Button4:
+ case Button5:
+ {
+ CompWindow *topTab = NULL;
+ GroupWindow *gw;
+
+ if (group->nextTopTab)
+ topTab = NEXT_TOP_TAB (group);
+ else if (group->topTab)
+ {
+ /* If there are no tabbing animations,
+ topTab is never NULL. */
+ topTab = TOP_TAB (group);
+ }
+
+ if (!topTab)
+ return;
+
+ gw = GET_GROUP_WINDOW (topTab, gs);
+ if (button == Button4)
+ {
+ if (gw->slot->prev)
+ groupChangeTab (gw->slot->prev, RotateLeft);
+ else
+ groupChangeTab (gw->group->tabBar->revSlots,
+ RotateLeft);
+ }
+ else
+ {
+ if (gw->slot->next)
+ groupChangeTab (gw->slot->next, RotateRight);
+ else
+ groupChangeTab (gw->group->tabBar->slots, RotateRight);
+ }
break;
+ }
}
+
+ break;
+ }
}
/*
@@ -1016,243 +1023,243 @@ groupHandleButtonPressEvent (CompScreen *s,
*/
static void
groupHandleButtonReleaseEvent (CompScreen *s,
- XEvent *event)
+ XEvent *event)
{
- GroupSelection *group;
- int vx, vy;
- Region newRegion;
- Bool inserted = FALSE;
- Bool wasInTabBar = FALSE;
+ GroupSelection *group;
+ int vx, vy;
+ Region newRegion;
+ Bool inserted = FALSE;
+ Bool wasInTabBar = FALSE;
- GROUP_SCREEN (s);
+ GROUP_SCREEN (s);
- if (event->xbutton.button != 1)
- return;
+ if (event->xbutton.button != 1)
+ return;
- if (!gs->draggedSlot)
- return;
+ if (!gs->draggedSlot)
+ return;
- if (!gs->dragged)
- {
- groupChangeTab (gs->draggedSlot, RotateUncertain);
- gs->draggedSlot = NULL;
+ if (!gs->dragged)
+ {
+ groupChangeTab (gs->draggedSlot, RotateUncertain);
+ gs->draggedSlot = NULL;
- if (gs->grabState == ScreenGrabTabDrag)
- groupGrabScreen (s, ScreenGrabNone);
+ if (gs->grabState == ScreenGrabTabDrag)
+ groupGrabScreen (s, ScreenGrabNone);
- return;
- }
+ return;
+ }
- GROUP_WINDOW (gs->draggedSlot->window);
+ GROUP_WINDOW (gs->draggedSlot->window);
- newRegion = XCreateRegion ();
- if (!newRegion)
- return;
+ newRegion = XCreateRegion ();
+ if (!newRegion)
+ return;
- XUnionRegion (newRegion, gs->draggedSlot->region, newRegion);
+ XUnionRegion (newRegion, gs->draggedSlot->region, newRegion);
- groupGetDrawOffsetForSlot (gs->draggedSlot, &vx, &vy);
- XOffsetRegion (newRegion, vx, vy);
+ groupGetDrawOffsetForSlot (gs->draggedSlot, &vx, &vy);
+ XOffsetRegion (newRegion, vx, vy);
- for (group = gs->groups; group; group = group->next)
- {
- Bool inTabBar;
- Region clip, buf;
- GroupTabBarSlot *slot;
+ for (group = gs->groups; group; group = group->next)
+ {
+ Bool inTabBar;
+ Region clip, buf;
+ GroupTabBarSlot *slot;
- if (!group->tabBar || !HAS_TOP_WIN (group))
- continue;
+ if (!group->tabBar || !HAS_TOP_WIN (group))
+ continue;
- /* create clipping region */
- clip = groupGetClippingRegion (TOP_TAB (group));
- if (!clip)
- continue;
+ /* create clipping region */
+ clip = groupGetClippingRegion (TOP_TAB (group));
+ if (!clip)
+ continue;
- buf = XCreateRegion ();
- if (!buf)
- {
- XDestroyRegion (clip);
- continue;
- }
+ buf = XCreateRegion ();
+ if (!buf)
+ {
+ XDestroyRegion (clip);
+ continue;
+ }
- XIntersectRegion (newRegion, group->tabBar->region, buf);
- XSubtractRegion (buf, clip, buf);
- XDestroyRegion (clip);
+ XIntersectRegion (newRegion, group->tabBar->region, buf);
+ XSubtractRegion (buf, clip, buf);
+ XDestroyRegion (clip);
- inTabBar = !XEmptyRegion (buf);
- XDestroyRegion (buf);
+ inTabBar = !XEmptyRegion (buf);
+ XDestroyRegion (buf);
- if (!inTabBar)
- continue;
+ if (!inTabBar)
+ continue;
- wasInTabBar = TRUE;
+ wasInTabBar = TRUE;
- for (slot = group->tabBar->slots; slot; slot = slot->next)
+ for (slot = group->tabBar->slots; slot; slot = slot->next)
+ {
+ GroupTabBarSlot *tmpDraggedSlot;
+ GroupSelection *tmpGroup;
+ Region slotRegion, buf;
+ XRectangle rect;
+ Bool inSlot;
+
+ if (slot == gs->draggedSlot)
+ continue;
+
+ slotRegion = XCreateRegion ();
+ if (!slotRegion)
+ continue;
+
+ if (slot->prev && slot->prev != gs->draggedSlot)
+ {
+ rect.x = slot->prev->region->extents.x2;
+ }
+ else if (slot->prev && slot->prev == gs->draggedSlot &&
+ gs->draggedSlot->prev)
+ {
+ rect.x = gs->draggedSlot->prev->region->extents.x2;
+ }
+ else
+ rect.x = group->tabBar->region->extents.x1;
+
+ rect.y = slot->region->extents.y1;
+
+ if (slot->next && slot->next != gs->draggedSlot)
+ {
+ rect.width = slot->next->region->extents.x1 - rect.x;
+ }
+ else if (slot->next && slot->next == gs->draggedSlot &&
+ gs->draggedSlot->next)
+ {
+ rect.width = gs->draggedSlot->next->region->extents.x1 - rect.x;
+ }
+ else
+ rect.width = group->tabBar->region->extents.x2;
+
+ rect.height = slot->region->extents.y2 - slot->region->extents.y1;
+
+ XUnionRectWithRegion (&rect, slotRegion, slotRegion);
+
+ buf = XCreateRegion ();
+ if (!buf)
+ continue;
+
+ XIntersectRegion (newRegion, slotRegion, buf);
+ inSlot = !XEmptyRegion (buf);
+
+ XDestroyRegion (buf);
+ XDestroyRegion (slotRegion);
+
+ if (!inSlot)
+ continue;
+
+ tmpDraggedSlot = gs->draggedSlot;
+
+ if (group != gw->group)
+ {
+ CompWindow *w = gs->draggedSlot->window;
+ GroupSelection *tmpGroup = gw->group;
+ int oldPosX = WIN_CENTER_X (w);
+ int oldPosY = WIN_CENTER_Y (w);
+
+ /* if the dragged window is not the top tab,
+ move it onscreen */
+ if (tmpGroup->topTab && !IS_TOP_TAB (w, tmpGroup))
{
- GroupTabBarSlot *tmpDraggedSlot;
- GroupSelection *tmpGroup;
- Region slotRegion, buf;
- XRectangle rect;
- Bool inSlot;
-
- if (slot == gs->draggedSlot)
- continue;
+ CompWindow *tw = TOP_TAB (tmpGroup);
- slotRegion = XCreateRegion ();
- if (!slotRegion)
- continue;
+ oldPosX = WIN_CENTER_X (tw) + gw->mainTabOffset.x;
+ oldPosY = WIN_CENTER_Y (tw) + gw->mainTabOffset.y;
- if (slot->prev && slot->prev != gs->draggedSlot)
- {
- rect.x = slot->prev->region->extents.x2;
- }
- else if (slot->prev && slot->prev == gs->draggedSlot &&
- gs->draggedSlot->prev)
- {
- rect.x = gs->draggedSlot->prev->region->extents.x2;
- }
- else
- rect.x = group->tabBar->region->extents.x1;
-
- rect.y = slot->region->extents.y1;
-
- if (slot->next && slot->next != gs->draggedSlot)
- {
- rect.width = slot->next->region->extents.x1 - rect.x;
- }
- else if (slot->next && slot->next == gs->draggedSlot &&
- gs->draggedSlot->next)
- {
- rect.width = gs->draggedSlot->next->region->extents.x1 - rect.x;
- }
- else
- rect.width = group->tabBar->region->extents.x2;
-
- rect.height = slot->region->extents.y2 - slot->region->extents.y1;
-
- XUnionRectWithRegion (&rect, slotRegion, slotRegion);
-
- buf = XCreateRegion ();
- if (!buf)
- continue;
-
- XIntersectRegion (newRegion, slotRegion, buf);
- inSlot = !XEmptyRegion (buf);
-
- XDestroyRegion (buf);
- XDestroyRegion (slotRegion);
-
- if (!inSlot)
- continue;
-
- tmpDraggedSlot = gs->draggedSlot;
-
- if (group != gw->group)
- {
- CompWindow *w = gs->draggedSlot->window;
- GroupSelection *tmpGroup = gw->group;
- int oldPosX = WIN_CENTER_X (w);
- int oldPosY = WIN_CENTER_Y (w);
-
- /* if the dragged window is not the top tab,
- move it onscreen */
- if (tmpGroup->topTab && !IS_TOP_TAB (w, tmpGroup))
- {
- CompWindow *tw = TOP_TAB (tmpGroup);
-
- oldPosX = WIN_CENTER_X (tw) + gw->mainTabOffset.x;
- oldPosY = WIN_CENTER_Y (tw) + gw->mainTabOffset.y;
-
- groupSetWindowVisibility (w, TRUE);
- }
-
- /* Change the group. */
- groupDeleteGroupWindow (gs->draggedSlot->window);
- groupAddWindowToGroup (gs->draggedSlot->window, group, 0);
-
- /* we saved the original center position in oldPosX/Y before -
- now we should apply that to the new main tab offset */
- if (HAS_TOP_WIN (group))
- {
- CompWindow *tw = TOP_TAB (group);
- gw->mainTabOffset.x = oldPosX - WIN_CENTER_X (tw);
- gw->mainTabOffset.y = oldPosY - WIN_CENTER_Y (tw);
- }
- }
- else
- groupUnhookTabBarSlot (group->tabBar, gs->draggedSlot, TRUE);
-
- gs->draggedSlot = NULL;
- gs->dragged = FALSE;
- inserted = TRUE;
-
- if ((tmpDraggedSlot->region->extents.x1 +
- tmpDraggedSlot->region->extents.x2 + (2 * vx)) / 2 >
- (slot->region->extents.x1 + slot->region->extents.x2) / 2)
- {
- groupInsertTabBarSlotAfter (group->tabBar,
- tmpDraggedSlot, slot);
- }
- else
- groupInsertTabBarSlotBefore (group->tabBar,
- tmpDraggedSlot, slot);
-
- groupDamageTabBarRegion (group);
+ groupSetWindowVisibility (w, TRUE);
+ }
- /* Hide tab-bars. */
- for (tmpGroup = gs->groups; tmpGroup; tmpGroup = tmpGroup->next)
- {
- if (group == tmpGroup)
- groupTabSetVisibility (tmpGroup, TRUE, 0);
- else
- groupTabSetVisibility (tmpGroup, FALSE, PERMANENT);
- }
+ /* Change the group. */
+ groupDeleteGroupWindow (gs->draggedSlot->window);
+ groupAddWindowToGroup (gs->draggedSlot->window, group, 0);
- break;
+ /* we saved the original center position in oldPosX/Y before -
+ now we should apply that to the new main tab offset */
+ if (HAS_TOP_WIN (group))
+ {
+ CompWindow *tw = TOP_TAB (group);
+ gw->mainTabOffset.x = oldPosX - WIN_CENTER_X (tw);
+ gw->mainTabOffset.y = oldPosY - WIN_CENTER_Y (tw);
}
+ }
+ else
+ groupUnhookTabBarSlot (group->tabBar, gs->draggedSlot, TRUE);
+
+ gs->draggedSlot = NULL;
+ gs->dragged = FALSE;
+ inserted = TRUE;
+
+ if ((tmpDraggedSlot->region->extents.x1 +
+ tmpDraggedSlot->region->extents.x2 + (2 * vx)) / 2 >
+ (slot->region->extents.x1 + slot->region->extents.x2) / 2)
+ {
+ groupInsertTabBarSlotAfter (group->tabBar,
+ tmpDraggedSlot, slot);
+ }
+ else
+ groupInsertTabBarSlotBefore (group->tabBar,
+ tmpDraggedSlot, slot);
+
+ groupDamageTabBarRegion (group);
+
+ /* Hide tab-bars. */
+ for (tmpGroup = gs->groups; tmpGroup; tmpGroup = tmpGroup->next)
+ {
+ if (group == tmpGroup)
+ groupTabSetVisibility (tmpGroup, TRUE, 0);
+ else
+ groupTabSetVisibility (tmpGroup, FALSE, PERMANENT);
+ }
- if (inserted)
- break;
+ break;
}
- XDestroyRegion (newRegion);
+ if (inserted)
+ break;
+ }
- if (!inserted)
- {
- CompWindow *draggedSlotWindow = gs->draggedSlot->window;
- GroupSelection *tmpGroup;
+ XDestroyRegion (newRegion);
- for (tmpGroup = gs->groups; tmpGroup; tmpGroup = tmpGroup->next)
- groupTabSetVisibility (tmpGroup, FALSE, PERMANENT);
+ if (!inserted)
+ {
+ CompWindow *draggedSlotWindow = gs->draggedSlot->window;
+ GroupSelection *tmpGroup;
- gs->draggedSlot = NULL;
- gs->dragged = FALSE;
+ for (tmpGroup = gs->groups; tmpGroup; tmpGroup = tmpGroup->next)
+ groupTabSetVisibility (tmpGroup, FALSE, PERMANENT);
- if (groupGetDndUngroupWindow (s) && !wasInTabBar)
- {
- groupRemoveWindowFromGroup (draggedSlotWindow);
- }
- else if (gw->group && gw->group->topTab)
- {
- groupRecalcTabBarPos (gw->group,
- (gw->group->tabBar->region->extents.x1 +
- gw->group->tabBar->region->extents.x2) / 2,
- gw->group->tabBar->region->extents.x1,
- gw->group->tabBar->region->extents.x2);
- }
+ gs->draggedSlot = NULL;
+ gs->dragged = FALSE;
- /* to remove the painted slot */
- damageScreen (s);
+ if (groupGetDndUngroupWindow (s) && !wasInTabBar)
+ {
+ groupRemoveWindowFromGroup (draggedSlotWindow);
}
-
- if (gs->grabState == ScreenGrabTabDrag)
- groupGrabScreen (s, ScreenGrabNone);
-
- if (gs->dragHoverTimeoutHandle)
+ else if (gw->group && gw->group->topTab)
{
- compRemoveTimeout (gs->dragHoverTimeoutHandle);
- gs->dragHoverTimeoutHandle = 0;
+ groupRecalcTabBarPos (gw->group,
+ (gw->group->tabBar->region->extents.x1 +
+ gw->group->tabBar->region->extents.x2) / 2,
+ gw->group->tabBar->region->extents.x1,
+ gw->group->tabBar->region->extents.x2);
}
+
+ /* to remove the painted slot */
+ damageScreen (s);
+ }
+
+ if (gs->grabState == ScreenGrabTabDrag)
+ groupGrabScreen (s, ScreenGrabNone);
+
+ if (gs->dragHoverTimeoutHandle)
+ {
+ compRemoveTimeout (gs->dragHoverTimeoutHandle);
+ gs->dragHoverTimeoutHandle = 0;
+ }
}
/*
@@ -1265,70 +1272,70 @@ groupHandleButtonReleaseEvent (CompScreen *s,
static void
groupHandleMotionEvent (CompScreen *s,
- int xRoot,
- int yRoot)
+ int xRoot,
+ int yRoot)
{
- GROUP_SCREEN (s);
+ GROUP_SCREEN (s);
- if (gs->grabState == ScreenGrabTabDrag)
- {
- int dx, dy;
- int vx, vy;
- REGION reg;
- Region draggedRegion = gs->draggedSlot->region;
+ if (gs->grabState == ScreenGrabTabDrag)
+ {
+ int dx, dy;
+ int vx, vy;
+ REGION reg;
+ Region draggedRegion = gs->draggedSlot->region;
- reg.rects = &reg.extents;
- reg.numRects = 1;
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
- dx = xRoot - gs->prevX;
- dy = yRoot - gs->prevY;
+ dx = xRoot - gs->prevX;
+ dy = yRoot - gs->prevY;
- if (gs->dragged || abs (dx) > RADIUS || abs (dy) > RADIUS)
- {
- gs->prevX = xRoot;
- gs->prevY = yRoot;
+ if (gs->dragged || abs (dx) > RADIUS || abs (dy) > RADIUS)
+ {
+ gs->prevX = xRoot;
+ gs->prevY = yRoot;
- if (!gs->dragged)
- {
- GroupSelection *group;
- BoxRec *box;
+ if (!gs->dragged)
+ {
+ GroupSelection *group;
+ BoxRec *box;
- GROUP_WINDOW (gs->draggedSlot->window);
+ GROUP_WINDOW (gs->draggedSlot->window);
- gs->dragged = TRUE;
+ gs->dragged = TRUE;
- for (group = gs->groups; group; group = group->next)
- groupTabSetVisibility (group, TRUE, PERMANENT);
+ for (group = gs->groups; group; group = group->next)
+ groupTabSetVisibility (group, TRUE, PERMANENT);
- box = &gw->group->tabBar->region->extents;
- groupRecalcTabBarPos (gw->group, (box->x1 + box->x2) / 2,
- box->x1, box->x2);
- }
+ box = &gw->group->tabBar->region->extents;
+ groupRecalcTabBarPos (gw->group, (box->x1 + box->x2) / 2,
+ box->x1, box->x2);
+ }
- groupGetDrawOffsetForSlot (gs->draggedSlot, &vx, &vy);
+ groupGetDrawOffsetForSlot (gs->draggedSlot, &vx, &vy);
- reg.extents.x1 = draggedRegion->extents.x1 + vx;
- reg.extents.y1 = draggedRegion->extents.y1 + vy;
- reg.extents.x2 = draggedRegion->extents.x2 + vx;
- reg.extents.y2 = draggedRegion->extents.y2 + vy;
- damageScreenRegion (s, &reg);
+ reg.extents.x1 = draggedRegion->extents.x1 + vx;
+ reg.extents.y1 = draggedRegion->extents.y1 + vy;
+ reg.extents.x2 = draggedRegion->extents.x2 + vx;
+ reg.extents.y2 = draggedRegion->extents.y2 + vy;
+ damageScreenRegion (s, &reg);
- XOffsetRegion (gs->draggedSlot->region, dx, dy);
- gs->draggedSlot->springX =
- (gs->draggedSlot->region->extents.x1 +
- gs->draggedSlot->region->extents.x2) / 2;
+ XOffsetRegion (gs->draggedSlot->region, dx, dy);
+ gs->draggedSlot->springX =
+ (gs->draggedSlot->region->extents.x1 +
+ gs->draggedSlot->region->extents.x2) / 2;
- reg.extents.x1 = draggedRegion->extents.x1 + vx;
- reg.extents.y1 = draggedRegion->extents.y1 + vy;
- reg.extents.x2 = draggedRegion->extents.x2 + vx;
- reg.extents.y2 = draggedRegion->extents.y2 + vy;
- damageScreenRegion (s, &reg);
- }
- }
- else if (gs->grabState == ScreenGrabSelect)
- {
- groupDamageSelectionRect (s, xRoot, yRoot);
+ reg.extents.x1 = draggedRegion->extents.x1 + vx;
+ reg.extents.y1 = draggedRegion->extents.y1 + vy;
+ reg.extents.x2 = draggedRegion->extents.x2 + vx;
+ reg.extents.y2 = draggedRegion->extents.y2 + vy;
+ damageScreenRegion (s, &reg);
}
+ }
+ else if (gs->grabState == ScreenGrabSelect)
+ {
+ groupDamageSelectionRect (s, xRoot, yRoot);
+ }
}
/*
@@ -1337,320 +1344,317 @@ groupHandleMotionEvent (CompScreen *s,
*/
void
groupHandleEvent (CompDisplay *d,
- XEvent *event)
+ XEvent *event)
{
- GROUP_DISPLAY (d);
+ GROUP_DISPLAY (d);
- switch (event->type) {
- case MotionNotify:
- {
- CompScreen *s;
- s = findScreenAtDisplay (d, event->xmotion.root);
- if (s)
- groupHandleMotionEvent (s, pointerX, pointerY);
+ switch (event->type) {
+ case MotionNotify:
+ {
+ CompScreen *s;
+ s = findScreenAtDisplay (d, event->xmotion.root);
+ if (s)
+ groupHandleMotionEvent (s, pointerX, pointerY);
+ }
+ break;
- break;
- }
+ case ButtonPress:
+ {
+ CompScreen *s;
+ s = findScreenAtDisplay (d, event->xbutton.root);
+ if (s)
+ groupHandleButtonPressEvent (s, event);
+ }
+ break;
- case ButtonPress:
- {
- CompScreen *s;
- s = findScreenAtDisplay (d, event->xbutton.root);
- if (s)
- groupHandleButtonPressEvent (s, event);
+ case ButtonRelease:
+ {
+ CompScreen *s;
+ s = findScreenAtDisplay (d, event->xbutton.root);
+ if (s)
+ groupHandleButtonReleaseEvent (s, event);
+ }
+ break;
- break;
+ case MapNotify:
+ {
+ CompWindow *cw, *w;
+ w = findWindowAtDisplay (d, event->xmap.window);
+ if (w)
+ {
+ for (cw = w->screen->windows; cw; cw = cw->next)
+ {
+ if (w->id == cw->frame)
+ {
+ GROUP_WINDOW (cw);
+ if (gw->windowHideInfo)
+ XUnmapWindow (cw->screen->display->display,
+ cw->frame);
+ }
}
+ }
+ }
+ break;
- case ButtonRelease:
- {
- CompScreen *s;
- s = findScreenAtDisplay (d, event->xbutton.root);
- if (s)
- groupHandleButtonReleaseEvent (s, event);
+ case UnmapNotify:
+ {
+ CompWindow *w;
+ w = findWindowAtDisplay (d, event->xunmap.window);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- break;
+ if (w->pendingUnmaps)
+ {
+ if (w->shaded)
+ {
+ gw->windowState = WindowShaded;
+
+ if (gw->group && groupGetShadeAll (w->screen))
+ groupShadeWindows (w, gw->group, TRUE);
+ }
+ else if (w->minimized)
+ {
+ gw->windowState = WindowMinimized;
+
+ if (gw->group && groupGetMinimizeAll (w->screen))
+ groupMinimizeWindows (w, gw->group, TRUE);
+ }
}
- case MapNotify:
+ if (gw->group)
{
- CompWindow *cw, *w;
- w = findWindowAtDisplay (d, event->xmap.window);
- if (w)
+ if (gw->group->tabBar && IS_TOP_TAB (w, gw->group))
+ {
+ /* on unmap of the top tab, hide the tab bar and the
+ input prevention window */
+ groupTabSetVisibility (gw->group, FALSE, PERMANENT);
+ }
+ if (!w->pendingUnmaps)
+ {
+ /* close event */
+ if (!(gw->animateState & IS_UNGROUPING))
{
- for (cw = w->screen->windows; cw; cw = cw->next)
- {
- if (w->id == cw->frame)
- {
- GROUP_WINDOW (cw);
- if (gw->windowHideInfo)
- XUnmapWindow (cw->screen->display->display,
- cw->frame);
- }
- }
+ groupDeleteGroupWindow (w);
+ damageScreen (w->screen);
}
- break;
+ }
}
+ }
+ }
+ break;
+
+ case ClientMessage:
+ if (event->xclient.message_type == gd->resizeNotifyAtom)
+ {
+ CompWindow *w;
+ w = findWindowAtDisplay (d, event->xclient.window);
+
+ if (w && gd->resizeInfo && (w == gd->resizeInfo->resizedWindow))
+ {
+ GROUP_WINDOW (w);
+ GROUP_SCREEN (w->screen);
- case UnmapNotify:
+ if (gw->group)
{
- CompWindow *w;
- w = findWindowAtDisplay (d, event->xunmap.window);
- if (w)
+ int i;
+ XRectangle rect;
+
+ rect.x = event->xclient.data.l[0];
+ rect.y = event->xclient.data.l[1];
+ rect.width = event->xclient.data.l[2];
+ rect.height = event->xclient.data.l[3];
+
+ for (i = 0; i < gw->group->nWins; i++)
+ {
+ CompWindow *cw = gw->group->windows[i];
+ GroupWindow *gcw;
+
+ gcw = GET_GROUP_WINDOW (cw, gs);
+ if (gcw->resizeGeometry)
{
- GROUP_WINDOW (w);
-
- if (w->pendingUnmaps)
- {
- if (w->shaded)
- {
- gw->windowState = WindowShaded;
-
- if (gw->group && groupGetShadeAll (w->screen))
- groupShadeWindows (w, gw->group, TRUE);
- }
- else if (w->minimized)
- {
- gw->windowState = WindowMinimized;
-
- if (gw->group && groupGetMinimizeAll (w->screen))
- groupMinimizeWindows (w, gw->group, TRUE);
- }
- }
-
- if (gw->group)
- {
- if (gw->group->tabBar && IS_TOP_TAB (w, gw->group))
- {
- /* on unmap of the top tab, hide the tab bar and the
- input prevention window */
- groupTabSetVisibility (gw->group, FALSE, PERMANENT);
- }
- if (!w->pendingUnmaps)
- {
- /* close event */
- if (!(gw->animateState & IS_UNGROUPING))
- {
- groupDeleteGroupWindow (w);
- damageScreen (w->screen);
- }
- }
- }
+ if (groupUpdateResizeRectangle (cw, &rect, TRUE))
+ addWindowDamage (cw);
}
- break;
+ }
}
+ }
+ }
+ else if (event->xclient.message_type == d->winActiveAtom)
+ {
+ CompWindow *w;
+ w = findWindowAtDisplay (d, event->xclient.window);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- case ClientMessage:
- if (event->xclient.message_type == gd->resizeNotifyAtom)
+ if (gw->group && gw->group->tabBar && HAS_TOP_WIN (gw->group))
{
- CompWindow *w;
- w = findWindowAtDisplay (d, event->xclient.window);
-
- if (w && gd->resizeInfo && (w == gd->resizeInfo->resizedWindow))
+ CompWindow *tw = TOP_TAB (gw->group);
+
+ if (w->id != tw->id)
+ {
+ /* if a non top-tab has been activated, switch to the
+ top-tab instead - but only if is visible */
+ if (tw->shaded)
{
- GROUP_WINDOW (w);
- GROUP_SCREEN (w->screen);
-
- if (gw->group)
- {
- int i;
- XRectangle rect;
-
- rect.x = event->xclient.data.l[0];
- rect.y = event->xclient.data.l[1];
- rect.width = event->xclient.data.l[2];
- rect.height = event->xclient.data.l[3];
-
- for (i = 0; i < gw->group->nWins; i++)
- {
- CompWindow *cw = gw->group->windows[i];
- GroupWindow *gcw;
-
- gcw = GET_GROUP_WINDOW (cw, gs);
- if (gcw->resizeGeometry)
- {
- if (groupUpdateResizeRectangle (cw, &rect, TRUE))
- addWindowDamage (cw);
- }
- }
- }
+ int newState;
+ newState = tw->state & ~CompWindowStateShadedMask;
+ changeWindowState (tw, newState);
+ updateWindowAttributes (tw,
+ CompStackingUpdateModeNone);
}
- }
- else if (event->xclient.message_type == d->winActiveAtom)
- {
- CompWindow *w;
- w = findWindowAtDisplay (d, event->xclient.window);
- if (w)
+ else if (tw->minimized)
+ unminimizeWindow (tw);
+
+ if (!(tw->state & CompWindowStateHiddenMask))
{
- GROUP_WINDOW (w);
-
- if (gw->group && gw->group->tabBar && HAS_TOP_WIN (gw->group))
- {
- CompWindow *tw = TOP_TAB (gw->group);
-
- if (w->id != tw->id)
- {
- /* if a non top-tab has been activated, switch to the
- top-tab instead - but only if is visible */
- if (tw->shaded)
- {
- int newState;
- newState = tw->state & ~CompWindowStateShadedMask;
- changeWindowState (tw, newState);
- updateWindowAttributes (tw,
- CompStackingUpdateModeNone);
- }
- else if (tw->minimized)
- unminimizeWindow (tw);
-
- if (!(tw->state & CompWindowStateHiddenMask))
- {
- if (gw->group->changeState == NoTabChange)
- gw->group->activateTab = gw->slot;
- sendWindowActivationRequest (tw->screen, tw->id);
- }
- }
- }
+ if (gw->group->changeState == NoTabChange)
+ gw->group->activateTab = gw->slot;
+ sendWindowActivationRequest (tw->screen, tw->id);
}
+ }
}
- break;
+ }
+ }
+ break;
- default:
- if (event->type == d->shapeEvent + ShapeNotify)
+ default:
+ if (event->type == d->shapeEvent + ShapeNotify)
+ {
+ XShapeEvent *se = (XShapeEvent *) event;
+ if (se->kind == ShapeInput)
+ {
+ CompWindow *w;
+ w = findWindowAtDisplay (d, se->window);
+ if (w)
{
- XShapeEvent *se = (XShapeEvent*)event;
- if (se->kind == ShapeInput)
- {
- CompWindow *w;
- w = findWindowAtDisplay (d, se->window);
- if (w)
- {
- GROUP_WINDOW (w);
-
- if (gw->windowHideInfo)
- groupClearWindowInputShape (w, gw->windowHideInfo);
- }
- }
+ GROUP_WINDOW (w);
+
+ if (gw->windowHideInfo)
+ groupClearWindowInputShape (w, gw->windowHideInfo);
}
- break;
+ }
}
+ break;
+ }
- UNWRAP (gd, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (gd, d, handleEvent, groupHandleEvent);
+ UNWRAP (gd, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP (gd, d, handleEvent, groupHandleEvent);
- switch (event->type) {
- case PropertyNotify:
- if (event->xproperty.atom == d->winActiveAtom)
- {
- CompWindow *w;
- w = findWindowAtDisplay (d, d->activeWindow);
- if (w)
- {
- GROUP_WINDOW (w);
+ switch (event->type) {
+ case PropertyNotify:
+ if (event->xproperty.atom == d->winActiveAtom)
+ {
+ CompWindow *w;
+ w = findWindowAtDisplay (d, d->activeWindow);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- if (gw->group && gw->group->activateTab)
- {
- groupChangeTab (gw->group->activateTab, RotateUncertain);
- gw->group->activateTab = NULL;
- }
- }
+ if (gw->group && gw->group->activateTab)
+ {
+ groupChangeTab (gw->group->activateTab, RotateUncertain);
+ gw->group->activateTab = NULL;
}
- else if (event->xproperty.atom == d->wmNameAtom)
+ }
+ }
+ else if (event->xproperty.atom == d->wmNameAtom)
+ {
+ CompWindow *w;
+ w = findWindowAtDisplay (d, event->xproperty.window);
+ if (w)
+ {
+ GROUP_WINDOW (w);
+
+ if (gw->group && gw->group->tabBar &&
+ gw->group->tabBar->textSlot &&
+ gw->group->tabBar->textSlot->window == w)
{
- CompWindow *w;
- w = findWindowAtDisplay (d, event->xproperty.window);
- if (w)
- {
- GROUP_WINDOW (w);
-
- if (gw->group && gw->group->tabBar &&
- gw->group->tabBar->textSlot &&
- gw->group->tabBar->textSlot->window == w)
- {
- /* make sure we are using the updated name */
- groupRenderWindowTitle (gw->group);
- groupDamageTabBarRegion (gw->group);
- }
- }
+ /* make sure we are using the updated name */
+ groupRenderWindowTitle (gw->group);
+ groupDamageTabBarRegion (gw->group);
}
- break;
+ }
+ }
+ break;
+
+ case EnterNotify:
+ {
+ CompWindow *w;
+ w = findWindowAtDisplay (d, event->xcrossing.window);
+ if (w)
+ {
+ GROUP_WINDOW (w);
+ GROUP_SCREEN (w->screen);
+
+ if (gs->showDelayTimeoutHandle)
+ compRemoveTimeout (gs->showDelayTimeoutHandle);
+
+ if (w->id != w->screen->grabWindow)
+ groupUpdateTabBars (w->screen, w->id);
- case EnterNotify:
+ if (gw->group)
{
- CompWindow *w;
- w = findWindowAtDisplay (d, event->xcrossing.window);
- if (w)
- {
- GROUP_WINDOW (w);
- GROUP_SCREEN (w->screen);
-
- if (gs->showDelayTimeoutHandle)
- compRemoveTimeout (gs->showDelayTimeoutHandle);
-
- if (w->id != w->screen->grabWindow)
- groupUpdateTabBars (w->screen, w->id);
-
- if (gw->group)
- {
- if (gs->draggedSlot && gs->dragged &&
- IS_TOP_TAB (w, gw->group))
- {
- int hoverTime;
- hoverTime = groupGetDragHoverTime (w->screen) * 1000;
- if (gs->dragHoverTimeoutHandle)
- compRemoveTimeout (gs->dragHoverTimeoutHandle);
-
- if (hoverTime > 0)
- gs->dragHoverTimeoutHandle =
- compAddTimeout (hoverTime,
- groupDragHoverTimeout, w);
- }
- }
- }
- break;
+ if (gs->draggedSlot && gs->dragged &&
+ IS_TOP_TAB (w, gw->group))
+ {
+ int hoverTime;
+ hoverTime = groupGetDragHoverTime (w->screen) * 1000;
+ if (gs->dragHoverTimeoutHandle)
+ compRemoveTimeout (gs->dragHoverTimeoutHandle);
+
+ if (hoverTime > 0)
+ gs->dragHoverTimeoutHandle =
+ compAddTimeout (hoverTime,
+ groupDragHoverTimeout, w);
+ }
}
+ }
+ }
+ break;
+
+ case ConfigureNotify:
+ {
+ CompWindow *w;
+
+ w = findWindowAtDisplay (d, event->xconfigure.window);
+ if (w)
+ {
+ GROUP_WINDOW (w);
- case ConfigureNotify:
+ if (gw->group && gw->group->tabBar &&
+ IS_TOP_TAB (w, gw->group) && gw->group->inputPrevention)
{
- CompWindow *w;
+ XWindowChanges xwc;
- w = findWindowAtDisplay (d, event->xconfigure.window);
- if (w)
- {
- GROUP_WINDOW (w);
-
- if (gw->group && gw->group->tabBar &&
- IS_TOP_TAB (w, gw->group) && gw->group->inputPrevention)
- {
- XWindowChanges xwc;
-
- xwc.stack_mode = Above;
- xwc.sibling = w->id;
-
- XConfigureWindow (w->screen->display->display,
- gw->group->inputPrevention,
- CWSibling | CWStackMode, &xwc);
- }
-
- if (event->xconfigure.above != None)
- {
- if (gw->group && !gw->group->tabBar &&
- (gw->group != gd->lastRestackedGroup))
- {
- if (groupGetRaiseAll (w->screen))
- groupRaiseWindows (w, gw->group);
- }
- if (w->managed && !w->attrib.override_redirect)
- gd->lastRestackedGroup = gw->group;
- }
- }
- break;
+ xwc.stack_mode = Above;
+ xwc.sibling = w->id;
+
+ XConfigureWindow (w->screen->display->display,
+ gw->group->inputPrevention,
+ CWSibling | CWStackMode, &xwc);
}
- default:
- break;
+ if (event->xconfigure.above != None)
+ {
+ if (gw->group && !gw->group->tabBar &&
+ (gw->group != gd->lastRestackedGroup))
+ {
+ if (groupGetRaiseAll (w->screen))
+ groupRaiseWindows (w, gw->group);
+ }
+ if (w->managed && !w->attrib.override_redirect)
+ gd->lastRestackedGroup = gw->group;
+ }
+ }
}
+ break;
+
+ default:
+ break;
+ }
}
/*
@@ -1659,35 +1663,35 @@ groupHandleEvent (CompDisplay *d,
*/
void
groupGetOutputExtentsForWindow (CompWindow *w,
- CompWindowExtents *output)
+ CompWindowExtents *output)
{
- GROUP_SCREEN (w->screen);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (w->screen);
+ GROUP_WINDOW (w);
- UNWRAP (gs, w->screen, getOutputExtentsForWindow);
- (*w->screen->getOutputExtentsForWindow) (w, output);
- WRAP (gs, w->screen, getOutputExtentsForWindow,
- groupGetOutputExtentsForWindow);
+ UNWRAP (gs, w->screen, getOutputExtentsForWindow);
+ (*w->screen->getOutputExtentsForWindow) (w, output);
+ WRAP (gs, w->screen, getOutputExtentsForWindow,
+ groupGetOutputExtentsForWindow);
- if (gw->group && gw->group->nWins > 1)
- {
- GROUP_DISPLAY (w->screen->display);
-
- int glowSize = groupGetGlowSize (w->screen);
- int glowType = groupGetGlowType (w->screen);
- int glowTextureSize = gd->glowTextureProperties[glowType].textureSize;
- int glowOffset = gd->glowTextureProperties[glowType].glowOffset;
-
- glowSize = glowSize * (glowTextureSize - glowOffset) / glowTextureSize;
-
- /* glowSize is the size of the glow outside the window decoration
- * (w->input), while w->output includes the size of w->input
- * this is why we have to add w->input here */
- output->left = MAX (output->left, glowSize + w->input.left);
- output->right = MAX (output->right, glowSize + w->input.right);
- output->top = MAX (output->top, glowSize + w->input.top);
- output->bottom = MAX (output->bottom, glowSize + w->input.bottom);
- }
+ if (gw->group && gw->group->nWins > 1)
+ {
+ GROUP_DISPLAY (w->screen->display);
+
+ int glowSize = groupGetGlowSize (w->screen);
+ int glowType = groupGetGlowType (w->screen);
+ int glowTextureSize = gd->glowTextureProperties[glowType].textureSize;
+ int glowOffset = gd->glowTextureProperties[glowType].glowOffset;
+
+ glowSize = glowSize * (glowTextureSize - glowOffset) / glowTextureSize;
+
+ /* glowSize is the size of the glow outside the window decoration
+ * (w->input), while w->output includes the size of w->input
+ * this is why we have to add w->input here */
+ output->left = MAX (output->left, glowSize + w->input.left);
+ output->right = MAX (output->right, glowSize + w->input.right);
+ output->top = MAX (output->top, glowSize + w->input.top);
+ output->bottom = MAX (output->bottom, glowSize + w->input.bottom);
+ }
}
/*
@@ -1696,57 +1700,57 @@ groupGetOutputExtentsForWindow (CompWindow *w,
*/
void
groupWindowResizeNotify (CompWindow *w,
- int dx,
- int dy,
- int dwidth,
- int dheight)
+ int dx,
+ int dy,
+ int dwidth,
+ int dheight)
{
- CompScreen *s = w->screen;
+ CompScreen *s = w->screen;
- GROUP_SCREEN (s);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (s);
+ GROUP_WINDOW (w);
- if (gw->resizeGeometry)
- {
- free (gw->resizeGeometry);
- gw->resizeGeometry = NULL;
- }
+ if (gw->resizeGeometry)
+ {
+ free (gw->resizeGeometry);
+ gw->resizeGeometry = NULL;
+ }
- UNWRAP (gs, s, windowResizeNotify);
- (*s->windowResizeNotify) (w, dx, dy, dwidth, dheight);
- WRAP (gs, s, windowResizeNotify, groupWindowResizeNotify);
+ UNWRAP (gs, s, windowResizeNotify);
+ (*s->windowResizeNotify) (w, dx, dy, dwidth, dheight);
+ WRAP (gs, s, windowResizeNotify, groupWindowResizeNotify);
- if (gw->glowQuads)
- groupComputeGlowQuads (w, &gs->glowTexture.matrix);
+ if (gw->glowQuads)
+ groupComputeGlowQuads (w, &gs->glowTexture.matrix);
- if (gw->group && gw->group->tabBar)
+ if (gw->group && gw->group->tabBar)
+ {
+ if (IS_TOP_TAB (w, gw->group))
{
- if (IS_TOP_TAB (w, gw->group))
- {
- int i;
+ int i;
- if (gw->group->tabBar->state != PaintOff)
- {
- groupRecalcTabBarPos (gw->group, pointerX,
- WIN_X (w), WIN_X (w) + WIN_WIDTH (w));
- }
+ if (gw->group->tabBar->state != PaintOff)
+ {
+ groupRecalcTabBarPos (gw->group, pointerX,
+ WIN_X (w), WIN_X (w) + WIN_WIDTH (w));
+ }
- /* move the non-top tabs to the new center of the window */
- for (i = 0; i < gw->group->nWins; i++)
- {
- CompWindow *cw = gw->group->windows[i];
- int dx, dy;
+ /* move the non-top tabs to the new center of the window */
+ for (i = 0; i < gw->group->nWins; i++)
+ {
+ CompWindow *cw = gw->group->windows[i];
+ int dx, dy;
- if (cw->id == w->id)
- continue;
+ if (cw->id == w->id)
+ continue;
- dx = WIN_CENTER_X (w) - WIN_CENTER_X (cw);
- dy = WIN_CENTER_Y (w) - WIN_CENTER_Y (cw);
+ dx = WIN_CENTER_X (w) - WIN_CENTER_X (cw);
+ dy = WIN_CENTER_Y (w) - WIN_CENTER_Y (cw);
- groupEnqueueMoveNotify (cw, dx, dy, TRUE, TRUE);
- }
- }
+ groupEnqueueMoveNotify (cw, dx, dy, TRUE, TRUE);
+ }
}
+ }
}
/*
@@ -1755,358 +1759,358 @@ groupWindowResizeNotify (CompWindow *w,
*/
void
groupWindowMoveNotify (CompWindow *w,
- int dx,
- int dy,
- Bool immediate)
+ int dx,
+ int dy,
+ Bool immediate)
{
- CompScreen *s = w->screen;
- Bool viewportChange;
- int i;
+ CompScreen *s = w->screen;
+ Bool viewportChange;
+ int i;
- GROUP_SCREEN (s);
- GROUP_DISPLAY (s->display);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (s);
+ GROUP_DISPLAY (s->display);
+ GROUP_WINDOW (w);
- UNWRAP (gs, s, windowMoveNotify);
- (*s->windowMoveNotify) (w, dx, dy, immediate);
- WRAP (gs, s, windowMoveNotify, groupWindowMoveNotify);
+ UNWRAP (gs, s, windowMoveNotify);
+ (*s->windowMoveNotify) (w, dx, dy, immediate);
+ WRAP (gs, s, windowMoveNotify, groupWindowMoveNotify);
- if (gw->glowQuads)
- groupComputeGlowQuads (w, &gs->glowTexture.matrix);
+ if (gw->glowQuads)
+ groupComputeGlowQuads (w, &gs->glowTexture.matrix);
- if (!gw->group || gs->queued)
- return;
+ if (!gw->group || gs->queued)
+ return;
- /* FIXME: we need a reliable, 100% safe way to detect window
- moves caused by viewport changes here */
- viewportChange = ((dx && !(dx % w->screen->width)) ||
- (dy && !(dy % w->screen->height)));
+ /* FIXME: we need a reliable, 100% safe way to detect window
+ moves caused by viewport changes here */
+ viewportChange = ((dx && !(dx % w->screen->width)) ||
+ (dy && !(dy % w->screen->height)));
- if (viewportChange && (gw->animateState & IS_ANIMATED))
- {
- gw->destination.x += dx;
- gw->destination.y += dy;
- }
+ if (viewportChange && (gw->animateState & IS_ANIMATED))
+ {
+ gw->destination.x += dx;
+ gw->destination.y += dy;
+ }
- if (gw->group->tabBar && IS_TOP_TAB (w, gw->group))
- {
- GroupTabBarSlot *slot;
- GroupTabBar *bar = gw->group->tabBar;
+ if (gw->group->tabBar && IS_TOP_TAB (w, gw->group))
+ {
+ GroupTabBarSlot *slot;
+ GroupTabBar *bar = gw->group->tabBar;
- bar->rightSpringX += dx;
- bar->leftSpringX += dx;
+ bar->rightSpringX += dx;
+ bar->leftSpringX += dx;
- groupMoveTabBarRegion (gw->group, dx, dy, TRUE);
+ groupMoveTabBarRegion (gw->group, dx, dy, TRUE);
- for (slot = bar->slots; slot; slot = slot->next)
- {
- XOffsetRegion (slot->region, dx, dy);
- slot->springX += dx;
- }
+ for (slot = bar->slots; slot; slot = slot->next)
+ {
+ XOffsetRegion (slot->region, dx, dy);
+ slot->springX += dx;
}
+ }
- if (!groupGetMoveAll (s) || gd->ignoreMode ||
- (gw->group->tabbingState != NoTabbing) ||
- (gw->group->grabWindow != w->id) ||
- !(gw->group->grabMask & CompWindowGrabMoveMask))
- return;
+ if (!groupGetMoveAll (s) || gd->ignoreMode ||
+ (gw->group->tabbingState != NoTabbing) ||
+ (gw->group->grabWindow != w->id) ||
+ !(gw->group->grabMask & CompWindowGrabMoveMask))
+ return;
- for (i = 0; i < gw->group->nWins; i++)
- {
- CompWindow *cw = gw->group->windows[i];
- if (!cw)
- continue;
+ for (i = 0; i < gw->group->nWins; i++)
+ {
+ CompWindow *cw = gw->group->windows[i];
+ if (!cw)
+ continue;
- if (cw->id == w->id)
- continue;
+ if (cw->id == w->id)
+ continue;
- GROUP_WINDOW (cw);
+ GROUP_WINDOW (cw);
- if (cw->state & MAXIMIZE_STATE)
- {
- if (viewportChange)
- {
- gw->needsPosSync = TRUE;
- groupEnqueueMoveNotify (cw, -dx, -dy, immediate, TRUE);
- }
- }
- else if (!viewportChange)
- {
- gw->needsPosSync = TRUE;
- groupEnqueueMoveNotify (cw, dx, dy, immediate, FALSE);
- }
+ if (cw->state & MAXIMIZE_STATE)
+ {
+ if (viewportChange)
+ {
+ gw->needsPosSync = TRUE;
+ groupEnqueueMoveNotify (cw, -dx, -dy, immediate, TRUE);
+ }
}
+ else if (!viewportChange)
+ {
+ gw->needsPosSync = TRUE;
+ groupEnqueueMoveNotify (cw, dx, dy, immediate, FALSE);
+ }
+ }
}
void
groupWindowGrabNotify (CompWindow *w,
- int x,
- int y,
- unsigned int state,
- unsigned int mask)
+ int x,
+ int y,
+ unsigned int state,
+ unsigned int mask)
{
- CompScreen *s = w->screen;
+ CompScreen *s = w->screen;
- GROUP_SCREEN (s);
- GROUP_DISPLAY (s->display);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (s);
+ GROUP_DISPLAY (s->display);
+ GROUP_WINDOW (w);
- if (gw->group && !gd->ignoreMode && !gs->queued)
- {
- Bool doResizeAll;
- int i;
+ if (gw->group && !gd->ignoreMode && !gs->queued)
+ {
+ Bool doResizeAll;
+ int i;
- doResizeAll = groupGetResizeAll (s) &&
- (mask & CompWindowGrabResizeMask);
+ doResizeAll = groupGetResizeAll (s) &&
+ (mask & CompWindowGrabResizeMask);
- if (gw->group->tabBar)
- groupTabSetVisibility (gw->group, FALSE, 0);
-
- for (i = 0; i < gw->group->nWins; i++)
- {
- CompWindow *cw = gw->group->windows[i];
- if (!cw)
- continue;
+ if (gw->group->tabBar)
+ groupTabSetVisibility (gw->group, FALSE, 0);
- if (cw->id != w->id)
- {
- GroupWindow *gcw = GET_GROUP_WINDOW (cw, gs);
-
- groupEnqueueGrabNotify (cw, x, y, state, mask);
-
- if (doResizeAll && !(cw->state & MAXIMIZE_STATE))
- {
- if (!gcw->resizeGeometry)
- gcw->resizeGeometry = malloc (sizeof (XRectangle));
- if (gcw->resizeGeometry)
- {
- gcw->resizeGeometry->x = WIN_X (cw);
- gcw->resizeGeometry->y = WIN_Y (cw);
- gcw->resizeGeometry->width = WIN_WIDTH (cw);
- gcw->resizeGeometry->height = WIN_HEIGHT (cw);
- }
- }
- }
- }
+ for (i = 0; i < gw->group->nWins; i++)
+ {
+ CompWindow *cw = gw->group->windows[i];
+ if (!cw)
+ continue;
- if (doResizeAll)
- {
- if (!gd->resizeInfo)
- gd->resizeInfo = malloc (sizeof (GroupResizeInfo));
+ if (cw->id != w->id)
+ {
+ GroupWindow *gcw = GET_GROUP_WINDOW (cw, gs);
- if (gd->resizeInfo)
- {
- gd->resizeInfo->resizedWindow = w;
- gd->resizeInfo->origGeometry.x = WIN_X (w);
- gd->resizeInfo->origGeometry.y = WIN_Y (w);
- gd->resizeInfo->origGeometry.width = WIN_WIDTH (w);
- gd->resizeInfo->origGeometry.height = WIN_HEIGHT (w);
- }
+ groupEnqueueGrabNotify (cw, x, y, state, mask);
+
+ if (doResizeAll && !(cw->state & MAXIMIZE_STATE))
+ {
+ if (!gcw->resizeGeometry)
+ gcw->resizeGeometry = malloc (sizeof (XRectangle));
+ if (gcw->resizeGeometry)
+ {
+ gcw->resizeGeometry->x = WIN_X (cw);
+ gcw->resizeGeometry->y = WIN_Y (cw);
+ gcw->resizeGeometry->width = WIN_WIDTH (cw);
+ gcw->resizeGeometry->height = WIN_HEIGHT (cw);
+ }
}
+ }
+ }
- gw->group->grabWindow = w->id;
- gw->group->grabMask = mask;
+ if (doResizeAll)
+ {
+ if (!gd->resizeInfo)
+ gd->resizeInfo = malloc (sizeof (GroupResizeInfo));
+
+ if (gd->resizeInfo)
+ {
+ gd->resizeInfo->resizedWindow = w;
+ gd->resizeInfo->origGeometry.x = WIN_X (w);
+ gd->resizeInfo->origGeometry.y = WIN_Y (w);
+ gd->resizeInfo->origGeometry.width = WIN_WIDTH (w);
+ gd->resizeInfo->origGeometry.height = WIN_HEIGHT (w);
+ }
}
- UNWRAP (gs, s, windowGrabNotify);
- (*s->windowGrabNotify) (w, x, y, state, mask);
- WRAP (gs, s, windowGrabNotify, groupWindowGrabNotify);
+ gw->group->grabWindow = w->id;
+ gw->group->grabMask = mask;
+ }
+
+ UNWRAP (gs, s, windowGrabNotify);
+ (*s->windowGrabNotify) (w, x, y, state, mask);
+ WRAP (gs, s, windowGrabNotify, groupWindowGrabNotify);
}
void
groupWindowUngrabNotify (CompWindow *w)
{
- CompScreen *s = w->screen;
+ CompScreen *s = w->screen;
- GROUP_SCREEN (s);
- GROUP_DISPLAY (s->display);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (s);
+ GROUP_DISPLAY (s->display);
+ GROUP_WINDOW (w);
- if (gw->group && !gd->ignoreMode && !gs->queued)
+ if (gw->group && !gd->ignoreMode && !gs->queued)
+ {
+ if (!gw->group->tabBar)
{
- if (!gw->group->tabBar)
+ int i;
+ XRectangle rect;
+
+ groupDequeueMoveNotifies (s);
+
+ if (gd->resizeInfo)
+ {
+ rect.x = WIN_X (w);
+ rect.y = WIN_Y (w);
+ rect.width = WIN_WIDTH (w);
+ rect.height = WIN_HEIGHT (w);
+ }
+
+ for (i = 0; i < gw->group->nWins; i++)
+ {
+ CompWindow *cw = gw->group->windows[i];
+ if (!cw)
+ continue;
+
+ if (cw->id != w->id)
{
- int i;
- XRectangle rect;
+ GROUP_WINDOW (cw);
+
+ if (gw->resizeGeometry)
+ {
+ unsigned int mask;
- groupDequeueMoveNotifies (s);
+ gw->resizeGeometry->x = WIN_X (cw);
+ gw->resizeGeometry->y = WIN_Y (cw);
+ gw->resizeGeometry->width = WIN_WIDTH (cw);
+ gw->resizeGeometry->height = WIN_HEIGHT (cw);
- if (gd->resizeInfo)
+ mask = groupUpdateResizeRectangle (cw, &rect, FALSE);
+ if (mask)
{
- rect.x = WIN_X (w);
- rect.y = WIN_Y (w);
- rect.width = WIN_WIDTH (w);
- rect.height = WIN_HEIGHT (w);
- }
+ XWindowChanges xwc;
+ xwc.x = gw->resizeGeometry->x;
+ xwc.y = gw->resizeGeometry->y;
+ xwc.width = gw->resizeGeometry->width;
+ xwc.height = gw->resizeGeometry->height;
- for (i = 0; i < gw->group->nWins; i++)
+ configureXWindow (cw, mask, &xwc);
+ }
+ else
{
- CompWindow *cw = gw->group->windows[i];
- if (!cw)
- continue;
-
- if (cw->id != w->id)
- {
- GROUP_WINDOW (cw);
-
- if (gw->resizeGeometry)
- {
- unsigned int mask;
-
- gw->resizeGeometry->x = WIN_X (cw);
- gw->resizeGeometry->y = WIN_Y (cw);
- gw->resizeGeometry->width = WIN_WIDTH (cw);
- gw->resizeGeometry->height = WIN_HEIGHT (cw);
-
- mask = groupUpdateResizeRectangle (cw, &rect, FALSE);
- if (mask)
- {
- XWindowChanges xwc;
- xwc.x = gw->resizeGeometry->x;
- xwc.y = gw->resizeGeometry->y;
- xwc.width = gw->resizeGeometry->width;
- xwc.height = gw->resizeGeometry->height;
-
- configureXWindow (cw, mask, &xwc);
- }
- else
- {
- free (gw->resizeGeometry);
- gw->resizeGeometry = NULL;
- }
- }
- if (gw->needsPosSync)
- {
- syncWindowPosition (cw);
- gw->needsPosSync = FALSE;
- }
- groupEnqueueUngrabNotify (cw);
- }
+ free (gw->resizeGeometry);
+ gw->resizeGeometry = NULL;
}
+ }
+ if (gw->needsPosSync)
+ {
+ syncWindowPosition (cw);
+ gw->needsPosSync = FALSE;
+ }
+ groupEnqueueUngrabNotify (cw);
}
+ }
+ }
- if (gd->resizeInfo)
- {
- free (gd->resizeInfo);
- gd->resizeInfo = NULL;
- }
-
- gw->group->grabWindow = None;
- gw->group->grabMask = 0;
+ if (gd->resizeInfo)
+ {
+ free (gd->resizeInfo);
+ gd->resizeInfo = NULL;
}
- UNWRAP (gs, s, windowUngrabNotify);
- (*s->windowUngrabNotify) (w);
- WRAP( gs, s, windowUngrabNotify, groupWindowUngrabNotify);
+ gw->group->grabWindow = None;
+ gw->group->grabMask = 0;
+ }
+
+ UNWRAP (gs, s, windowUngrabNotify);
+ (*s->windowUngrabNotify) (w);
+ WRAP( gs, s, windowUngrabNotify, groupWindowUngrabNotify);
}
Bool
groupDamageWindowRect (CompWindow *w,
- Bool initial,
- BoxPtr rect)
+ Bool initial,
+ BoxPtr rect)
{
- Bool status;
- CompScreen *s = w->screen;
+ Bool status;
+ CompScreen *s = w->screen;
- GROUP_SCREEN (s);
- GROUP_WINDOW (w);
+ GROUP_SCREEN (s);
+ GROUP_WINDOW (w);
- UNWRAP (gs, s, damageWindowRect);
- status = (*s->damageWindowRect) (w,initial,rect);
- WRAP (gs, s, damageWindowRect, groupDamageWindowRect);
+ UNWRAP (gs, s, damageWindowRect);
+ status = (*s->damageWindowRect) (w,initial,rect);
+ WRAP (gs, s, damageWindowRect, groupDamageWindowRect);
- if (initial)
+ if (initial)
+ {
+ if (groupGetAutotabCreate (s) &&
+ matchEval (groupGetWindowMatch (s), w))
{
- if (groupGetAutotabCreate (s) &&
- matchEval (groupGetWindowMatch (s), w))
- {
- if (!gw->group && (gw->windowState == WindowNor