strip QHash::operator[] from flipswitch

BUG: 238334
This commit is contained in:
Thomas Lübking 2011-05-10 01:46:02 +02:00
parent 55bcd2ed10
commit b54806fe0f

View file

@ -296,11 +296,11 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
// fade in/out one window at the end of the stack during animation // fade in/out one window at the end of the stack during animation
if (m_animation && !m_scheduledDirections.isEmpty()) { if (m_animation && !m_scheduledDirections.isEmpty()) {
EffectWindow* w = m_flipOrderedWindows.last(); EffectWindow* w = m_flipOrderedWindows.last();
if (m_windows.contains(w)) { if (ItemInfo *info = m_windows.value(w,0)) {
WindowPaintData data(w); WindowPaintData data(w);
data.opacity = m_windows[ w ]->opacity; data.opacity = info->opacity;
data.brightness = m_windows[ w ]->brightness; data.brightness = info->brightness;
data.saturation = m_windows[ w ]->saturation; data.saturation = info->saturation;
int distance = tempList.count() - 1; int distance = tempList.count() - 1;
float zDistance = 500.0f; float zDistance = 500.0f;
data.xTranslate -= (w->x() - m_screenArea.x() + data.xTranslate) * m_startStopTimeLine.currentValue(); data.xTranslate -= (w->x() - m_screenArea.x() + data.xTranslate) * m_startStopTimeLine.currentValue();
@ -323,13 +323,14 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
} }
} }
foreach (EffectWindow * w, m_flipOrderedWindows) { foreach (EffectWindow *w, m_flipOrderedWindows) {
if (!m_windows.contains(w)) ItemInfo *info = m_windows.value(w,0);
if (!info)
continue; continue;
WindowPaintData data(w); WindowPaintData data(w);
data.opacity = m_windows[ w ]->opacity; data.opacity = info->opacity;
data.brightness = m_windows[ w ]->brightness; data.brightness = info->brightness;
data.saturation = m_windows[ w ]->saturation; data.saturation = info->saturation;
int windowIndex = tempList.indexOf(w); int windowIndex = tempList.indexOf(w);
int distance; int distance;
if (m_mode == TabboxMode) { if (m_mode == TabboxMode) {
@ -485,30 +486,23 @@ void FlipSwitchEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data,
void FlipSwitchEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) void FlipSwitchEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{ {
if (m_active) { if (m_active) {
if (w->isDesktop()) { ItemInfo *info = m_windows.value(w,0);
// desktop is painted in normal way if (info) {
if (m_windows.contains(w)) { info->opacity = data.opacity;
m_windows[ w ]->opacity = data.opacity; info->brightness = data.brightness;
m_windows[ w ]->brightness = data.brightness; info->saturation = data.saturation;
m_windows[ w ]->saturation = data.saturation;
}
effects->paintWindow(w, mask, region, data);
return;
} }
if ((m_start || m_stop) && !m_windows.contains(w)) {
// fade out all windows not in window list // fade out all windows not in window list except the desktops
const bool isFader = (m_start || m_stop) && !info && !w->isDesktop();
if (isFader)
data.opacity *= (1.0 - m_startStopTimeLine.currentValue()); data.opacity *= (1.0 - m_startStopTimeLine.currentValue());
effects->paintWindow(w, mask, region, data);
// if not a fader or the desktop, skip painting here to prevent flicker
if (!(isFader || w->isDesktop()))
return; return;
}
m_windows[ w ]->opacity = data.opacity;
m_windows[ w ]->brightness = data.brightness;
m_windows[ w ]->saturation = data.saturation;
// it's not nice but it removes flickering
return;
} else {
effects->paintWindow(w, mask, region, data);
} }
effects->paintWindow(w, mask, region, data);
} }
//************************************************************* //*************************************************************
@ -585,7 +579,7 @@ void FlipSwitchEffect::slotTabBoxUpdated()
void FlipSwitchEffect::slotWindowAdded(EffectWindow* w) void FlipSwitchEffect::slotWindowAdded(EffectWindow* w)
{ {
if (m_active && isSelectableWindow(w)) { if (m_active && isSelectableWindow(w)) {
m_windows[ w ] = new ItemInfo(); m_windows[ w ] = new ItemInfo;
} }
} }
@ -621,7 +615,7 @@ void FlipSwitchEffect::setActive(bool activate, FlipSwitchMode mode)
m_mode = mode; m_mode = mode;
foreach (EffectWindow * w, effects->stackingOrder()) { foreach (EffectWindow * w, effects->stackingOrder()) {
if (isSelectableWindow(w) && !m_windows.contains(w)) if (isSelectableWindow(w) && !m_windows.contains(w))
m_windows[ w ] = new ItemInfo(); m_windows[ w ] = new ItemInfo;
} }
if (m_windows.isEmpty()) if (m_windows.isEmpty())
return; return;