diff options
author | roico <roico@d7aaf104-2d23-0410-ae22-9d23157bf5a3> | 2007-02-13 22:28:35 +0000 |
---|---|---|
committer | roico <roico@d7aaf104-2d23-0410-ae22-9d23157bf5a3> | 2007-02-13 22:28:35 +0000 |
commit | fe44154c4e8bc5cbb5e449769c86e29f911c2810 (patch) | |
tree | 106319f1d0534dcf4987d62cc8dbb81b0b00cbcf | |
parent | d3872598e515bf161195501b4537a41e0a352500 (diff) | |
download | marex-dev-fe44154c4e8bc5cbb5e449769c86e29f911c2810.tar.gz marex-dev-fe44154c4e8bc5cbb5e449769c86e29f911c2810.tar.bz2 |
- the window that is visible on the change tab-animation is now always
activated.
- some minor changes to hnadle animation.
- changing tabs back during animation (i.e super+right and super+left
instantly) will reverse the animation.
git-svn-id: file:///beryl/trunk@4044 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r-- | beryl-plugins/src/group/tab.c | 92 |
1 files changed, 64 insertions, 28 deletions
diff --git a/beryl-plugins/src/group/tab.c b/beryl-plugins/src/group/tab.c index 0fdbfaf..75ca2b3 100644 --- a/beryl-plugins/src/group/tab.c +++ b/beryl-plugins/src/group/tab.c @@ -453,8 +453,6 @@ groupHandleTabChange(CompScreen *s, GroupSelection *group) TRUE, TRUE); syncWindowPosition(topTab); gs->queued = FALSE; - - activateWindow (topTab); if(group->prevTopTab) { //we use only the half time here - the second half will be PaintFadeOut @@ -498,27 +496,39 @@ groupHandleAnimation(CompScreen *s, GroupSelection *group) group->changeAnimationTime = gs->opt[GROUP_SCREEN_OPTION_CHANGE_ANIMATION_TIME].value.f * 500 + group->changeAnimationTime; + if (group->changeAnimationTime <= 0) + group->changeAnimationTime = 0; + group->changeState = PaintFadeOut; + + if (HAS_TOP_WIN(group)) + activateWindow (TOP_TAB(group)); } if (group->changeState == PaintFadeOut && group->changeAnimationTime <= 0) - { + { + int oldChangeAnimationTime = group->changeAnimationTime; + if (group->prevTopTab) moveWindowOffscreen(PREV_TOP_TAB(group)); group->prevTopTab = group->topTab; - group->changeState = PaintOff; - group->changeAnimationTime = 0; if (group->nextTopTab) { groupChangeTab(group->nextTopTab, group->nextDirection); group->nextTopTab = NULL; groupHandleTabChange(s, group); + + if (group->changeState == PaintFadeIn) + group->changeAnimationTime += oldChangeAnimationTime; // If a new animation was started. } - else if (gs->opt[GROUP_SCREEN_OPTION_VISIBILITY_TIME].value.f != 0.0f) { + if (group->changeAnimationTime <= 0) + group->changeAnimationTime = 0; + + else if (gs->opt[GROUP_SCREEN_OPTION_VISIBILITY_TIME].value.f != 0.0f && group->changeState == PaintOff) { groupTabSetVisibility (group, TRUE, PERMANENT | SHOW_BAR_INSTANTLY_MASK); if (group->tabBar->timeoutHandle) @@ -1343,57 +1353,83 @@ groupUntabGroup(GroupSelection *group) Bool groupChangeTab(GroupTabBarSlot* topTab, ChangeTabAnimationDirection direction) { - if(!topTab) + if (!topTab) return TRUE; CompWindow* w = topTab->window; GROUP_WINDOW(w); + GROUP_SCREEN(w->screen); + + GroupSelection *group = gw->group; - if(!gw->group || gw->group->topTab == topTab || gw->group->tabbingState != PaintOff) + if (!group || group->tabbingState != PaintOff) + return TRUE; + + if (group->changeState == PaintOff && group->topTab == topTab) + return TRUE; + + if (group->changeState != PaintOff && group->nextTopTab == topTab) return TRUE; - if (gw->group->prevTopTab && gw->group->changeState == PaintOff) { - gw->group->oldTopTabCenterX = WIN_X(PREV_TOP_TAB(gw->group)) + WIN_WIDTH(PREV_TOP_TAB(gw->group))/2; - gw->group->oldTopTabCenterY = WIN_Y(PREV_TOP_TAB(gw->group)) + WIN_HEIGHT(PREV_TOP_TAB(gw->group))/2; + if (group->prevTopTab && group->changeState == PaintOff) { + group->oldTopTabCenterX = WIN_X(PREV_TOP_TAB(group)) + WIN_WIDTH(PREV_TOP_TAB(group))/2; + group->oldTopTabCenterY = WIN_Y(PREV_TOP_TAB(group)) + WIN_HEIGHT(PREV_TOP_TAB(group))/2; } - if(gw->group->changeState != PaintOff) - gw->group->nextDirection = direction; + if (group->changeState != PaintOff) + group->nextDirection = direction; else if (direction == RotateLeft) - gw->group->changeAnimationDirection = 1; + group->changeAnimationDirection = 1; else if (direction == RotateRight) - gw->group->changeAnimationDirection = -1; + group->changeAnimationDirection = -1; else { int distanceOld = 0, distanceNew = 0; GroupTabBarSlot *slot; - if (gw->group->topTab) - for (slot = gw->group->tabBar->slots; slot && (slot != gw->group->topTab); + if (group->topTab) + for (slot = group->tabBar->slots; slot && (slot != group->topTab); slot = slot->next, distanceOld++); - for (slot = gw->group->tabBar->slots; slot && (slot != topTab); + for (slot = group->tabBar->slots; slot && (slot != topTab); slot = slot->next, distanceNew++); if (distanceNew < distanceOld) - gw->group->changeAnimationDirection = 1; //left + group->changeAnimationDirection = 1; //left else - gw->group->changeAnimationDirection = -1; //right + group->changeAnimationDirection = -1; //right //check if the opposite direction is shorter - if (abs(distanceNew - distanceOld) > (gw->group->tabBar->nSlots / 2)) - gw->group->changeAnimationDirection *= -1; + if (abs(distanceNew - distanceOld) > (group->tabBar->nSlots / 2)) + group->changeAnimationDirection *= -1; } - if(gw->group->changeState != PaintOff) - gw->group->nextTopTab = topTab; + if (group->changeState != PaintOff) + { + if (group->prevTopTab == topTab) + { + // Reverse animation. + GroupTabBarSlot *tmp = group->topTab; + group->topTab = group->prevTopTab; + group->prevTopTab = tmp; + + group->changeAnimationDirection *= -1; + group->changeAnimationTime = gs->opt[GROUP_SCREEN_OPTION_CHANGE_ANIMATION_TIME].value.f * 500 - group->changeAnimationTime; + group->changeState = (group->changeState == PaintFadeIn)? PaintFadeOut: PaintFadeIn; + + group->nextTopTab = NULL; + } + + else + group->nextTopTab = topTab; + } else { - gw->group->topTab = topTab; - gw->group->changeTab = TRUE; + group->topTab = topTab; + group->changeTab = TRUE; - groupRenderWindowTitle(gw->group); - groupRenderTopTabHighlight(gw->group); + groupRenderWindowTitle(group); + groupRenderTopTabHighlight(group); addWindowDamage(w); } |