diff --git a/autotests/integration/effects/desktop_switching_animation_test.cpp b/autotests/integration/effects/desktop_switching_animation_test.cpp index 9d00a3309d..f8ceaf5fff 100644 --- a/autotests/integration/effects/desktop_switching_animation_test.cpp +++ b/autotests/integration/effects/desktop_switching_animation_test.cpp @@ -92,7 +92,6 @@ void DesktopSwitchingAnimationTest::testSwitchDesktops_data() { QTest::addColumn("effectName"); - QTest::newRow("Desktop Cube Animation") << QStringLiteral("cubeslide"); QTest::newRow("Fade Desktop") << QStringLiteral("kwin4_effect_fadedesktop"); QTest::newRow("Slide") << QStringLiteral("slide"); } diff --git a/autotests/test_builtin_effectloader.cpp b/autotests/test_builtin_effectloader.cpp index 01503011a3..64a94644a3 100644 --- a/autotests/test_builtin_effectloader.cpp +++ b/autotests/test_builtin_effectloader.cpp @@ -73,7 +73,6 @@ void TestBuiltInEffectLoader::testHasEffect_data() QTest::newRow("case sensitive") << QStringLiteral("BlUR") << true; QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << true; QTest::newRow("Contrast") << QStringLiteral("contrast") << true; - QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << true; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true; QTest::newRow("FallApart") << QStringLiteral("fallapart") << true; @@ -124,7 +123,6 @@ void TestBuiltInEffectLoader::testKnownEffects() expectedEffects << QStringLiteral("blur") << QStringLiteral("colorpicker") << QStringLiteral("contrast") - << QStringLiteral("cubeslide") << QStringLiteral("desktopgrid") << QStringLiteral("diminactive") << QStringLiteral("fallapart") @@ -183,9 +181,6 @@ void TestBuiltInEffectLoader::testSupported_data() QTest::newRow("Contrast") << QStringLiteral("contrast") << false << xc << true; // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL QTest::newRow("Contrast-GL") << QStringLiteral("contrast") << false << oc << true; - QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << false << xc << true; - QTest::newRow("CubeSlide-GL") << QStringLiteral("cubeslide") << true << oc << true; - QTest::newRow("CubeSlide-GL-no-anim") << QStringLiteral("cubeslide") << false << oc << false; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << xc << true; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << xc << true; QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << xc << true; @@ -264,8 +259,6 @@ void TestBuiltInEffectLoader::testLoadEffect_data() QTest::newRow("Contrast") << QStringLiteral("contrast") << false << xc; // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL QTest::newRow("Contrast-GL") << QStringLiteral("contrast") << false << oc; - QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << false << xc; - QTest::newRow("CubeSlide-GL") << QStringLiteral("cubeslide") << true << oc; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << xc; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << xc; QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << xc; diff --git a/autotests/test_plugin_effectloader.cpp b/autotests/test_plugin_effectloader.cpp index 9c39a821dc..2b1093739a 100644 --- a/autotests/test_plugin_effectloader.cpp +++ b/autotests/test_plugin_effectloader.cpp @@ -64,7 +64,6 @@ void TestPluginEffectLoader::testHasEffect_data() QTest::newRow("blur") << QStringLiteral("blur") << false; QTest::newRow("ColorPicker") << QStringLiteral("colorpicker") << false; QTest::newRow("Contrast") << QStringLiteral("contrast") << false; - QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << false; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << false; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << false; QTest::newRow("FallApart") << QStringLiteral("fallapart") << false; diff --git a/autotests/test_scripted_effectloader.cpp b/autotests/test_scripted_effectloader.cpp index f7497b1f64..24bbd16ec4 100644 --- a/autotests/test_scripted_effectloader.cpp +++ b/autotests/test_scripted_effectloader.cpp @@ -85,7 +85,6 @@ void TestScriptedEffectLoader::testHasEffect_data() QTest::newRow("blur") << QStringLiteral("blur") << false; QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << false; QTest::newRow("Contrast") << QStringLiteral("contrast") << false; - QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << false; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << false; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << false; QTest::newRow("FallApart") << QStringLiteral("fallapart") << false; diff --git a/kconf_update/kwin-5.23-remove-cubeslide.py b/kconf_update/kwin-5.23-remove-cubeslide.py new file mode 100644 index 0000000000..f3756e396a --- /dev/null +++ b/kconf_update/kwin-5.23-remove-cubeslide.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import fileinput + +for line in fileinput.input(): + if not line.startswith("cubeslideEnabled="): + continue + value = line[len("cubeslideEnabled="):].strip() + if value == "true": + print("# DELETE cubeslideEnabled") + print("# DELETE slideEnabled") # make slide effect enabled, it's off now diff --git a/kconf_update/kwin.upd b/kconf_update/kwin.upd index 5b0abefa61..54bb9e82b4 100644 --- a/kconf_update/kwin.upd +++ b/kconf_update/kwin.upd @@ -67,3 +67,9 @@ Id=remove-cover-switch-effect File=kwinrc Group=TabBox,TabBoxAlternative Script=kwin-5.23-remove-cover-switch.py,python3 + +# Remove the Desktop Cube Animation effect +Id=remove-cubeslide-effect +File=kwinrc +Group=Plugins +Script=kwin-5.23-remove-cubeslide.py,python3 diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt index 716ea500b8..72f6a05c66 100644 --- a/src/effects/CMakeLists.txt +++ b/src/effects/CMakeLists.txt @@ -83,7 +83,6 @@ set(kwin4_effect_builtins_sources blur/blur.cpp blur/blurshader.cpp colorpicker/colorpicker.cpp - cubeslide/cubeslide.cpp desktopgrid/desktopgrid.cpp diminactive/diminactive.cpp effect_builtins.cpp @@ -121,7 +120,6 @@ qt5_add_resources(kwin4_effect_builtins_sources shaders.qrc) kconfig_add_kcfg_files(kwin4_effect_builtins_sources blur/blurconfig.kcfgc - cubeslide/cubeslideconfig.kcfgc desktopgrid/desktopgridconfig.kcfgc diminactive/diminactiveconfig.kcfgc fallapart/fallapartconfig.kcfgc @@ -193,7 +191,6 @@ add_subdirectory(zoom) # OpenGL-specific effects add_subdirectory(blur) include(backgroundcontrast/CMakeLists.txt) -add_subdirectory(cubeslide) add_subdirectory(glide) add_subdirectory(invert) add_subdirectory(lookingglass) diff --git a/src/effects/cubeslide/CMakeLists.txt b/src/effects/cubeslide/CMakeLists.txt deleted file mode 100644 index 7275b8c669..0000000000 --- a/src/effects/cubeslide/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -####################################### -# Config - -set(kwin_cubeslide_config_SRCS cubeslide_config.cpp) -ki18n_wrap_ui(kwin_cubeslide_config_SRCS cubeslide_config.ui) -kconfig_add_kcfg_files(kwin_cubeslide_config_SRCS cubeslideconfig.kcfgc) - -add_library(kwin_cubeslide_config MODULE ${kwin_cubeslide_config_SRCS}) - -target_link_libraries(kwin_cubeslide_config - KF5::ConfigWidgets - KF5::I18n - kwineffects - KWinEffectsInterface -) - -kcoreaddons_desktop_to_json(kwin_cubeslide_config cubeslide_config.desktop SERVICE_TYPES kcmodule.desktop) - -install( - TARGETS - kwin_cubeslide_config - DESTINATION - ${KDE_INSTALL_PLUGINDIR}/kwin/effects/configs -) diff --git a/src/effects/cubeslide/cubeslide.cpp b/src/effects/cubeslide/cubeslide.cpp deleted file mode 100644 index cbea00454a..0000000000 --- a/src/effects/cubeslide/cubeslide.cpp +++ /dev/null @@ -1,669 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2009 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "cubeslide.h" -// KConfigSkeleton -#include "cubeslideconfig.h" - -#include - -#include - -#include - -namespace KWin -{ - -CubeSlideEffect::CubeSlideEffect() - : stickyPainting(false) - , lastPresentTime(std::chrono::milliseconds::zero()) - , windowMoving(false) - , desktopChangedWhileMoving(false) - , progressRestriction(0.0f) -{ - initConfig(); - connect(effects, &EffectsHandler::windowAdded, - this, &CubeSlideEffect::slotWindowAdded); - connect(effects, &EffectsHandler::windowDeleted, - this, &CubeSlideEffect::slotWindowDeleted); - connect(effects, QOverload::of(&EffectsHandler::desktopChanged), - this, &CubeSlideEffect::slotDesktopChanged); - connect(effects, &EffectsHandler::windowStepUserMovedResized, - this, &CubeSlideEffect::slotWindowStepUserMovedResized); - connect(effects, &EffectsHandler::windowFinishUserMovedResized, - this, &CubeSlideEffect::slotWindowFinishUserMovedResized); - connect(effects, &EffectsHandler::numberDesktopsChanged, - this, &CubeSlideEffect::slotNumberDesktopsChanged); - reconfigure(ReconfigureAll); -} - -CubeSlideEffect::~CubeSlideEffect() -{ -} - -bool CubeSlideEffect::supported() -{ - return effects->isOpenGLCompositing() && effects->animationsSupported(); -} - -void CubeSlideEffect::reconfigure(ReconfigureFlags) -{ - CubeSlideConfig::self()->read(); - // TODO: rename rotationDuration to duration - rotationDuration = animationTime(CubeSlideConfig::rotationDuration() != 0 ? CubeSlideConfig::rotationDuration() : 500); - timeLine.setEasingCurve(QEasingCurve::InOutSine); - timeLine.setDuration(rotationDuration); - dontSlidePanels = CubeSlideConfig::dontSlidePanels(); - dontSlideStickyWindows = CubeSlideConfig::dontSlideStickyWindows(); - usePagerLayout = CubeSlideConfig::usePagerLayout(); - useWindowMoving = CubeSlideConfig::useWindowMoving(); -} - -void CubeSlideEffect::prePaintScreen(ScreenPrePaintData& data, std::chrono::milliseconds presentTime) -{ - std::chrono::milliseconds delta = std::chrono::milliseconds::zero(); - if (lastPresentTime.count()) { - delta = presentTime - lastPresentTime; - } - lastPresentTime = presentTime; - - if (isActive()) { - data.mask |= PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS | PAINT_SCREEN_BACKGROUND_FIRST; - timeLine.setCurrentTime(timeLine.currentTime() + delta.count()); - if (windowMoving && timeLine.currentTime() > progressRestriction * (qreal)timeLine.duration()) - timeLine.setCurrentTime(progressRestriction * (qreal)timeLine.duration()); - } - effects->prePaintScreen(data, presentTime); -} - -void CubeSlideEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData& data) -{ - if (isActive()) { - glEnable(GL_CULL_FACE); - glCullFace(GL_FRONT); - paintSlideCube(mask, region, data); - glCullFace(GL_BACK); - paintSlideCube(mask, region, data); - glDisable(GL_CULL_FACE); - // Paint an extra screen with 'sticky' windows. - if (!staticWindows.isEmpty()) { - stickyPainting = true; - effects->paintScreen(mask, region, data); - stickyPainting = false; - } - } else - effects->paintScreen(mask, region, data); -} - -void CubeSlideEffect::paintSlideCube(int mask, QRegion region, ScreenPaintData& data) -{ - // slide cube only paints to desktops at a time - // first the horizontal rotations followed by vertical rotations - QRect rect = effects->clientArea(FullArea, effects->activeScreen(), effects->currentDesktop()); - float point = rect.width() / 2 * tan(45.0f * M_PI / 180.0f); - cube_painting = true; - painting_desktop = front_desktop; - - ScreenPaintData firstFaceData = data; - ScreenPaintData secondFaceData = data; - RotationDirection direction = slideRotations.head(); - int secondDesktop; - switch(direction) { - case Left: - firstFaceData.setRotationAxis(Qt::YAxis); - secondFaceData.setRotationAxis(Qt::YAxis); - if (usePagerLayout) - secondDesktop = effects->desktopToLeft(front_desktop, true); - else { - secondDesktop = front_desktop - 1; - if (secondDesktop == 0) - secondDesktop = effects->numberOfDesktops(); - } - firstFaceData.setRotationAngle(90.0f * timeLine.currentValue()); - secondFaceData.setRotationAngle(-90.0f * (1.0f - timeLine.currentValue())); - break; - case Right: - firstFaceData.setRotationAxis(Qt::YAxis); - secondFaceData.setRotationAxis(Qt::YAxis); - if (usePagerLayout) - secondDesktop = effects->desktopToRight(front_desktop, true); - else { - secondDesktop = front_desktop + 1; - if (secondDesktop > effects->numberOfDesktops()) - secondDesktop = 1; - } - firstFaceData.setRotationAngle(-90.0f * timeLine.currentValue()); - secondFaceData.setRotationAngle(90.0f * (1.0f - timeLine.currentValue())); - break; - case Upwards: - firstFaceData.setRotationAxis(Qt::XAxis); - secondFaceData.setRotationAxis(Qt::XAxis); - secondDesktop = effects->desktopAbove(front_desktop, true); - firstFaceData.setRotationAngle(-90.0f * timeLine.currentValue()); - secondFaceData.setRotationAngle(90.0f * (1.0f - timeLine.currentValue())); - point = rect.height() / 2 * tan(45.0f * M_PI / 180.0f); - break; - case Downwards: - firstFaceData.setRotationAxis(Qt::XAxis); - secondFaceData.setRotationAxis(Qt::XAxis); - secondDesktop = effects->desktopBelow(front_desktop, true); - firstFaceData.setRotationAngle(90.0f * timeLine.currentValue()); - secondFaceData.setRotationAngle(-90.0f * (1.0f - timeLine.currentValue())); - point = rect.height() / 2 * tan(45.0f * M_PI / 180.0f); - break; - default: - // totally impossible - return; - } - // front desktop - firstFaceData.setRotationOrigin(QVector3D(rect.width() / 2, rect.height() / 2, -point)); - other_desktop = secondDesktop; - firstDesktop = true; - effects->paintScreen(mask, region, firstFaceData); - // second desktop - other_desktop = painting_desktop; - painting_desktop = secondDesktop; - firstDesktop = false; - secondFaceData.setRotationOrigin(QVector3D(rect.width() / 2, rect.height() / 2, -point)); - effects->paintScreen(mask, region, secondFaceData); - cube_painting = false; - painting_desktop = effects->currentDesktop(); -} - -void CubeSlideEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std::chrono::milliseconds presentTime) -{ - if (stickyPainting) { - if (staticWindows.contains(w)) { - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } else { - w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } - } else if (isActive() && cube_painting) { - if (staticWindows.contains(w)) { - w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - effects->prePaintWindow(w, data, presentTime); - return; - } - QRect rect = effects->clientArea(FullArea, effects->activeScreen(), painting_desktop); - if (w->isOnDesktop(painting_desktop)) { - if (w->x() < rect.x()) { - data.quads = data.quads.splitAtX(-w->x()); - } - if (w->x() + w->width() > rect.x() + rect.width()) { - data.quads = data.quads.splitAtX(rect.width() - w->x()); - } - if (w->y() < rect.y()) { - data.quads = data.quads.splitAtY(-w->y()); - } - if (w->y() + w->height() > rect.y() + rect.height()) { - data.quads = data.quads.splitAtY(rect.height() - w->y()); - } - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } else if (w->isOnDesktop(other_desktop)) { - RotationDirection direction = slideRotations.head(); - bool enable = false; - if (w->x() < rect.x() && - (direction == Left || direction == Right)) { - data.quads = data.quads.splitAtX(-w->x()); - enable = true; - } - if (w->x() + w->width() > rect.x() + rect.width() && - (direction == Left || direction == Right)) { - data.quads = data.quads.splitAtX(rect.width() - w->x()); - enable = true; - } - if (w->y() < rect.y() && - (direction == Upwards || direction == Downwards)) { - data.quads = data.quads.splitAtY(-w->y()); - enable = true; - } - if (w->y() + w->height() > rect.y() + rect.height() && - (direction == Upwards || direction == Downwards)) { - data.quads = data.quads.splitAtY(rect.height() - w->y()); - enable = true; - } - if (enable) { - data.setTransformed(); - data.setTranslucent(); - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } else - w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } else - w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } - effects->prePaintWindow(w, data, presentTime); -} - -void CubeSlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) -{ - if (isActive() && cube_painting && !staticWindows.contains(w)) { - // filter out quads overlapping the edges - QRect rect = effects->clientArea(FullArea, effects->activeScreen(), painting_desktop); - if (w->isOnDesktop(painting_desktop)) { - if (w->x() < rect.x()) { - WindowQuadList new_quads; - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.right() > -w->x()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - if (w->x() + w->width() > rect.x() + rect.width()) { - WindowQuadList new_quads; - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.right() <= rect.width() - w->x()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - if (w->y() < rect.y()) { - WindowQuadList new_quads; - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.bottom() > -w->y()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - if (w->y() + w->height() > rect.y() + rect.height()) { - WindowQuadList new_quads; - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.bottom() <= rect.height() - w->y()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - } - // paint windows overlapping edges from other desktop - if (w->isOnDesktop(other_desktop) && (mask & PAINT_WINDOW_TRANSFORMED)) { - RotationDirection direction = slideRotations.head(); - if (w->x() < rect.x() && - (direction == Left || direction == Right)) { - WindowQuadList new_quads; - data.setXTranslation(rect.width()); - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.right() <= -w->x()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - if (w->x() + w->width() > rect.x() + rect.width() && - (direction == Left || direction == Right)) { - WindowQuadList new_quads; - data.setXTranslation(-rect.width()); - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.right() > rect.width() - w->x()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - if (w->y() < rect.y() && - (direction == Upwards || direction == Downwards)) { - WindowQuadList new_quads; - data.setYTranslation(rect.height()); - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.bottom() <= -w->y()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - if (w->y() + w->height() > rect.y() + rect.height() && - (direction == Upwards || direction == Downwards)) { - WindowQuadList new_quads; - data.setYTranslation(-rect.height()); - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (quad.bottom() > rect.height() - w->y()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - } - if (firstDesktop) - data.multiplyOpacity(timeLine.currentValue()); - else - data.multiplyOpacity((1.0 - timeLine.currentValue())); - } - } - effects->paintWindow(w, mask, region, data); -} - -void CubeSlideEffect::postPaintScreen() -{ - effects->postPaintScreen(); - if (isActive()) { - if (timeLine.currentValue() == 1.0) { - RotationDirection direction = slideRotations.dequeue(); - switch(direction) { - case Left: - if (usePagerLayout) - front_desktop = effects->desktopToLeft(front_desktop, true); - else { - front_desktop--; - if (front_desktop == 0) - front_desktop = effects->numberOfDesktops(); - } - break; - case Right: - if (usePagerLayout) - front_desktop = effects->desktopToRight(front_desktop, true); - else { - front_desktop++; - if (front_desktop > effects->numberOfDesktops()) - front_desktop = 1; - } - break; - case Upwards: - front_desktop = effects->desktopAbove(front_desktop, true); - break; - case Downwards: - front_desktop = effects->desktopBelow(front_desktop, true); - break; - } - timeLine.setCurrentTime(0); - if (slideRotations.count() == 1) - timeLine.setEasingCurve(QEasingCurve::OutSine); - else - timeLine.setEasingCurve(QEasingCurve::Linear); - if (slideRotations.empty()) { - for (EffectWindow* w : qAsConst(staticWindows)) { - w->setData(WindowForceBlurRole, QVariant()); - w->setData(WindowForceBackgroundContrastRole, QVariant()); - } - staticWindows.clear(); - lastPresentTime = std::chrono::milliseconds::zero(); - effects->setActiveFullScreenEffect(nullptr); - } - } - effects->addRepaintFull(); - } -} - -void CubeSlideEffect::slotDesktopChanged(int old, int current, EffectWindow* w) -{ - Q_UNUSED(w) - if (effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this) - return; - if (old > effects->numberOfDesktops()) { - // number of desktops has been reduced -> no animation - return; - } - if (windowMoving) { - desktopChangedWhileMoving = true; - progressRestriction = 1.0 - progressRestriction; - effects->addRepaintFull(); - return; - } - bool activate = true; - if (!slideRotations.empty()) { - // last slide still in progress - activate = false; - RotationDirection direction = slideRotations.dequeue(); - slideRotations.clear(); - slideRotations.enqueue(direction); - switch(direction) { - case Left: - if (usePagerLayout) - old = effects->desktopToLeft(front_desktop, true); - else { - old = front_desktop - 1; - if (old == 0) - old = effects->numberOfDesktops(); - } - break; - case Right: - if (usePagerLayout) - old = effects->desktopToRight(front_desktop, true); - else { - old = front_desktop + 1; - if (old > effects->numberOfDesktops()) - old = 1; - } - break; - case Upwards: - old = effects->desktopAbove(front_desktop, true); - break; - case Downwards: - old = effects->desktopBelow(front_desktop, true); - break; - } - } - if (usePagerLayout) { - // calculate distance in respect to pager - QPoint diff = effects->desktopGridCoords(effects->currentDesktop()) - effects->desktopGridCoords(old); - if (qAbs(diff.x()) > effects->desktopGridWidth() / 2) { - int sign = -1 * (diff.x() / qAbs(diff.x())); - diff.setX(sign *(effects->desktopGridWidth() - qAbs(diff.x()))); - } - if (diff.x() > 0) { - for (int i = 0; i < diff.x(); i++) { - slideRotations.enqueue(Right); - } - } else if (diff.x() < 0) { - diff.setX(-diff.x()); - for (int i = 0; i < diff.x(); i++) { - slideRotations.enqueue(Left); - } - } - if (qAbs(diff.y()) > effects->desktopGridHeight() / 2) { - int sign = -1 * (diff.y() / qAbs(diff.y())); - diff.setY(sign *(effects->desktopGridHeight() - qAbs(diff.y()))); - } - if (diff.y() > 0) { - for (int i = 0; i < diff.y(); i++) { - slideRotations.enqueue(Downwards); - } - } - if (diff.y() < 0) { - diff.setY(-diff.y()); - for (int i = 0; i < diff.y(); i++) { - slideRotations.enqueue(Upwards); - } - } - } else { - // ignore pager layout - int left = old - current; - if (left < 0) - left = effects->numberOfDesktops() + left; - int right = current - old; - if (right < 0) - right = effects->numberOfDesktops() + right; - if (left < right) { - for (int i = 0; i < left; i++) { - slideRotations.enqueue(Left); - } - } else { - for (int i = 0; i < right; i++) { - slideRotations.enqueue(Right); - } - } - } - timeLine.setDuration((float)rotationDuration / (float)slideRotations.count()); - if (activate) { - startAnimation(); - front_desktop = old; - effects->addRepaintFull(); - } -} - -void CubeSlideEffect::startAnimation() { - const EffectWindowList windows = effects->stackingOrder(); - for (EffectWindow* w : windows) { - if (!shouldAnimate(w)) { - w->setData(WindowForceBlurRole, QVariant(true)); - w->setData(WindowForceBackgroundContrastRole, QVariant(true)); - staticWindows.insert(w); - } - } - if (slideRotations.count() == 1) { - timeLine.setEasingCurve(QEasingCurve::InOutSine); - } else { - timeLine.setEasingCurve(QEasingCurve::InSine); - } - effects->setActiveFullScreenEffect(this); - timeLine.setCurrentTime(0); -} - -void CubeSlideEffect::slotWindowAdded(EffectWindow* w) { - if (!isActive()) { - return; - } - if (!shouldAnimate(w)) { - staticWindows.insert(w); - w->setData(WindowForceBlurRole, QVariant(true)); - w->setData(WindowForceBackgroundContrastRole, QVariant(true)); - } -} - -void CubeSlideEffect::slotWindowDeleted(EffectWindow* w) { - staticWindows.remove(w); -} - -bool CubeSlideEffect::shouldAnimate(const EffectWindow* w) const -{ - if (w->isDock()) { - return !dontSlidePanels; - } - if (w->isOnAllDesktops()) { - if (w->isDesktop()) { - return true; - } - if (w->isSpecialWindow()) { - return false; - } - return !dontSlideStickyWindows; - } - return true; -} - -void CubeSlideEffect::slotWindowStepUserMovedResized(EffectWindow* w) -{ - if (!useWindowMoving) - return; - if (!effects->kwinOption(SwitchDesktopOnScreenEdgeMovingWindows).toBool()) - return; - if (w->isUserResize()) - return; - const QSize screenSize = effects->virtualScreenSize(); - const QPoint cursor = effects->cursorPos(); - const int horizontal = screenSize.width() * 0.1; - const int vertical = screenSize.height() * 0.1; - const QRect leftRect(0, screenSize.height() * 0.1, horizontal, screenSize.height() * 0.8); - const QRect rightRect(screenSize.width() - horizontal, screenSize.height() * 0.1, horizontal, screenSize.height() * 0.8); - const QRect topRect(horizontal, 0, screenSize.width() * 0.8, vertical); - const QRect bottomRect(horizontal, screenSize.height() - vertical, screenSize.width() - horizontal * 2, vertical); - if (leftRect.contains(cursor)) { - if (effects->desktopToLeft(effects->currentDesktop()) != effects->currentDesktop()) - windowMovingChanged(0.3 *(float)(horizontal - cursor.x()) / (float)horizontal, Left); - } else if (rightRect.contains(cursor)) { - if (effects->desktopToRight(effects->currentDesktop()) != effects->currentDesktop()) - windowMovingChanged(0.3 *(float)(cursor.x() - screenSize.width() + horizontal) / (float)horizontal, Right); - } else if (topRect.contains(cursor)) { - if (effects->desktopAbove(effects->currentDesktop()) != effects->currentDesktop()) - windowMovingChanged(0.3 *(float)(vertical - cursor.y()) / (float)vertical, Upwards); - } else if (bottomRect.contains(cursor)) { - if (effects->desktopBelow(effects->currentDesktop()) != effects->currentDesktop()) - windowMovingChanged(0.3 *(float)(cursor.y() - screenSize.height() + vertical) / (float)vertical, Downwards); - } else { - // not in one of the areas - windowMoving = false; - desktopChangedWhileMoving = false; - timeLine.setCurrentTime(0); - lastPresentTime = std::chrono::milliseconds::zero(); - if (!slideRotations.isEmpty()) - slideRotations.clear(); - effects->setActiveFullScreenEffect(nullptr); - effects->addRepaintFull(); - } -} - -void CubeSlideEffect::slotWindowFinishUserMovedResized(EffectWindow* w) -{ - if (!useWindowMoving) - return; - if (!effects->kwinOption(SwitchDesktopOnScreenEdgeMovingWindows).toBool()) - return; - if (w->isUserResize()) - return; - if (!desktopChangedWhileMoving) { - if (slideRotations.isEmpty()) - return; - const RotationDirection direction = slideRotations.dequeue(); - switch(direction) { - case Left: - slideRotations.enqueue(Right); - break; - case Right: - slideRotations.enqueue(Left); - break; - case Upwards: - slideRotations.enqueue(Downwards); - break; - case Downwards: - slideRotations.enqueue(Upwards); - break; - default: - break; // impossible - } - timeLine.setCurrentTime(timeLine.duration() - timeLine.currentTime()); - } - desktopChangedWhileMoving = false; - windowMoving = false; - effects->addRepaintFull(); -} - -void CubeSlideEffect::windowMovingChanged(float progress, RotationDirection direction) -{ - if (desktopChangedWhileMoving) - progressRestriction = 1.0 - progress; - else - progressRestriction = progress; - front_desktop = effects->currentDesktop(); - if (slideRotations.isEmpty()) { - slideRotations.enqueue(direction); - windowMoving = true; - startAnimation(); - } - effects->addRepaintFull(); -} - -bool CubeSlideEffect::isActive() const -{ - return !slideRotations.isEmpty(); -} - -void CubeSlideEffect::slotNumberDesktopsChanged() -{ - // This effect animates only aftermaths of desktop switching. There is no any - // way to reference removed desktops for animation purposes. So our the best - // shot is just to do nothing. It doesn't look nice and we probaby have to - // find more proper way to handle this case. - - if (!isActive()) { - return; - } - - for (EffectWindow *w : qAsConst(staticWindows)) { - w->setData(WindowForceBlurRole, QVariant()); - w->setData(WindowForceBackgroundContrastRole, QVariant()); - } - - slideRotations.clear(); - staticWindows.clear(); - lastPresentTime = std::chrono::milliseconds::zero(); - - effects->setActiveFullScreenEffect(nullptr); -} - -} // namespace diff --git a/src/effects/cubeslide/cubeslide.h b/src/effects/cubeslide/cubeslide.h deleted file mode 100644 index e4f38ca757..0000000000 --- a/src/effects/cubeslide/cubeslide.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2009 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#ifndef KWIN_CUBESLIDE_H -#define KWIN_CUBESLIDE_H - -#include -#include -#include -#include -#include - -namespace KWin -{ -class CubeSlideEffect - : public Effect -{ - Q_OBJECT - Q_PROPERTY(int rotationDuration READ configuredRotationDuration) - Q_PROPERTY(bool dontSlidePanels READ isDontSlidePanels) - Q_PROPERTY(bool dontSlideStickyWindows READ isDontSlideStickyWindows) - Q_PROPERTY(bool usePagerLayout READ isUsePagerLayout) - Q_PROPERTY(bool useWindowMoving READ isUseWindowMoving) -public: - CubeSlideEffect(); - ~CubeSlideEffect() override; - void reconfigure(ReconfigureFlags) override; - void prePaintScreen(ScreenPrePaintData& data, std::chrono::milliseconds presentTime) override; - void paintScreen(int mask, const QRegion ®ion, ScreenPaintData& data) override; - void postPaintScreen() override; - void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std::chrono::milliseconds presentTime) override; - void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override; - bool isActive() const override; - - int requestedEffectChainPosition() const override { - return 50; - } - - static bool supported(); - - // for properties - int configuredRotationDuration() const { - return rotationDuration; - } - bool isDontSlidePanels() const { - return dontSlidePanels; - } - bool isDontSlideStickyWindows() const { - return dontSlideStickyWindows; - } - bool isUsePagerLayout() const { - return usePagerLayout; - } - bool isUseWindowMoving() const { - return useWindowMoving; - } -private Q_SLOTS: - void slotWindowAdded(EffectWindow* w); - void slotWindowDeleted(EffectWindow* w); - - void slotDesktopChanged(int old, int current, EffectWindow* w); - void slotWindowStepUserMovedResized(KWin::EffectWindow *w); - void slotWindowFinishUserMovedResized(KWin::EffectWindow *w); - void slotNumberDesktopsChanged(); - -private: - enum RotationDirection { - Left, - Right, - Upwards, - Downwards - }; - void paintSlideCube(int mask, QRegion region, ScreenPaintData& data); - void windowMovingChanged(float progress, RotationDirection direction); - - bool shouldAnimate(const EffectWindow* w) const; - void startAnimation(); - - bool cube_painting; - int front_desktop; - int painting_desktop; - int other_desktop; - bool firstDesktop; - bool stickyPainting; - QSet staticWindows; - QTimeLine timeLine; - std::chrono::milliseconds lastPresentTime; - QQueue slideRotations; - bool dontSlidePanels; - bool dontSlideStickyWindows; - bool usePagerLayout; - int rotationDuration; - bool useWindowMoving; - bool windowMoving; - bool desktopChangedWhileMoving; - double progressRestriction; -}; -} - -#endif diff --git a/src/effects/cubeslide/cubeslide.kcfg b/src/effects/cubeslide/cubeslide.kcfg deleted file mode 100644 index 0bf2bd2274..0000000000 --- a/src/effects/cubeslide/cubeslide.kcfg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - 0 - - - true - - - true - - - true - - - false - - - diff --git a/src/effects/cubeslide/cubeslide_config.cpp b/src/effects/cubeslide/cubeslide_config.cpp deleted file mode 100644 index 24a40e21aa..0000000000 --- a/src/effects/cubeslide/cubeslide_config.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2009 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#include "cubeslide_config.h" -// KConfigSkeleton -#include "cubeslideconfig.h" -#include -#include - -#include -#include -#include -#include - -K_PLUGIN_FACTORY_WITH_JSON(CubeSlideEffectConfigFactory, - "cubeslide_config.json", - registerPlugin();) - -namespace KWin -{ - -CubeSlideEffectConfigForm::CubeSlideEffectConfigForm(QWidget* parent) : QWidget(parent) -{ - setupUi(this); -} - -CubeSlideEffectConfig::CubeSlideEffectConfig(QWidget* parent, const QVariantList& args) : - KCModule(parent, args) -{ - m_ui = new CubeSlideEffectConfigForm(this); - - QVBoxLayout* layout = new QVBoxLayout(this); - - layout->addWidget(m_ui); - - CubeSlideConfig::instance(KWIN_CONFIG); - addConfig(CubeSlideConfig::self(), m_ui); - - load(); -} - -void CubeSlideEffectConfig::save() -{ - KCModule::save(); - OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), - QStringLiteral("/Effects"), - QDBusConnection::sessionBus()); - interface.reconfigureEffect(QStringLiteral("cubeslide")); -} - -} // namespace - -#include "cubeslide_config.moc" diff --git a/src/effects/cubeslide/cubeslide_config.desktop b/src/effects/cubeslide/cubeslide_config.desktop deleted file mode 100644 index 473807b22e..0000000000 --- a/src/effects/cubeslide/cubeslide_config.desktop +++ /dev/null @@ -1,74 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kwin_cubeslide_config -X-KDE-ParentComponents=cubeslide - -Name=Desktop Cube Animation -Name[az]=Animasiyalı İş Masası kubu -Name[bg]=Кубична анимация върху работен плот -Name[bs]=Animacija kocke površi -Name[ca]=Animació de cub per a l'escriptori -Name[ca@valencia]=Animació de cub d'escriptori -Name[cs]=Animace kostky plochy -Name[csb]=Animacëjô Szescanu pùltu -Name[da]=Animeret skrivebordsterning -Name[de]=Animation Arbeitsflächen-Würfel -Name[el]=Εφέ κύβου επιφάνειας εργασίας -Name[en_GB]=Desktop Cube Animation -Name[eo]=Movbildo de Labortabla kubo -Name[es]=Animación del cubo de escritorio -Name[et]=Töölauakuubiku animeerimine -Name[eu]=Mahaigain kuboaren animazioa -Name[fi]=Työpöytäkuutioanimaatio -Name[fr]=Animation du bureau en cube -Name[fy]=Buroblêd kubus animaasje -Name[ga]=Beochan an Chiúib Deisce -Name[gl]=Animación do cubo do escritorio -Name[gu]=ડેસ્ટોપ ક્યુબ એનિમેશન -Name[he]=הנפשת שולחן עבודה בקובייה -Name[hi]=डेस्कटॉप घन एनिमेशन -Name[hr]=Animacija kocke s radnom površinom -Name[hu]=Asztalváltó kocka -Name[ia]=Animation de cubo de scriptorio -Name[id]=Animasi Kubus Desktop -Name[is]=Hreyfingar á skjáborðskubbi -Name[it]=Animazione del cubo dei desktop -Name[ja]=デスクトップキューブのアニメーション -Name[kk]=Үстел текшесін анимациялау -Name[km]=ការ​ធ្វើ​ឲ្យ​គូប​ផ្ទៃតុ​មាន​ចលនា​ -Name[kn]=ಗಣಕತೆರೆ ಘನಾಕೃತಿಯ ಸಜೀವನ(ಎನಿಮೇಶನ್) -Name[ko]=데스크톱 큐브 애니메이션 -Name[lt]=Darbalaukio kubo animacija -Name[lv]=Darbvirsmas kuba animācija -Name[mk]=Анимација „Работна коцка“ -Name[ml]=പണിയിടം ക്യൂബ് നീക്കം -Name[mr]=डेस्कटॉप क्यूब ऍनीमेशन -Name[nb]=Animert skrivebordsterning -Name[nds]=Animeert Wörpel-Schriefdisch -Name[nl]=Animatie met bureaubladkubus -Name[nn]=Kubeskifte av skrivebord -Name[pa]=ਡੈਸਕਟਾਪ ਘਣ ਐਨੀਮੇਸ਼ਨ -Name[pl]=Animacja sześcianu pulpitów -Name[pt]=Animação do Cubo de Ecrãs -Name[pt_BR]=Animação do cubo de áreas de trabalho -Name[ro]=Animație Cub de birou -Name[ru]=Анимация куба рабочих столов -Name[si]=වැඩතල ඝනක සජීවීකරණය -Name[sk]=Animácia plochy na kocke -Name[sl]=Animacija kocka z namizji -Name[sr]=Анимација коцке површи -Name[sr@ijekavian]=Анимација коцке површи -Name[sr@ijekavianlatin]=Animacija kocke površi -Name[sr@latin]=Animacija kocke površi -Name[sv]=Animering med skrivbordskub -Name[th]=พื้นที่ทำงานทรงลูกบาศก์แบบเคลื่อนไหว -Name[tr]=Masaüstü Küp Animasyonu -Name[ug]=ئۈستەلئۈستى كۇب جانلاندۇرۇمى -Name[uk]=Анімація куба стільниць -Name[vi]=Hiệu ứng khối vuông màn hình -Name[wa]=Animåcion cube do scribannes -Name[x-test]=xxDesktop Cube Animationxx -Name[zh_CN]=3D 切换 -Name[zh_TW]=桌面立方體動畫 diff --git a/src/effects/cubeslide/cubeslide_config.h b/src/effects/cubeslide/cubeslide_config.h deleted file mode 100644 index 8a49c6eeef..0000000000 --- a/src/effects/cubeslide/cubeslide_config.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2009 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#ifndef KWIN_CUBESLIDE_CONFIG_H -#define KWIN_CUBESLIDE_CONFIG_H - -#include - -#include "ui_cubeslide_config.h" - - -namespace KWin -{ - -class CubeSlideEffectConfigForm : public QWidget, public Ui::CubeSlideEffectConfigForm -{ - Q_OBJECT -public: - explicit CubeSlideEffectConfigForm(QWidget* parent); -}; - -class CubeSlideEffectConfig : public KCModule -{ - Q_OBJECT -public: - explicit CubeSlideEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); - -public Q_SLOTS: - void save() override; - -private: - CubeSlideEffectConfigForm* m_ui; -}; - -} // namespace - -#endif diff --git a/src/effects/cubeslide/cubeslide_config.ui b/src/effects/cubeslide/cubeslide_config.ui deleted file mode 100644 index 44acfe9ad0..0000000000 --- a/src/effects/cubeslide/cubeslide_config.ui +++ /dev/null @@ -1,105 +0,0 @@ - - - KWin::CubeSlideEffectConfigForm - - - - 0 - 0 - 431 - 161 - - - - - - - Do not animate windows on all desktops - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - Default - - - msec - - - 5000 - - - 10 - - - - - - - Do not animate panels - - - - - - - Rotation duration: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_RotationDuration - - - - - - - Use pager layout for animation - - - - - - - Start animation when moving windows towards screen edges - - - - - - - kcfg_RotationDuration - kcfg_DontSlidePanels - kcfg_DontSlideStickyWindows - - - - diff --git a/src/effects/cubeslide/cubeslideconfig.kcfgc b/src/effects/cubeslide/cubeslideconfig.kcfgc deleted file mode 100644 index 6059a7e3e2..0000000000 --- a/src/effects/cubeslide/cubeslideconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=cubeslide.kcfg -ClassName=CubeSlideConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/src/effects/effect_builtins.cpp b/src/effects/effect_builtins.cpp index 4d2a816e57..83aed3f31a 100644 --- a/src/effects/effect_builtins.cpp +++ b/src/effects/effect_builtins.cpp @@ -33,7 +33,6 @@ #include "windowgeometry/windowgeometry.h" #include "zoom/zoom.h" // OpenGL-specific effects for desktop -#include "cubeslide/cubeslide.h" #include "glide/glide.h" #include "invert/invert.h" #include "lookingglass/lookingglass.h" @@ -132,22 +131,6 @@ EFFECT_FALLBACK #endif EFFECT_FALLBACK QString() - }, { - QStringLiteral("cubeslide"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Cube Animation"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Animate desktop switching with a cube"), - QStringLiteral("Virtual Desktop Switching Animation"), - QStringLiteral("desktop-animations"), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/desktop_cube_animation.ogv")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &CubeSlideEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_cubeslide_config") }, { QStringLiteral("desktopgrid"), i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Grid"), diff --git a/src/effects/effect_builtins.h b/src/effects/effect_builtins.h index 00a6fca370..0763796073 100644 --- a/src/effects/effect_builtins.h +++ b/src/effects/effect_builtins.h @@ -26,7 +26,6 @@ enum class BuiltInEffect Blur, ColorPicker, Contrast, - CubeSlide, DesktopGrid, DimInactive, FallApart,