Changeset View
Changeset View
Standalone View
Standalone View
effects/slide/slide.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 99 | { | |||
---|---|---|---|---|---|
105 | 105 | | |||
106 | if (diff.y() > h/2) { | 106 | if (diff.y() > h/2) { | ||
107 | diff.setY(diff.y() - h); | 107 | diff.setY(diff.y() - h); | ||
108 | } else if (diff.y() < -h/2) { | 108 | } else if (diff.y() < -h/2) { | ||
109 | diff.setY(diff.y() + h); | 109 | diff.setY(diff.y() + h); | ||
110 | } | 110 | } | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | inline QRegion buildClipRegion(QPoint pos, int w, int h) | 113 | inline QRegion buildClipRegion(const QPoint& pos, int w, int h) | ||
114 | { | 114 | { | ||
115 | const QSize screenSize = effects->virtualScreenSize(); | 115 | const QSize screenSize = effects->virtualScreenSize(); | ||
116 | QRegion r = QRect(pos, screenSize); | 116 | QRegion r = QRect(pos, screenSize); | ||
117 | if (effects->optionRollOverDesktops()) { | 117 | if (effects->optionRollOverDesktops()) { | ||
118 | r |= (r & QRect(-w, 0, w, h)).translated(w, 0); // W | 118 | r |= (r & QRect(-w, 0, w, h)).translated(w, 0); // W | ||
119 | r |= (r & QRect(w, 0, w, h)).translated(-w, 0); // E | 119 | r |= (r & QRect(w, 0, w, h)).translated(-w, 0); // E | ||
120 | 120 | | |||
121 | r |= (r & QRect(0, -h, w, h)).translated(0, h); // N | 121 | r |= (r & QRect(0, -h, w, h)).translated(0, h); // N | ||
Show All 25 Lines | 133 | { | |||
147 | // so we map currentPos back to the rect. | 147 | // so we map currentPos back to the rect. | ||
148 | if (wrap) { | 148 | if (wrap) { | ||
149 | currentPos.setX(currentPos.x() % w); | 149 | currentPos.setX(currentPos.x() % w); | ||
150 | currentPos.setY(currentPos.y() % h); | 150 | currentPos.setY(currentPos.y() % h); | ||
151 | } | 151 | } | ||
152 | 152 | | |||
153 | QVector<int> visibleDesktops; | 153 | QVector<int> visibleDesktops; | ||
154 | visibleDesktops.reserve(4); // 4 - maximum number of visible desktops | 154 | visibleDesktops.reserve(4); // 4 - maximum number of visible desktops | ||
155 | QRegion clipRegion = buildClipRegion(currentPos, w, h); | 155 | const QRegion clipRegion = buildClipRegion(currentPos, w, h); | ||
156 | for (int i = 1; i <= effects->numberOfDesktops(); i++) { | 156 | for (int i = 1; i <= effects->numberOfDesktops(); i++) { | ||
157 | QRect desktopGeo = desktopGeometry(i); | 157 | const QRect desktopGeo = desktopGeometry(i); | ||
158 | if (! clipRegion.contains(desktopGeo)) { | 158 | if (! clipRegion.contains(desktopGeo)) { | ||
159 | continue; | 159 | continue; | ||
160 | } | 160 | } | ||
161 | visibleDesktops << i; | 161 | visibleDesktops << i; | ||
162 | } | 162 | } | ||
163 | 163 | | |||
164 | // When we enter a virtual desktop that has a window in fullscreen mode, | 164 | // When we enter a virtual desktop that has a window in fullscreen mode, | ||
165 | // stacking order is fine. When we leave a virtual desktop that has | 165 | // stacking order is fine. When we leave a virtual desktop that has | ||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | |||||
291 | 291 | | |||
292 | /** | 292 | /** | ||
293 | * Get position of the top-left corner of desktop @p id within desktop grid with gaps. | 293 | * Get position of the top-left corner of desktop @p id within desktop grid with gaps. | ||
294 | * @param id ID of a virtual desktop | 294 | * @param id ID of a virtual desktop | ||
295 | */ | 295 | */ | ||
296 | QPoint SlideEffect::desktopCoords(int id) const | 296 | QPoint SlideEffect::desktopCoords(int id) const | ||
297 | { | 297 | { | ||
298 | QPoint c = effects->desktopCoords(id); | 298 | QPoint c = effects->desktopCoords(id); | ||
299 | QPoint gridPos = effects->desktopGridCoords(id); | 299 | const QPoint gridPos = effects->desktopGridCoords(id); | ||
300 | c.setX(c.x() + m_hGap * gridPos.x()); | 300 | c.setX(c.x() + m_hGap * gridPos.x()); | ||
301 | c.setY(c.y() + m_vGap * gridPos.y()); | 301 | c.setY(c.y() + m_vGap * gridPos.y()); | ||
302 | return c; | 302 | return c; | ||
303 | } | 303 | } | ||
304 | 304 | | |||
305 | /** | 305 | /** | ||
306 | * Get geometry of desktop @p id within desktop grid with gaps. | 306 | * Get geometry of desktop @p id within desktop grid with gaps. | ||
307 | * @param id ID of a virtual desktop | 307 | * @param id ID of a virtual desktop | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 337 | { | |||
351 | if (w->decorationHasAlpha() && effects->decorationSupportsBlurBehind()) { | 351 | if (w->decorationHasAlpha() && effects->decorationSupportsBlurBehind()) { | ||
352 | return true; | 352 | return true; | ||
353 | } | 353 | } | ||
354 | 354 | | |||
355 | // FIXME: it should be something like this: | 355 | // FIXME: it should be something like this: | ||
356 | // if (surf) { | 356 | // if (surf) { | ||
357 | // return !surf->blur().isNull(); | 357 | // return !surf->blur().isNull(); | ||
358 | // } | 358 | // } | ||
359 | KWayland::Server::SurfaceInterface* surf = w->surface(); | 359 | const KWayland::Server::SurfaceInterface* surf = w->surface(); | ||
360 | if (surf && surf->blur()) { | 360 | if (surf && surf->blur()) { | ||
361 | return true; | 361 | return true; | ||
362 | } | 362 | } | ||
363 | 363 | | |||
364 | // TODO: make it X11-specific(check _KDE_NET_WM_BLUR_BEHIND_REGION) | 364 | // TODO: make it X11-specific(check _KDE_NET_WM_BLUR_BEHIND_REGION) | ||
365 | // or delete it in the future | 365 | // or delete it in the future | ||
366 | return w->hasAlpha(); | 366 | return w->hasAlpha(); | ||
367 | } | 367 | } | ||
Show All 12 Lines | 370 | { | |||
380 | if (w->data(WindowBackgroundContrastRole).isValid()) { | 380 | if (w->data(WindowBackgroundContrastRole).isValid()) { | ||
381 | return true; | 381 | return true; | ||
382 | } | 382 | } | ||
383 | 383 | | |||
384 | // FIXME: it should be something like this: | 384 | // FIXME: it should be something like this: | ||
385 | // if (surf) { | 385 | // if (surf) { | ||
386 | // return !surf->contrast().isNull(); | 386 | // return !surf->contrast().isNull(); | ||
387 | // } | 387 | // } | ||
388 | KWayland::Server::SurfaceInterface* surf = w->surface(); | 388 | const KWayland::Server::SurfaceInterface* surf = w->surface(); | ||
389 | if (surf && surf->contrast()) { | 389 | if (surf && surf->contrast()) { | ||
390 | return true; | 390 | return true; | ||
391 | } | 391 | } | ||
392 | 392 | | |||
393 | // TODO: make it X11-specific(check _KDE_NET_WM_BACKGROUND_CONTRAST_REGION) | 393 | // TODO: make it X11-specific(check _KDE_NET_WM_BACKGROUND_CONTRAST_REGION) | ||
394 | // or delete it in the future | 394 | // or delete it in the future | ||
395 | return w->hasAlpha() | 395 | return w->hasAlpha() | ||
396 | && w->isOnAllDesktops() | 396 | && w->isOnAllDesktops() | ||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |