Changeset View
Changeset View
Standalone View
Standalone View
effects/slide/slide.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | |||||
88 | * | 88 | * | ||
89 | * Wrapping is done in such a way that magnitude of x and y component of vector | 89 | * Wrapping is done in such a way that magnitude of x and y component of vector | ||
90 | * @p diff is less than half of @p w and half of @p h, respectively. This will | 90 | * @p diff is less than half of @p w and half of @p h, respectively. This will | ||
91 | * result in having the "shortest" path between two points. | 91 | * result in having the "shortest" path between two points. | ||
92 | * | 92 | * | ||
93 | * @param diff Vector between two points | 93 | * @param diff Vector between two points | ||
94 | * @param w Width of the desktop grid | 94 | * @param w Width of the desktop grid | ||
95 | * @param h Height of the desktop grid | 95 | * @param h Height of the desktop grid | ||
96 | */ | 96 | **/ | ||
97 | inline void wrapDiff(QPoint &diff, int w, int h) | 97 | inline void wrapDiff(QPoint &diff, int w, int h) | ||
98 | { | 98 | { | ||
99 | if (diff.x() > w/2) { | 99 | if (diff.x() > w/2) { | ||
100 | diff.setX(diff.x() - w); | 100 | diff.setX(diff.x() - w); | ||
101 | } else if (diff.x() < -w/2) { | 101 | } else if (diff.x() < -w/2) { | ||
102 | diff.setX(diff.x() + w); | 102 | diff.setX(diff.x() + w); | ||
103 | } | 103 | } | ||
104 | 104 | | |||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | 188 | for (int desktop : qAsConst(visibleDesktops)) { | |||
195 | effects->paintScreen(mask, region, data); | 195 | effects->paintScreen(mask, region, data); | ||
196 | m_paintCtx.firstPass = false; | 196 | m_paintCtx.firstPass = false; | ||
197 | } | 197 | } | ||
198 | } | 198 | } | ||
199 | 199 | | |||
200 | /** | 200 | /** | ||
201 | * Decide whether given window @p w should be transformed/translated. | 201 | * Decide whether given window @p w should be transformed/translated. | ||
202 | * @returns @c true if given window @p w should be transformed, otherwise @c false | 202 | * @returns @c true if given window @p w should be transformed, otherwise @c false | ||
203 | */ | 203 | **/ | ||
204 | bool SlideEffect::isTranslated(const EffectWindow *w) const | 204 | bool SlideEffect::isTranslated(const EffectWindow *w) const | ||
205 | { | 205 | { | ||
206 | if (w->isOnAllDesktops()) { | 206 | if (w->isOnAllDesktops()) { | ||
207 | if (w->isDock()) { | 207 | if (w->isDock()) { | ||
208 | return m_slideDocks; | 208 | return m_slideDocks; | ||
209 | } | 209 | } | ||
210 | if (w->isDesktop()) { | 210 | if (w->isDesktop()) { | ||
211 | return m_slideBackground; | 211 | return m_slideBackground; | ||
212 | } | 212 | } | ||
213 | return false; | 213 | return false; | ||
214 | } else if (w == m_movingWindow) { | 214 | } else if (w == m_movingWindow) { | ||
215 | return false; | 215 | return false; | ||
216 | } else if (w->isOnDesktop(m_paintCtx.desktop)) { | 216 | } else if (w->isOnDesktop(m_paintCtx.desktop)) { | ||
217 | return true; | 217 | return true; | ||
218 | } | 218 | } | ||
219 | return false; | 219 | return false; | ||
220 | } | 220 | } | ||
221 | 221 | | |||
222 | /** | 222 | /** | ||
223 | * Decide whether given window @p w should be painted. | 223 | * Decide whether given window @p w should be painted. | ||
224 | * @returns @c true if given window @p w should be painted, otherwise @c false | 224 | * @returns @c true if given window @p w should be painted, otherwise @c false | ||
225 | */ | 225 | **/ | ||
226 | bool SlideEffect::isPainted(const EffectWindow *w) const | 226 | bool SlideEffect::isPainted(const EffectWindow *w) const | ||
227 | { | 227 | { | ||
228 | if (w->isOnAllDesktops()) { | 228 | if (w->isOnAllDesktops()) { | ||
229 | if (w->isDock()) { | 229 | if (w->isDock()) { | ||
230 | if (!m_slideDocks) { | 230 | if (!m_slideDocks) { | ||
231 | return m_paintCtx.lastPass; | 231 | return m_paintCtx.lastPass; | ||
232 | } | 232 | } | ||
233 | for (const EffectWindow *fw : qAsConst(m_paintCtx.fullscreenWindows)) { | 233 | for (const EffectWindow *fw : qAsConst(m_paintCtx.fullscreenWindows)) { | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 286 | { | |||
290 | 290 | | |||
291 | effects->addRepaintFull(); | 291 | effects->addRepaintFull(); | ||
292 | effects->postPaintScreen(); | 292 | effects->postPaintScreen(); | ||
293 | } | 293 | } | ||
294 | 294 | | |||
295 | /** | 295 | /** | ||
296 | * Get position of the top-left corner of desktop @p id within desktop grid with gaps. | 296 | * Get position of the top-left corner of desktop @p id within desktop grid with gaps. | ||
297 | * @param id ID of a virtual desktop | 297 | * @param id ID of a virtual desktop | ||
298 | */ | 298 | **/ | ||
299 | QPoint SlideEffect::desktopCoords(int id) const | 299 | QPoint SlideEffect::desktopCoords(int id) const | ||
300 | { | 300 | { | ||
301 | QPoint c = effects->desktopCoords(id); | 301 | QPoint c = effects->desktopCoords(id); | ||
302 | const QPoint gridPos = effects->desktopGridCoords(id); | 302 | const QPoint gridPos = effects->desktopGridCoords(id); | ||
303 | c.setX(c.x() + m_hGap * gridPos.x()); | 303 | c.setX(c.x() + m_hGap * gridPos.x()); | ||
304 | c.setY(c.y() + m_vGap * gridPos.y()); | 304 | c.setY(c.y() + m_vGap * gridPos.y()); | ||
305 | return c; | 305 | return c; | ||
306 | } | 306 | } | ||
307 | 307 | | |||
308 | /** | 308 | /** | ||
309 | * Get geometry of desktop @p id within desktop grid with gaps. | 309 | * Get geometry of desktop @p id within desktop grid with gaps. | ||
310 | * @param id ID of a virtual desktop | 310 | * @param id ID of a virtual desktop | ||
311 | */ | 311 | **/ | ||
312 | QRect SlideEffect::desktopGeometry(int id) const | 312 | QRect SlideEffect::desktopGeometry(int id) const | ||
313 | { | 313 | { | ||
314 | QRect g = effects->virtualScreenGeometry(); | 314 | QRect g = effects->virtualScreenGeometry(); | ||
315 | g.translate(desktopCoords(id)); | 315 | g.translate(desktopCoords(id)); | ||
316 | return g; | 316 | return g; | ||
317 | } | 317 | } | ||
318 | 318 | | |||
319 | /** | 319 | /** | ||
320 | * Get width of a virtual desktop grid. | 320 | * Get width of a virtual desktop grid. | ||
321 | */ | 321 | **/ | ||
322 | int SlideEffect::workspaceWidth() const | 322 | int SlideEffect::workspaceWidth() const | ||
323 | { | 323 | { | ||
324 | int w = effects->workspaceWidth(); | 324 | int w = effects->workspaceWidth(); | ||
325 | w += m_hGap * effects->desktopGridWidth(); | 325 | w += m_hGap * effects->desktopGridWidth(); | ||
326 | return w; | 326 | return w; | ||
327 | } | 327 | } | ||
328 | 328 | | |||
329 | /** | 329 | /** | ||
330 | * Get height of a virtual desktop grid. | 330 | * Get height of a virtual desktop grid. | ||
331 | */ | 331 | **/ | ||
332 | int SlideEffect::workspaceHeight() const | 332 | int SlideEffect::workspaceHeight() const | ||
333 | { | 333 | { | ||
334 | int h = effects->workspaceHeight(); | 334 | int h = effects->workspaceHeight(); | ||
335 | h += m_vGap * effects->desktopGridHeight(); | 335 | h += m_vGap * effects->desktopGridHeight(); | ||
336 | return h; | 336 | return h; | ||
337 | } | 337 | } | ||
338 | 338 | | |||
339 | bool SlideEffect::shouldElevate(const EffectWindow *w) const | 339 | bool SlideEffect::shouldElevate(const EffectWindow *w) const | ||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |