summaryrefslogtreecommitdiff
path: root/src/tile.c
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2007-04-17 09:54:13 +0200
committerDanny Baumann <dannybaumann@web.de>2007-04-17 09:54:13 +0200
commit477a74f5a5cdd3f9f03431959f456c58065c9208 (patch)
tree3920de9862cac4e757a66f72327a86d8a4d81488 /src/tile.c
parent2de875249fc5d40d5b3b7ba0acb859a8997b007e (diff)
downloadberyl-premerge-477a74f5a5cdd3f9f03431959f456c58065c9208.tar.gz
beryl-premerge-477a74f5a5cdd3f9f03431959f456c58065c9208.tar.bz2
Issue screen grab while animating.
Diffstat (limited to 'src/tile.c')
-rw-r--r--src/tile.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/src/tile.c b/src/tile.c
index 2477644..abbb512 100644
--- a/src/tile.c
+++ b/src/tile.c
@@ -52,7 +52,7 @@ typedef struct _TileDisplay {
typedef struct _TileScreen {
int windowPrivateIndex;
- Bool isAnimating;
+ int grabIndex;
int oneDuration; // duration of animation for one window
int msResizing; // number of ms elapsed from start of resizing animation
TileTileToggleTypeEnum tileType;
@@ -229,23 +229,9 @@ static void tilePreparePaintScreen(CompScreen * s, int msSinceLastPaint)
TILE_SCREEN(s);
// add spent time
- if (ts->isAnimating)
+ if (ts->grabIndex)
ts->msResizing += msSinceLastPaint;
- // Check if the animation hasnt finished yet
- if (ts->isAnimating && ts->msResizing > tileGetAnimationDuration(s->display))
- {
- CompWindow *w;
- for (w = s->windows; w; w = w->next)
- {
- TILE_WINDOW(w);
- tw->animationType = NoAnimation;
- }
-
- ts->isAnimating = FALSE;
- ts->msResizing = 0;
- }
-
UNWRAP(ts, s, preparePaintScreen);
(*s->preparePaintScreen) (s, msSinceLastPaint);
WRAP(ts, s, preparePaintScreen, tilePreparePaintScreen);
@@ -255,8 +241,25 @@ static void tileDonePaintScreen(CompScreen * s)
{
TILE_SCREEN(s);
- if (ts->isAnimating)
- damageScreen(s);
+ if (ts->grabIndex)
+ {
+ if (ts->msResizing > tileGetAnimationDuration(s->display))
+ {
+ CompWindow *w;
+ for (w = s->windows; w; w = w->next)
+ {
+ TILE_WINDOW(w);
+ tw->animationType = NoAnimation;
+ }
+
+ ts->msResizing = 0;
+
+ removeScreenGrab(s, ts->grabIndex, NULL);
+ ts->grabIndex = 0;
+ }
+ else
+ damageScreen(s);
+ }
UNWRAP(ts, s, donePaintScreen);
(*s->donePaintScreen) (s);
@@ -273,7 +276,7 @@ static Bool tilePaintScreen(CompScreen * s,
TILE_SCREEN(s);
- if (ts->isAnimating)
+ if (ts->grabIndex)
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
UNWRAP(ts, s, paintScreen);
@@ -282,7 +285,8 @@ static Bool tilePaintScreen(CompScreen * s,
// Check if animation is enabled, there is resizing on screen and only outline should be drawn
- if (ts->isAnimating && (tileGetAnimateType(s->display) == AnimateTypeOutline))
+ if (ts->grabIndex &&
+ (tileGetAnimateType(s->display) == AnimateTypeOutline))
{
CompWindow *w;
float animationDuration = tileGetAnimationDuration(s->display);
@@ -354,7 +358,7 @@ static void tileResizeNotify(CompWindow * w, int dx, int dy, int dwidth, int dhe
}
// Dont do anything if joining is disabled or windows are being resized
- if (!tileGetTileJoin(w->screen->display) || ts->isAnimating)
+ if (!tileGetTileJoin(w->screen->display) || ts->grabIndex)
return;
/* determine previous and next tiled window */
@@ -493,7 +497,7 @@ static Bool tileInitScreen(CompPlugin * p, CompScreen * s)
s->privates[td->screenPrivateIndex].ptr = ts;
- ts->isAnimating = FALSE;
+ ts->grabIndex = 0;
ts->msResizing = 0;
ts->oneDuration = 0;
@@ -609,9 +613,7 @@ static Bool placeWindow(CompWindow *w, int x, int y, int width, int height)
tileSetNewWindowSize(w);
/* fall-through */
case AnimateTypeFade:
- ts->isAnimating = TRUE;
tw->animationType = Animating;
- ts->msResizing = 0;
break;
default:
break;
@@ -693,7 +695,7 @@ static Bool applyTiling(CompScreen *s)
{
TILE_SCREEN(s);
- if (ts->isAnimating)
+ if (ts->grabIndex)
return FALSE;
int count = 0;
@@ -870,6 +872,11 @@ static Bool applyTiling(CompScreen *s)
break;
}
}
+
+ if (!ts->grabIndex)
+ ts->grabIndex = pushScreenGrab(s, s->invisibleCursor, "tile");
+
+ ts->msResizing = 0;
}
return TRUE;