Changeset View
Changeset View
Standalone View
Standalone View
effects/slide/slide.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 64 | { | |||
---|---|---|---|---|---|
66 | 66 | | |||
67 | const int d = animationTime( | 67 | const int d = animationTime( | ||
68 | SlideConfig::duration() > 0 ? SlideConfig::duration() : 500); | 68 | SlideConfig::duration() > 0 ? SlideConfig::duration() : 500); | ||
69 | m_timeline.setDuration(d); | 69 | m_timeline.setDuration(d); | ||
70 | 70 | | |||
71 | m_hGap = SlideConfig::horizontalGap(); | 71 | m_hGap = SlideConfig::horizontalGap(); | ||
72 | m_vGap = SlideConfig::verticalGap(); | 72 | m_vGap = SlideConfig::verticalGap(); | ||
73 | m_slideDocks = SlideConfig::slideDocks(); | 73 | m_slideDocks = SlideConfig::slideDocks(); | ||
74 | m_slideBackground = SlideConfig::slideBackground(); | ||||
74 | } | 75 | } | ||
75 | 76 | | |||
76 | void SlideEffect::prePaintScreen(ScreenPrePaintData& data, int time) | 77 | void SlideEffect::prePaintScreen(ScreenPrePaintData& data, int time) | ||
77 | { | 78 | { | ||
78 | if (m_active) { | 79 | if (m_active) { | ||
79 | m_timeline.setCurrentTime(m_timeline.currentTime() + time); | 80 | m_timeline.setCurrentTime(m_timeline.currentTime() + time); | ||
80 | data.mask |= PAINT_SCREEN_TRANSFORMED | 81 | data.mask |= PAINT_SCREEN_TRANSFORMED | ||
81 | | PAINT_SCREEN_BACKGROUND_FIRST; | 82 | | PAINT_SCREEN_BACKGROUND_FIRST; | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 134 | { | |||
184 | // of the screen geometry is clipped. | 185 | // of the screen geometry is clipped. | ||
185 | PaintClipper pc(QRegion(effects->virtualScreenGeometry())); | 186 | PaintClipper pc(QRegion(effects->virtualScreenGeometry())); | ||
186 | 187 | | |||
187 | // Screen is painted in several passes. Each painting pass paints | 188 | // Screen is painted in several passes. Each painting pass paints | ||
188 | // a single virtual desktop. There could be either 2 or 4 painting | 189 | // a single virtual desktop. There could be either 2 or 4 painting | ||
189 | // passes, depending how an user moves between virtual desktops. | 190 | // passes, depending how an user moves between virtual desktops. | ||
190 | // Windows, such as docks or keep-above windows, are painted in | 191 | // Windows, such as docks or keep-above windows, are painted in | ||
191 | // the last pass so they are above other windows. | 192 | // the last pass so they are above other windows. | ||
193 | m_paintCtx.firstPass = true; | ||||
192 | const int lastDesktop = visibleDesktops.last(); | 194 | const int lastDesktop = visibleDesktops.last(); | ||
193 | for (int desktop : qAsConst(visibleDesktops)) { | 195 | for (int desktop : qAsConst(visibleDesktops)) { | ||
194 | m_paintCtx.desktop = desktop; | 196 | m_paintCtx.desktop = desktop; | ||
195 | m_paintCtx.lastPass = (lastDesktop == desktop); | 197 | m_paintCtx.lastPass = (lastDesktop == desktop); | ||
196 | m_paintCtx.translation = desktopCoords(desktop) - currentPos; | 198 | m_paintCtx.translation = desktopCoords(desktop) - currentPos; | ||
197 | if (wrap) { | 199 | if (wrap) { | ||
198 | wrapDiff(m_paintCtx.translation, w, h); | 200 | wrapDiff(m_paintCtx.translation, w, h); | ||
199 | } | 201 | } | ||
200 | effects->paintScreen(mask, region, data); | 202 | effects->paintScreen(mask, region, data); | ||
203 | m_paintCtx.firstPass = false; | ||||
201 | } | 204 | } | ||
202 | } | 205 | } | ||
203 | 206 | | |||
204 | /** | 207 | /** | ||
205 | * Decide whether given window @p w should be transformed/translated. | 208 | * Decide whether given window @p w should be transformed/translated. | ||
206 | * @returns @c true if given window @p w should be transformed, otherwise @c false | 209 | * @returns @c true if given window @p w should be transformed, otherwise @c false | ||
207 | */ | 210 | */ | ||
208 | bool SlideEffect::isTranslated(const EffectWindow* w) const | 211 | bool SlideEffect::isTranslated(const EffectWindow* w) const | ||
209 | { | 212 | { | ||
210 | if (w->isOnAllDesktops()) { | 213 | if (w->isOnAllDesktops()) { | ||
211 | if (w->isDock()) { | 214 | if (w->isDock()) { | ||
212 | return m_slideDocks; | 215 | return m_slideDocks; | ||
213 | } | 216 | } | ||
214 | return w->isDesktop(); | 217 | if (w->isDesktop()) { | ||
218 | return m_slideBackground; | ||||
219 | } | ||||
220 | return false; | ||||
215 | } else if (w == m_movingWindow) { | 221 | } else if (w == m_movingWindow) { | ||
216 | return false; | 222 | return false; | ||
217 | } else if (w->isOnDesktop(m_paintCtx.desktop)) { | 223 | } else if (w->isOnDesktop(m_paintCtx.desktop)) { | ||
218 | return true; | 224 | return true; | ||
219 | } | 225 | } | ||
220 | return false; | 226 | return false; | ||
221 | } | 227 | } | ||
222 | 228 | | |||
Show All 11 Lines | 236 | if (w->isDock()) { | |||
234 | for (const EffectWindow* fw : qAsConst(m_paintCtx.fullscreenWindows)) { | 240 | for (const EffectWindow* fw : qAsConst(m_paintCtx.fullscreenWindows)) { | ||
235 | if (fw->isOnDesktop(m_paintCtx.desktop) | 241 | if (fw->isOnDesktop(m_paintCtx.desktop) | ||
236 | && fw->screen() == w->screen()) { | 242 | && fw->screen() == w->screen()) { | ||
237 | return false; | 243 | return false; | ||
238 | } | 244 | } | ||
239 | } | 245 | } | ||
240 | return true; | 246 | return true; | ||
241 | } | 247 | } | ||
248 | if (w->isDesktop()) { | ||||
249 | // Draw desktop background only in the first pass if we're | ||||
250 | // not sliding it. | ||||
251 | return m_slideBackground ? true : m_paintCtx.firstPass; | ||||
romangg: `return m_slideBackground || m_paintCtx.fristPass;`
The comment above it can be understood in… | |||||
252 | } | ||||
242 | // In order to make sure that 'keep above' windows are above | 253 | // In order to make sure that 'keep above' windows are above | ||
243 | // other windows during transition to another virtual desktop, | 254 | // other windows during transition to another virtual desktop, | ||
244 | // they should be painted in the last pass. | 255 | // they should be painted in the last pass. | ||
245 | if (w->keepAbove()) { | 256 | if (w->keepAbove()) { | ||
246 | return m_paintCtx.lastPass; | 257 | return m_paintCtx.lastPass; | ||
247 | } | 258 | } | ||
248 | return true; | 259 | return true; | ||
249 | } else if (w == m_movingWindow) { | 260 | } else if (w == m_movingWindow) { | ||
▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines |
return m_slideBackground || m_paintCtx.fristPass;
The comment above it can be understood in two different ways. Maybe make it more precise.