Changeset View
Changeset View
Standalone View
Standalone View
effects/presentwindows/presentwindows.cpp
Context not available. | |||||
118 | void PresentWindowsEffect::reconfigure(ReconfigureFlags) | 118 | void PresentWindowsEffect::reconfigure(ReconfigureFlags) | ||
---|---|---|---|---|---|
119 | { | 119 | { | ||
120 | PresentWindowsConfig::self()->read(); | 120 | PresentWindowsConfig::self()->read(); | ||
121 | foreach (ElectricBorder border, m_borderActivate) { | 121 | for (ElectricBorder border : qAsConst(m_borderActivate)) { | ||
122 | effects->unreserveElectricBorder(border, this); | 122 | effects->unreserveElectricBorder(border, this); | ||
123 | } | 123 | } | ||
124 | foreach (ElectricBorder border, m_borderActivateAll) { | 124 | for (ElectricBorder border : qAsConst(m_borderActivateAll)) { | ||
125 | effects->unreserveElectricBorder(border, this); | 125 | effects->unreserveElectricBorder(border, this); | ||
126 | } | 126 | } | ||
127 | m_borderActivate.clear(); | 127 | m_borderActivate.clear(); | ||
Context not available. | |||||
236 | } | 236 | } | ||
237 | m_windowData.clear(); | 237 | m_windowData.clear(); | ||
238 | 238 | | |||
239 | foreach (EffectWindow * w, effects->stackingOrder()) { | 239 | const KWin::EffectWindowList stack = effects->stackingOrder(); | ||
240 | for (EffectWindow * w : stack) { | ||||
240 | if (w->isDock()) { | 241 | if (w->isDock()) { | ||
241 | w->setData(WindowForceBlurRole, QVariant(false)); | 242 | w->setData(WindowForceBlurRole, QVariant(false)); | ||
242 | w->setData(WindowForceBackgroundContrastRole, QVariant(false)); | 243 | w->setData(WindowForceBackgroundContrastRole, QVariant(false)); | ||
Context not available. | |||||
497 | } | 498 | } | ||
498 | rearrangeWindows(); | 499 | rearrangeWindows(); | ||
499 | 500 | | |||
500 | foreach (EffectWindow *w, m_motionManager.managedWindows()) { | 501 | const KWin::EffectWindowList managedWindows = m_motionManager.managedWindows(); | ||
502 | for (EffectWindow *w : managedWindows) { | ||||
501 | winData = m_windowData.find(w); | 503 | winData = m_windowData.find(w); | ||
502 | if (winData != m_windowData.end() && !winData->deleted) | 504 | if (winData != m_windowData.end() && !winData->deleted) | ||
503 | return; // found one that is not deleted? then we go on | 505 | return; // found one that is not deleted? then we go on | ||
Context not available. | |||||
913 | 915 | | |||
914 | if (m_windowFilter.isEmpty()) { | 916 | if (m_windowFilter.isEmpty()) { | ||
915 | windowlist = m_motionManager.managedWindows(); | 917 | windowlist = m_motionManager.managedWindows(); | ||
916 | foreach (EffectWindow * w, m_motionManager.managedWindows()) { | 918 | for (EffectWindow * w : qAsConst(windowlist)) { | ||
917 | DataHash::iterator winData = m_windowData.find(w); | 919 | DataHash::iterator winData = m_windowData.find(w); | ||
918 | if (winData == m_windowData.end() || winData->deleted) | 920 | if (winData == m_windowData.end() || winData->deleted) | ||
919 | continue; // don't include closed windows | 921 | continue; // don't include closed windows | ||
Context not available. | |||||
922 | } | 924 | } | ||
923 | } else { | 925 | } else { | ||
924 | // Can we move this filtering somewhere else? | 926 | // Can we move this filtering somewhere else? | ||
925 | foreach (EffectWindow * w, m_motionManager.managedWindows()) { | 927 | for (EffectWindow * w : qAsConst(windowlist)) { | ||
926 | DataHash::iterator winData = m_windowData.find(w); | 928 | DataHash::iterator winData = m_windowData.find(w); | ||
927 | if (winData == m_windowData.end() || winData->deleted) | 929 | if (winData == m_windowData.end() || winData->deleted) | ||
928 | continue; // don't include closed windows | 930 | continue; // don't include closed windows | ||
Context not available. | |||||
972 | 974 | | |||
973 | // Resize text frames if required | 975 | // Resize text frames if required | ||
974 | QFontMetrics* metrics = NULL; // All fonts are the same | 976 | QFontMetrics* metrics = NULL; // All fonts are the same | ||
975 | foreach (EffectWindow * w, m_motionManager.managedWindows()) { | 977 | for (EffectWindow * w : qAsConst(windowlist)) { | ||
976 | DataHash::iterator winData = m_windowData.find(w); | 978 | DataHash::iterator winData = m_windowData.find(w); | ||
977 | if (winData == m_windowData.end()) | 979 | if (winData == m_windowData.end()) | ||
978 | continue; | 980 | continue; | ||
Context not available. | |||||
1248 | // If windows do not overlap they scale into nothingness, fix by resetting. To reproduce | 1250 | // If windows do not overlap they scale into nothingness, fix by resetting. To reproduce | ||
1249 | // just have a single window on a Xinerama screen or have two windows that do not touch. | 1251 | // just have a single window on a Xinerama screen or have two windows that do not touch. | ||
1250 | // TODO: Work out why this happens, is most likely a bug in the manager. | 1252 | // TODO: Work out why this happens, is most likely a bug in the manager. | ||
1251 | foreach (EffectWindow * w, windowlist) | 1253 | for (EffectWindow * w : qAsConst(windowlist)) | ||
1252 | if (motionManager.transformedGeometry(w) == w->geometry()) | 1254 | if (motionManager.transformedGeometry(w) == w->geometry()) | ||
1253 | motionManager.reset(w); | 1255 | motionManager.reset(w); | ||
1254 | 1256 | | |||
Context not available. | |||||
1271 | int direction = 0; | 1273 | int direction = 0; | ||
1272 | QHash<EffectWindow*, QRect> targets; | 1274 | QHash<EffectWindow*, QRect> targets; | ||
1273 | QHash<EffectWindow*, int> directions; | 1275 | QHash<EffectWindow*, int> directions; | ||
1274 | foreach (EffectWindow * w, windowlist) { | 1276 | for (EffectWindow * w : qAsConst(windowlist)) { | ||
1275 | bounds = bounds.united(w->geometry()); | 1277 | bounds = bounds.united(w->geometry()); | ||
1276 | targets[w] = w->geometry(); | 1278 | targets[w] = w->geometry(); | ||
1277 | // Reuse the unused "slot" as a preferred direction attribute. This is used when the window | 1279 | // Reuse the unused "slot" as a preferred direction attribute. This is used when the window | ||
Context not available. | |||||
1287 | bool overlap; | 1289 | bool overlap; | ||
1288 | do { | 1290 | do { | ||
1289 | overlap = false; | 1291 | overlap = false; | ||
1290 | foreach (EffectWindow * w, windowlist) { | 1292 | for (EffectWindow * w : qAsConst(windowlist)) { | ||
1291 | QRect *target_w = &targets[w]; | 1293 | QRect *target_w = &targets[w]; | ||
1292 | foreach (EffectWindow * e, windowlist) { | 1294 | for (EffectWindow * e : qAsConst(windowlist)) { | ||
1293 | if (w == e) | 1295 | if (w == e) | ||
1294 | continue; | 1296 | continue; | ||
1295 | QRect *target_e = &targets[e]; | 1297 | QRect *target_e = &targets[e]; | ||
Context not available. | |||||
1389 | bool moved; | 1391 | bool moved; | ||
1390 | do { | 1392 | do { | ||
1391 | moved = false; | 1393 | moved = false; | ||
1392 | foreach (EffectWindow * w, windowlist) { | 1394 | for (EffectWindow * w : qAsConst(windowlist)) { | ||
1393 | QRect oldRect; | 1395 | QRect oldRect; | ||
1394 | QRect *target = &targets[w]; | 1396 | QRect *target = &targets[w]; | ||
1395 | // This may cause some slight distortion if the windows are enlarged a large amount | 1397 | // This may cause some slight distortion if the windows are enlarged a large amount | ||
Context not available. | |||||
1454 | // The expanding code above can actually enlarge windows over 1.0/2.0 scale, we don't like this | 1456 | // The expanding code above can actually enlarge windows over 1.0/2.0 scale, we don't like this | ||
1455 | // We can't add this to the loop above as it would cause a never-ending loop so we have to make | 1457 | // We can't add this to the loop above as it would cause a never-ending loop so we have to make | ||
1456 | // do with the less-than-optimal space usage with using this method. | 1458 | // do with the less-than-optimal space usage with using this method. | ||
1457 | foreach (EffectWindow * w, windowlist) { | 1459 | for (EffectWindow * w : qAsConst(windowlist)) { | ||
1458 | QRect *target = &targets[w]; | 1460 | QRect *target = &targets[w]; | ||
1459 | double scale = target->width() / double(w->width()); | 1461 | double scale = target->width() / double(w->width()); | ||
1460 | if (scale > 2.0 || (scale > 1.0 && (w->width() > 300 || w->height() > 300))) { | 1462 | if (scale > 2.0 || (scale > 1.0 && (w->width() > 300 || w->height() > 300))) { | ||
Context not available. | |||||
1469 | } | 1471 | } | ||
1470 | 1472 | | |||
1471 | // Notify the motion manager of the targets | 1473 | // Notify the motion manager of the targets | ||
1472 | foreach (EffectWindow * w, windowlist) | 1474 | for (EffectWindow * w : qAsConst(windowlist)) | ||
1473 | motionManager.moveWindow(w, targets.value(w)); | 1475 | motionManager.moveWindow(w, targets.value(w)); | ||
1474 | } | 1476 | } | ||
1475 | 1477 | | |||
Context not available. | |||||
1516 | } | 1518 | } | ||
1517 | 1519 | | |||
1518 | // Add every single window to m_windowData (Just calling [w] creates it) | 1520 | // Add every single window to m_windowData (Just calling [w] creates it) | ||
1519 | foreach (EffectWindow * w, effects->stackingOrder()) { | 1521 | const KWin::EffectWindowList stack = effects->stackingOrder(); | ||
1522 | for (EffectWindow * w : stack) { | ||||
1520 | DataHash::iterator winData; | 1523 | DataHash::iterator winData; | ||
1521 | if ((winData = m_windowData.find(w)) != m_windowData.end()) { | 1524 | if ((winData = m_windowData.find(w)) != m_windowData.end()) { | ||
1522 | winData->visible = isVisibleWindow(w); | 1525 | winData->visible = isVisibleWindow(w); | ||
Context not available. | |||||
1541 | winData->iconFrame->setIconSize(QSize(32, 32)); | 1544 | winData->iconFrame->setIconSize(QSize(32, 32)); | ||
1542 | } | 1545 | } | ||
1543 | // Filter out special windows such as panels and taskbars | 1546 | // Filter out special windows such as panels and taskbars | ||
1544 | foreach (EffectWindow * w, effects->stackingOrder()) { | 1547 | for (EffectWindow * w : stack) { | ||
1545 | if (isSelectableWindow(w)) { | 1548 | if (isSelectableWindow(w)) { | ||
1546 | m_motionManager.manage(w); | 1549 | m_motionManager.manage(w); | ||
1547 | } | 1550 | } | ||
Context not available. | |||||
1599 | m_closeView->hide(); | 1602 | m_closeView->hide(); | ||
1600 | 1603 | | |||
1601 | // Move all windows back to their original position | 1604 | // Move all windows back to their original position | ||
1602 | foreach (EffectWindow * w, m_motionManager.managedWindows()) | 1605 | const EffectWindowList windowlist = m_motionManager.managedWindows(); | ||
1606 | for (EffectWindow * w : windowlist) | ||||
1603 | m_motionManager.moveWindow(w, w->geometry()); | 1607 | m_motionManager.moveWindow(w, w->geometry()); | ||
1604 | if (m_filterFrame) { | 1608 | if (m_filterFrame) { | ||
1605 | m_filterFrame->free(); | 1609 | m_filterFrame->free(); | ||
Context not available. | |||||
1778 | QRectF wArea = m_motionManager.transformedGeometry(w); | 1782 | QRectF wArea = m_motionManager.transformedGeometry(w); | ||
1779 | detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); | 1783 | detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); | ||
1780 | next = NULL; | 1784 | next = NULL; | ||
1781 | foreach (EffectWindow * e, m_motionManager.managedWindows()) { | 1785 | const EffectWindowList windowlist = m_motionManager.managedWindows(); | ||
1786 | for (EffectWindow * e : windowlist) { | ||||
1782 | DataHash::const_iterator winData = m_windowData.find(e); | 1787 | DataHash::const_iterator winData = m_windowData.find(e); | ||
1783 | if (winData == m_windowData.end() || !winData->visible) | 1788 | if (winData == m_windowData.end() || !winData->visible) | ||
1784 | continue; | 1789 | continue; | ||
Context not available. | |||||
1808 | QRectF wArea = m_motionManager.transformedGeometry(w); | 1813 | QRectF wArea = m_motionManager.transformedGeometry(w); | ||
1809 | detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); | 1814 | detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); | ||
1810 | next = NULL; | 1815 | next = NULL; | ||
1811 | foreach (EffectWindow * e, m_motionManager.managedWindows()) { | 1816 | const EffectWindowList windowlist = m_motionManager.managedWindows(); | ||
1817 | for (EffectWindow * e : windowlist) { | ||||
1812 | DataHash::const_iterator winData = m_windowData.find(e); | 1818 | DataHash::const_iterator winData = m_windowData.find(e); | ||
1813 | if (winData == m_windowData.end() || !winData->visible) | 1819 | if (winData == m_windowData.end() || !winData->visible) | ||
1814 | continue; | 1820 | continue; | ||
Context not available. | |||||
1843 | QRectF wArea = m_motionManager.transformedGeometry(w); | 1849 | QRectF wArea = m_motionManager.transformedGeometry(w); | ||
1844 | detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); | 1850 | detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); | ||
1845 | next = NULL; | 1851 | next = NULL; | ||
1846 | foreach (EffectWindow * e, m_motionManager.managedWindows()) { | 1852 | const EffectWindowList windowlist = m_motionManager.managedWindows(); | ||
1853 | for (EffectWindow * e : windowlist) { | ||||
1847 | DataHash::const_iterator winData = m_windowData.find(e); | 1854 | DataHash::const_iterator winData = m_windowData.find(e); | ||
1848 | if (winData == m_windowData.end() || !winData->visible) | 1855 | if (winData == m_windowData.end() || !winData->visible) | ||
1849 | continue; | 1856 | continue; | ||
Context not available. | |||||
1873 | QRectF wArea = m_motionManager.transformedGeometry(w); | 1880 | QRectF wArea = m_motionManager.transformedGeometry(w); | ||
1874 | detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); | 1881 | detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); | ||
1875 | next = NULL; | 1882 | next = NULL; | ||
1876 | foreach (EffectWindow * e, m_motionManager.managedWindows()) { | 1883 | const EffectWindowList windowlist = m_motionManager.managedWindows(); | ||
1884 | for (EffectWindow * e : windowlist) { | ||||
1877 | DataHash::const_iterator winData = m_windowData.find(e); | 1885 | DataHash::const_iterator winData = m_windowData.find(e); | ||
1878 | if (winData == m_windowData.end() || !winData->visible) | 1886 | if (winData == m_windowData.end() || !winData->visible) | ||
1879 | continue; | 1887 | continue; | ||
Context not available. | |||||
1907 | { | 1915 | { | ||
1908 | EffectWindow *topLeft = NULL; | 1916 | EffectWindow *topLeft = NULL; | ||
1909 | QRectF topLeftGeometry; | 1917 | QRectF topLeftGeometry; | ||
1910 | foreach (EffectWindow * w, m_motionManager.managedWindows()) { | 1918 | const EffectWindowList windowlist = m_motionManager.managedWindows(); | ||
1919 | for (EffectWindow * w : windowlist) { | ||||
1911 | DataHash::const_iterator winData = m_windowData.find(w); | 1920 | DataHash::const_iterator winData = m_windowData.find(w); | ||
1912 | if (winData == m_windowData.end()) | 1921 | if (winData == m_windowData.end()) | ||
1913 | continue; | 1922 | continue; | ||
Context not available. |