diff --git a/group.c b/group.c index 6721266..349824b 100644 --- a/group.c +++ b/group.c @@ -1330,7 +1330,15 @@ void groupHandleEvent(CompDisplay * d, XEvent * event) GROUP_WINDOW(w); if (gw->group && gw->group->tabBar && IS_TOP_TAB(w, gw->group) && gw->group->inputPrevention) - groupUpdateInputPreventionWindow(gw->group); + { + XWindowChanges xwc; + + xwc.stack_mode = Above; + xwc.sibling = w->id; + + XConfigureWindow (w->screen->display->display, gw->group->inputPrevention, + CWSibling | CWStackMode, &xwc); + } } break; @@ -1490,14 +1498,12 @@ groupWindowMoveNotify(CompWindow * w, int dx, int dy, Bool immediate) GroupTabBarSlot *slot; GroupTabBar *bar = gw->group->tabBar; - if (groupGetSpringModelOnMove(w->screen)) - XOffsetRegion (bar->region, 0, dy); - else - XOffsetRegion (bar->region, dx, dy); - bar->rightSpringX += dx; bar->leftSpringX += dx; + groupMoveTabBarRegion (gw->group, + (groupGetSpringModelOnMove (w->screen)) ? 0 : dx, dy, TRUE); + for(slot = bar->slots; slot; slot = slot->next) { if (groupGetSpringModelOnMove(w->screen)) XOffsetRegion (slot->region, 0, dy); @@ -1506,8 +1512,6 @@ groupWindowMoveNotify(CompWindow * w, int dx, int dy, Bool immediate) slot->springX += dx; } - groupUpdateInputPreventionWindow(gw->group); - return; } diff --git a/group.h b/group.h index eb2e659..34612ea 100644 --- a/group.h +++ b/group.h @@ -507,7 +507,7 @@ void groupUnhookTabBarSlot(GroupTabBar *bar, GroupTabBarSlot *slot, Bool tempora void groupDeleteTabBarSlot(GroupTabBar *bar, GroupTabBarSlot *slot); void groupCreateSlot(GroupSelection *group, CompWindow *w); void groupApplyForces(CompScreen *s, GroupTabBar *bar, GroupTabBarSlot* draggedSlot); -void groupApplySpeeds(CompScreen* s, GroupTabBar* bar, int msSinceLastRepaint); +void groupApplySpeeds(CompScreen* s, GroupSelection *group, int msSinceLastRepaint); void groupInitTabBar(GroupSelection *group, CompWindow* topTab); void groupDeleteTabBar(GroupSelection *group); void groupStartTabbingAnimation(GroupSelection *group, Bool tab); @@ -517,11 +517,13 @@ Bool groupInitTab(CompDisplay * d, CompAction * action, CompActionState state, C Bool groupChangeTab(GroupTabBarSlot* topTab, ChangeTabAnimationDirection direction); Bool groupChangeTabLeft(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption); Bool groupChangeTabRight(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption); -void groupUpdateInputPreventionWindow(GroupSelection* group); void groupSwitchTopTabInput(GroupSelection *group, Bool enable); void groupCreateInputPreventionWindow(GroupSelection* group); void groupDestroyInputPreventionWindow(GroupSelection* group); Region groupGetClippingRegion(CompWindow *w); +void groupMoveTabBarRegion (GroupSelection *group, int dx, int dy, Bool syncIPW); +void groupResizeTabBarRegion (GroupSelection *group, XRectangle *box, Bool syncIPW); +void groupDamageTabBarRegion (GroupSelection *group); /* * paint.c diff --git a/paint.c b/paint.c index cb7cc85..7ca3bbb 100644 --- a/paint.c +++ b/paint.c @@ -104,8 +104,6 @@ void groupPaintThumb(GroupSelection *group, GroupTabBarSlot *slot, const CompTra PAINT_WINDOW_TRANSFORMED_MASK | PAINT_WINDOW_TRANSLUCENT_MASK); glPopMatrix(); - - addWindowDamage(w); } w->screen->addWindowGeometry = oldAddWindowGeometry; @@ -666,10 +664,8 @@ void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib, newWidth = layer->texWidth; w_scale = (double) (bar->region->extents.x2 - bar->region->extents.x1) / (double) newWidth; - if (newWidth != bar->oldWidth || bar->bgAnimation) groupRenderTabBarBackground(group); - bar->oldWidth = newWidth; box.extents = bar->region->extents; break; @@ -896,7 +892,7 @@ void groupPreparePaintScreen(CompScreen * s, int msSinceLastPaint) continue; groupApplyForces(s, bar, (gs->dragged)? gs->draggedSlot: NULL); - groupApplySpeeds(s, bar, msSinceLastPaint); + groupApplySpeeds(s, group, msSinceLastPaint); groupHandleHoverDetection(group); groupHandleTabBarFade(group, msSinceLastPaint); @@ -1038,8 +1034,23 @@ void groupDonePaintScreen(CompScreen * s) if (group->changeState != PaintOff) damageScreen(s); - if (group->tabBar && group->tabBar->state != PaintOff) - damageScreenRegion(s, group->tabBar->region); + if (group->tabBar) + { + if ((group->tabBar->state == PaintFadeIn) || + (group->tabBar->state == PaintFadeOut)) + { + groupDamageTabBarRegion (group); + } + + if (group->tabBar->textLayer) + { + if ((group->tabBar->textLayer->state == PaintFadeIn) || + (group->tabBar->textLayer->state == PaintFadeOut)) + { + groupDamageTabBarRegion (group); + } + } + } } } diff --git a/tab.c b/tab.c index fd87912..e1e5b95 100644 --- a/tab.c +++ b/tab.c @@ -249,7 +249,6 @@ groupShowDelayTimeout(void *data) groupRecalcTabBarPos(group, mouseX, WIN_REAL_X(topTab), WIN_REAL_X(topTab) + WIN_REAL_WIDTH(topTab)); - addWindowDamage(topTab); groupTabSetVisibility(group, TRUE, 0); @@ -346,6 +345,9 @@ void groupTabSetVisibility(GroupSelection *group, Bool visible, unsigned int mas bar->animationTime = (groupGetFadeTime(group->screen) * 1000) - bar->animationTime; + if (bar->state != oldState) + groupDamageTabBarRegion (group); + groupCheckForVisibleTabBars(group->screen); } @@ -1947,11 +1949,7 @@ void groupRecalcTabBarPos(GroupSelection *group, int middleX, int minX1, int max Bool isDraggedSlotGroup = FALSE; GROUP_SCREEN(group->screen); - /* first damage the old region to make sure it is updated */ - damageScreenRegion (group->screen, bar->region); - int space = groupGetThumbSpace(group->screen); - int old_width = bar->region->extents.x2 - bar->region->extents.x1; int bar_width; int currentSlot; XRectangle box; @@ -2003,8 +2001,7 @@ void groupRecalcTabBarPos(GroupSelection *group, int middleX, int minX1, int max box.width = bar_width; box.height = space * 2 + tabs_height; - EMPTY_REGION(bar->region); - XUnionRectWithRegion(&box, bar->region, bar->region); + groupResizeTabBarRegion (group, &box, TRUE); // recalc every slot region currentSlot = 0; @@ -2032,14 +2029,105 @@ void groupRecalcTabBarPos(GroupSelection *group, int middleX, int minX1, int max bar->rightMsSinceLastMove = 0; bar->leftMsSinceLastMove = 0; - - groupUpdateInputPreventionWindow(group); +} + +#define SIZE_AND_DAMAGE_REGION(s,reg) \ + reg.extents.x1 -= 5; \ + reg.extents.x2 += 5; \ + reg.extents.y1 -= 5; \ + reg.extents.y2 += 5; \ + damageScreenRegion (s, ®); + +void +groupDamageTabBarRegion (GroupSelection *group) +{ +#if 0 + REGION reg; - // size changed rebuild TabBar - if (box.width != old_width && bar->bgLayer) { - bar->bgLayer = groupRebuildCairoLayer(group->screen, bar->bgLayer, box.width + space + thumb_size, box.height); - bar->oldWidth = 0; // trigger repaint + reg.rects = ®.extents; + reg.numRects = 1; + + reg.extents = group->tabBar->region->extents; + SIZE_AND_DAMAGE_REGION (group->screen, reg) + + if (group->tabBar->slots) + { + reg.extents = group->tabBar->slots->region->extents; + SIZE_AND_DAMAGE_REGION (group->screen, reg) } + + if (group->tabBar->revSlots && + (group->tabBar->revSlots != group->tabBar->slots)) + { + reg.extents = group->tabBar->slots->region->extents; + SIZE_AND_DAMAGE_REGION (group->screen, reg) + } +#endif +#if 1 + if (HAS_TOP_WIN (group)) + addWindowDamage (TOP_TAB (group)); + else if (HAS_PREV_TOP_WIN (group)) + addWindowDamage (PREV_TOP_TAB (group)); +#endif +} + +#undef SIZE_AND_DAMAGE_REGION + +void +groupMoveTabBarRegion (GroupSelection *group, int dx, int dy, Bool syncIPW) +{ + groupDamageTabBarRegion (group); + + XOffsetRegion (group->tabBar->region, dx, dy); + + if (syncIPW) + XMoveWindow (group->screen->display->display, group->inputPrevention, + group->tabBar->leftSpringX, group->tabBar->region->extents.y1); + + groupDamageTabBarRegion (group); +} + +void +groupResizeTabBarRegion (GroupSelection *group, XRectangle *box, Bool syncIPW) +{ + int oldWidth; + + groupDamageTabBarRegion (group); + + oldWidth = group->tabBar->region->extents.x2 - group->tabBar->region->extents.x1; + + if (group->tabBar->bgLayer && + (oldWidth != box->width)) + { + group->tabBar->bgLayer = + groupRebuildCairoLayer (group->screen, + group->tabBar->bgLayer, + box->width + + groupGetThumbSpace (group->screen) + + groupGetThumbSize (group->screen), + box->height); + } + + EMPTY_REGION (group->tabBar->region); + XUnionRectWithRegion(box, group->tabBar->region, group->tabBar->region); + + if (syncIPW) + { + XWindowChanges xwc; + + xwc.x = box->x; + xwc.y = box->y; + xwc.width = box->width; + xwc.height = box->height; + + xwc.stack_mode = Above; + xwc.sibling = HAS_TOP_WIN(group) ? TOP_TAB(group)->id : None; + + XConfigureWindow (group->screen->display->display, group->inputPrevention, + CWSibling | CWStackMode | CWX | CWY | CWWidth | CWHeight, &xwc); + } + + groupDamageTabBarRegion (group); } /* @@ -2425,8 +2513,9 @@ void groupApplyForces(CompScreen *s, GroupTabBar *bar, GroupTabBarSlot* draggedS * groupApplySpeeds * */ -void groupApplySpeeds(CompScreen* s, GroupTabBar* bar, int msSinceLastRepaint) +void groupApplySpeeds(CompScreen* s, GroupSelection *group, int msSinceLastRepaint) { + GroupTabBar *bar = group->tabBar; GroupTabBarSlot* slot; int move; XRectangle box; @@ -2491,10 +2580,7 @@ void groupApplySpeeds(CompScreen* s, GroupTabBar* bar, int msSinceLastRepaint) bar->rightMsSinceLastMove = 0; if(updateTabBar) - { - EMPTY_REGION(bar->region); - XUnionRectWithRegion(&box, bar->region, bar->region); - } + groupResizeTabBarRegion (group, &box, FALSE); for(slot = bar->slots; slot; slot = slot->next) { @@ -2713,36 +2799,6 @@ groupSwitchTopTabInput(GroupSelection *group, Bool enable) } /* - * groupUpdateInputPreventionWindow - * - */ -void -groupUpdateInputPreventionWindow(GroupSelection *group) -{ - XWindowChanges xwc; - - if(!group->tabBar || !HAS_TOP_WIN(group)) - return; - - if (!group->inputPrevention) - groupCreateInputPreventionWindow(group); - - CompWindow *w = TOP_TAB(group); - - xwc.x = group->tabBar->leftSpringX; - xwc.y = group->tabBar->region->extents.y1; - xwc.width = group->tabBar->rightSpringX - group->tabBar->leftSpringX; - xwc.height = group->tabBar->region->extents.y2 - group->tabBar->region->extents.y1; - - xwc.stack_mode = Above; - - xwc.sibling = w->id; - - XConfigureWindow(group->screen->display->display, group->inputPrevention, - CWSibling | CWStackMode | CWX | CWY | CWWidth | CWHeight, &xwc); -} - -/* * groupCreateInputPreventionWindow * */