diff --git a/autotests/test_builtin_effectloader.cpp b/autotests/test_builtin_effectloader.cpp index 8253285aed..01503011a3 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("Cube") << QStringLiteral("cube") << true; QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << true; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true; @@ -125,7 +124,6 @@ void TestBuiltInEffectLoader::testKnownEffects() expectedEffects << QStringLiteral("blur") << QStringLiteral("colorpicker") << QStringLiteral("contrast") - << QStringLiteral("cube") << QStringLiteral("cubeslide") << QStringLiteral("desktopgrid") << QStringLiteral("diminactive") @@ -185,8 +183,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("Cube") << QStringLiteral("cube") << false << xc << true; - QTest::newRow("Cube-GL") << QStringLiteral("cube") << true << 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; @@ -268,9 +264,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("Cube") << QStringLiteral("cube") << false << xc; - // TODO: needs GL mocking -// QTest::newRow("Cube-GL") << QStringLiteral("cube") << true << oc; QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << false << xc; QTest::newRow("CubeSlide-GL") << QStringLiteral("cubeslide") << true << oc; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << xc; diff --git a/autotests/test_plugin_effectloader.cpp b/autotests/test_plugin_effectloader.cpp index 186a7f84b0..9c39a821dc 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("Cube") << QStringLiteral("cube") << false; QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << false; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << false; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << false; diff --git a/autotests/test_scripted_effectloader.cpp b/autotests/test_scripted_effectloader.cpp index 54a26484c2..f7497b1f64 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("Cube") << QStringLiteral("cube") << false; QTest::newRow("CubeSlide") << QStringLiteral("cubeslide") << false; QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << false; QTest::newRow("DimInactive") << QStringLiteral("diminactive") << false; diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt index 7ec9eef6fe..716ea500b8 100644 --- a/src/effects/CMakeLists.txt +++ b/src/effects/CMakeLists.txt @@ -83,8 +83,6 @@ set(kwin4_effect_builtins_sources blur/blur.cpp blur/blurshader.cpp colorpicker/colorpicker.cpp - cube/cube.cpp - cube/cube_proxy.cpp cubeslide/cubeslide.cpp desktopgrid/desktopgrid.cpp diminactive/diminactive.cpp @@ -123,7 +121,6 @@ qt5_add_resources(kwin4_effect_builtins_sources shaders.qrc) kconfig_add_kcfg_files(kwin4_effect_builtins_sources blur/blurconfig.kcfgc - cube/cubeconfig.kcfgc cubeslide/cubeslideconfig.kcfgc desktopgrid/desktopgridconfig.kcfgc diminactive/diminactiveconfig.kcfgc @@ -196,7 +193,6 @@ add_subdirectory(zoom) # OpenGL-specific effects add_subdirectory(blur) include(backgroundcontrast/CMakeLists.txt) -add_subdirectory(cube) add_subdirectory(cubeslide) add_subdirectory(glide) add_subdirectory(invert) diff --git a/src/effects/cube/CMakeLists.txt b/src/effects/cube/CMakeLists.txt deleted file mode 100644 index 58b6664897..0000000000 --- a/src/effects/cube/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -####################################### -# Effect - -# Data files -install(FILES data/cubecap.png DESTINATION ${KDE_INSTALL_DATADIR}/kwin) - -####################################### -# Config - -set(kwin_cube_config_SRCS cube_config.cpp) -ki18n_wrap_ui(kwin_cube_config_SRCS cube_config.ui) -kconfig_add_kcfg_files(kwin_cube_config_SRCS cubeconfig.kcfgc) - -add_library(kwin_cube_config MODULE ${kwin_cube_config_SRCS}) - -target_link_libraries(kwin_cube_config - KF5::ConfigWidgets - KF5::GlobalAccel - KF5::I18n - KF5::XmlGui - KF5::KIOWidgets - KWinEffectsInterface -) - -kcoreaddons_desktop_to_json(kwin_cube_config cube_config.desktop SERVICE_TYPES kcmodule.desktop) - -install( - TARGETS - kwin_cube_config - DESTINATION - ${KDE_INSTALL_PLUGINDIR}/kwin/effects/configs -) diff --git a/src/effects/cube/cube.cpp b/src/effects/cube/cube.cpp deleted file mode 100644 index 9f73a2adf5..0000000000 --- a/src/effects/cube/cube.cpp +++ /dev/null @@ -1,1747 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#include "cube.h" -// KConfigSkeleton -#include "cubeconfig.h" - - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -namespace KWin -{ - -CubeEffect::CubeEffect() - : activated(false) - , cube_painting(false) - , keyboard_grab(false) - , painting_desktop(1) - , frontDesktop(0) - , cubeOpacity(1.0) - , opacityDesktopOnly(true) - , displayDesktopName(false) - , desktopNameFrame(nullptr) - , reflection(true) - , desktopChangedWhileRotating(false) - , paintCaps(true) - , wallpaper(nullptr) - , texturedCaps(true) - , capTexture(nullptr) - , lastPresentTime(std::chrono::milliseconds::zero()) - , reflectionPainting(false) - , activeScreen(0) - , bottomCap(false) - , closeOnMouseRelease(false) - , zoom(0.0) - , zPosition(0.0) - , useForTabBox(false) - , tabBoxMode(false) - , shortcutsRegistered(false) - , mode(Cube) - , useShaders(false) - , cylinderShader(nullptr) - , sphereShader(nullptr) - , zOrderingFactor(0.0f) - , mAddedHeightCoeff1(0.0f) - , mAddedHeightCoeff2(0.0f) - , m_cubeCapBuffer(nullptr) - , m_proxy(this) - , m_cubeAction(new QAction(this)) - , m_cylinderAction(new QAction(this)) - , m_sphereAction(new QAction(this)) -{ - initConfig(); - desktopNameFont.setBold(true); - desktopNameFont.setPointSize(14); - - if (effects->compositingType() == OpenGL2Compositing) { - m_reflectionShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-reflection.glsl")); - m_capShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-cap.glsl")); - } else { - m_reflectionShader = nullptr; - m_capShader = nullptr; - } - m_textureMirrorMatrix.scale(1.0, -1.0, 1.0); - m_textureMirrorMatrix.translate(0.0, -1.0, 0.0); - connect(effects, &EffectsHandler::tabBoxAdded, this, &CubeEffect::slotTabBoxAdded); - connect(effects, &EffectsHandler::tabBoxClosed, this, &CubeEffect::slotTabBoxClosed); - connect(effects, &EffectsHandler::tabBoxUpdated, this, &CubeEffect::slotTabBoxUpdated); - connect(effects, &EffectsHandler::screenAboutToLock, this, [this]() { - // Set active(false) does not release key grabs until the animation completes - // As we know the lockscreen is trying to grab them, release them early - // all other grabs are released in the normal way - setActive(false); - if (keyboard_grab) { - effects->ungrabKeyboard(); - keyboard_grab = false; - } - }); - - reconfigure(ReconfigureAll); -} - -bool CubeEffect::supported() -{ - return effects->isOpenGLCompositing(); -} - -void CubeEffect::reconfigure(ReconfigureFlags) -{ - CubeConfig::self()->read(); - Q_FOREACH (ElectricBorder border, borderActivate) { - effects->unreserveElectricBorder(border, this); - } - Q_FOREACH (ElectricBorder border, borderActivateCylinder) { - effects->unreserveElectricBorder(border, this); - } - Q_FOREACH (ElectricBorder border, borderActivateSphere) { - effects->unreserveElectricBorder(border, this); - } - borderActivate.clear(); - borderActivateCylinder.clear(); - borderActivateSphere.clear(); - QList borderList = QList(); - borderList.append(int(ElectricNone)); - borderList = CubeConfig::borderActivate(); - Q_FOREACH (int i, borderList) { - borderActivate.append(ElectricBorder(i)); - effects->reserveElectricBorder(ElectricBorder(i), this); - } - borderList.clear(); - borderList.append(int(ElectricNone)); - borderList = CubeConfig::borderActivateCylinder(); - Q_FOREACH (int i, borderList) { - borderActivateCylinder.append(ElectricBorder(i)); - effects->reserveElectricBorder(ElectricBorder(i), this); - } - borderList.clear(); - borderList.append(int(ElectricNone)); - borderList = CubeConfig::borderActivateSphere(); - Q_FOREACH (int i, borderList) { - borderActivateSphere.append(ElectricBorder(i)); - effects->reserveElectricBorder(ElectricBorder(i), this); - } - - cubeOpacity = (float)CubeConfig::opacity() / 100.0f; - opacityDesktopOnly = CubeConfig::opacityDesktopOnly(); - displayDesktopName = CubeConfig::displayDesktopName(); - reflection = CubeConfig::reflection(); - // TODO: Rename rotationDuration to duration so we - // can use animationTime(500). - const int d = CubeConfig::rotationDuration() != 0 - ? CubeConfig::rotationDuration() - : 500; - rotationDuration = std::chrono::milliseconds(static_cast(animationTime(d))); - backgroundColor = CubeConfig::backgroundColor(); - capColor = CubeConfig::capColor(); - paintCaps = CubeConfig::caps(); - closeOnMouseRelease = CubeConfig::closeOnMouseRelease(); - zPosition = CubeConfig::zPosition(); - - useForTabBox = CubeConfig::tabBox(); - invertKeys = CubeConfig::invertKeys(); - invertMouse = CubeConfig::invertMouse(); - capDeformationFactor = (float)CubeConfig::capDeformation() / 100.0f; - useZOrdering = CubeConfig::zOrdering(); - delete wallpaper; - wallpaper = nullptr; - delete capTexture; - capTexture = nullptr; - texturedCaps = CubeConfig::texturedCaps(); - - timeLine.setEasingCurve(QEasingCurve::InOutSine); - timeLine.setDuration(rotationDuration); - - verticalTimeLine.setEasingCurve(QEasingCurve::InOutSine); - verticalTimeLine.setDuration(rotationDuration); - - // do not connect the shortcut if we use cylinder or sphere - if (!shortcutsRegistered) { - QAction* cubeAction = m_cubeAction; - cubeAction->setObjectName(QStringLiteral("Cube")); - cubeAction->setText(i18n("Desktop Cube")); - KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); - KGlobalAccel::self()->setShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); - effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F11, cubeAction); - effects->registerPointerShortcut(Qt::ControlModifier | Qt::AltModifier, Qt::LeftButton, cubeAction); - cubeShortcut = KGlobalAccel::self()->shortcut(cubeAction); - QAction* cylinderAction = m_cylinderAction; - cylinderAction->setObjectName(QStringLiteral("Cylinder")); - cylinderAction->setText(i18n("Desktop Cylinder")); - KGlobalAccel::self()->setShortcut(cylinderAction, QList()); - effects->registerGlobalShortcut(QKeySequence(), cylinderAction); - cylinderShortcut = KGlobalAccel::self()->shortcut(cylinderAction); - QAction* sphereAction = m_sphereAction; - sphereAction->setObjectName(QStringLiteral("Sphere")); - sphereAction->setText(i18n("Desktop Sphere")); - KGlobalAccel::self()->setShortcut(sphereAction, QList()); - sphereShortcut = KGlobalAccel::self()->shortcut(sphereAction); - effects->registerGlobalShortcut(QKeySequence(), sphereAction); - connect(cubeAction, &QAction::triggered, this, &CubeEffect::toggleCube); - connect(cylinderAction, &QAction::triggered, this, &CubeEffect::toggleCylinder); - connect(sphereAction, &QAction::triggered, this, &CubeEffect::toggleSphere); - connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &CubeEffect::globalShortcutChanged); - shortcutsRegistered = true; - } - - // set the cap color on the shader - if (m_capShader && m_capShader->isValid()) { - ShaderBinder binder(m_capShader); - m_capShader->setUniform(GLShader::Color, capColor); - } - - // touch borders - const QVector relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom}; - for (auto e : relevantBorders) { - effects->unregisterTouchBorder(e, m_cubeAction); - effects->unregisterTouchBorder(e, m_sphereAction); - effects->unregisterTouchBorder(e, m_cylinderAction); - } - auto touchEdge = [&relevantBorders] (const QList touchBorders, QAction *action) { - for (int i : touchBorders) { - if (!relevantBorders.contains(ElectricBorder(i))) { - continue; - } - effects->registerTouchBorder(ElectricBorder(i), action); - } - }; - touchEdge(CubeConfig::touchBorderActivate(), m_cubeAction); - touchEdge(CubeConfig::touchBorderActivateCylinder(), m_cylinderAction); - touchEdge(CubeConfig::touchBorderActivateSphere(), m_sphereAction); -} - -CubeEffect::~CubeEffect() -{ - delete wallpaper; - delete capTexture; - delete cylinderShader; - delete sphereShader; - delete desktopNameFrame; - delete m_reflectionShader; - delete m_capShader; - delete m_cubeCapBuffer; -} - -QImage CubeEffect::loadCubeCap(const QString &capPath) -{ - if (!texturedCaps) { - return QImage(); - } - return QImage(capPath); -} - -void CubeEffect::slotCubeCapLoaded() -{ - QFutureWatcher *watcher = dynamic_cast*>(sender()); - if (!watcher) { - // not invoked from future watcher - return; - } - QImage img = watcher->result(); - if (!img.isNull()) { - effects->makeOpenGLContextCurrent(); - capTexture = new GLTexture(img); - capTexture->setFilter(GL_LINEAR); - if (!GLPlatform::instance()->isGLES()) { - capTexture->setWrapMode(GL_CLAMP_TO_BORDER); - } - // need to recreate the VBO for the cube cap - delete m_cubeCapBuffer; - m_cubeCapBuffer = nullptr; - effects->addRepaintFull(); - } - watcher->deleteLater(); -} - -QImage CubeEffect::loadWallPaper(const QString &file) -{ - return QImage(file); -} - -void CubeEffect::slotWallPaperLoaded() -{ - QFutureWatcher *watcher = dynamic_cast*>(sender()); - if (!watcher) { - // not invoked from future watcher - return; - } - QImage img = watcher->result(); - if (!img.isNull()) { - effects->makeOpenGLContextCurrent(); - wallpaper = new GLTexture(img); - effects->addRepaintFull(); - } - watcher->deleteLater(); -} - -bool CubeEffect::loadShader() -{ - effects->makeOpenGLContextCurrent(); - if (!(GLPlatform::instance()->supports(GLSL) && - (effects->compositingType() == OpenGL2Compositing))) - return false; - - cylinderShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture | ShaderTrait::AdjustSaturation | ShaderTrait::Modulate, QStringLiteral("cylinder.vert"), QString()); - if (!cylinderShader->isValid()) { - qCCritical(KWINEFFECTS) << "The cylinder shader failed to load!"; - return false; - } else { - ShaderBinder binder(cylinderShader); - cylinderShader->setUniform("sampler", 0); - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - cylinderShader->setUniform("width", (float)rect.width() * 0.5f); - } - - sphereShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture | ShaderTrait::AdjustSaturation | ShaderTrait::Modulate, QStringLiteral("sphere.vert"), QString()); - if (!sphereShader->isValid()) { - qCCritical(KWINEFFECTS) << "The sphere shader failed to load!"; - return false; - } else { - ShaderBinder binder(sphereShader); - sphereShader->setUniform("sampler", 0); - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - sphereShader->setUniform("width", (float)rect.width() * 0.5f); - sphereShader->setUniform("height", (float)rect.height() * 0.5f); - sphereShader->setUniform("u_offset", QVector2D(0, 0)); - } - return true; -} - -void CubeEffect::startAnimation(AnimationState state) -{ - QEasingCurve curve; - /* If this is first and only animation -> EaseInOut - * there is more -> EaseIn - * If there was an animation before, and this is the last one -> EaseOut - * there is more -> Linear */ - if (animationState == AnimationState::None) { - curve.setType(animations.empty() ? QEasingCurve::InOutSine : QEasingCurve::InCurve); - } else { - curve.setType(animations.empty() ? QEasingCurve::OutCurve : QEasingCurve::Linear); - } - timeLine.reset(); - timeLine.setEasingCurve(curve); - startAngle = currentAngle; - startFrontDesktop = frontDesktop; - animationState = state; -} - -void CubeEffect::startVerticalAnimation(VerticalAnimationState state) -{ - /* Ignore if there is nowhere to rotate */ - if ((qFuzzyIsNull(verticalCurrentAngle - 90.0f) && state == VerticalAnimationState::Upwards) || - (qFuzzyIsNull(verticalCurrentAngle + 90.0f) && state == VerticalAnimationState::Downwards)) { - return; - } - verticalTimeLine.reset(); - verticalStartAngle = verticalCurrentAngle; - verticalAnimationState = state; -} - -void CubeEffect::prePaintScreen(ScreenPrePaintData& data, std::chrono::milliseconds presentTime) -{ - std::chrono::milliseconds delta = std::chrono::milliseconds::zero(); - if (lastPresentTime.count()) { - delta = presentTime - lastPresentTime; - } - lastPresentTime = presentTime; - - if (activated) { - data.mask |= PAINT_SCREEN_TRANSFORMED | Effect::PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS | PAINT_SCREEN_BACKGROUND_FIRST; - if (animationState == AnimationState::None && !animations.empty()) { - startAnimation(animations.dequeue()); - } - if (verticalAnimationState == VerticalAnimationState::None && !verticalAnimations.empty()) { - startVerticalAnimation(verticalAnimations.dequeue()); - } - - if (animationState != AnimationState::None || verticalAnimationState != VerticalAnimationState::None) { - if (animationState != AnimationState::None) { - timeLine.update(delta); - } - if (verticalAnimationState != VerticalAnimationState::None) { - verticalTimeLine.update(delta); - } - rotateCube(); - } - } - effects->prePaintScreen(data, presentTime); -} - -void CubeEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData& data) -{ - if (activated) { - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - - // background - float clearColor[4]; - glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor); - glClearColor(backgroundColor.redF(), backgroundColor.greenF(), backgroundColor.blueF(), 1.0); - glClear(GL_COLOR_BUFFER_BIT); - glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); - - // wallpaper - if (wallpaper) { - ShaderBinder binder(ShaderTrait::MapTexture); - binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix()); - wallpaper->bind(); - wallpaper->render(region, rect); - wallpaper->unbind(); - } - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // some veriables needed for painting the caps - float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 180.0f); - float point = rect.width() / 2 * tan(cubeAngle * 0.5f * M_PI / 180.0f); - float zTranslate = zPosition + zoom; - if (animationState == AnimationState::Start) { - zTranslate *= timeLine.value(); - } else if (animationState == AnimationState::Stop) { - zTranslate *= (1.0 - timeLine.value()); - } - // reflection - if (reflection) { - // we can use a huge scale factor (needed to calculate the rearground vertices) - float scaleFactor = 1000000 * tan(60.0 * M_PI / 360.0f) / rect.height(); - m_reflectionMatrix.setToIdentity(); - m_reflectionMatrix.scale(1.0, -1.0, 1.0); - - double translate = 0.0; - if (mode == Cube) { - double addedHeight1 = -rect.height() * cos(verticalCurrentAngle*M_PI/180.0f) - rect.width() * sin(fabs(verticalCurrentAngle)*M_PI/180.0f)/tan(M_PI/effects->numberOfDesktops()); - double addedHeight2 = -rect.width() * sin(fabs(verticalCurrentAngle)*M_PI/180.0f)*tan(M_PI*0.5f/effects->numberOfDesktops()); - if (verticalCurrentAngle > 0.0f && effects->numberOfDesktops() & 1) - translate = cos(fabs(currentAngle)*effects->numberOfDesktops()*M_PI/360.0f) * addedHeight2 + addedHeight1 - float(rect.height()); - else - translate = sin(fabs(currentAngle)*effects->numberOfDesktops()*M_PI/360.0f) * addedHeight2 + addedHeight1 - float(rect.height()); - } else if (mode == Cylinder) { - double addedHeight1 = -rect.height() * cos(verticalCurrentAngle*M_PI/180.0f) - rect.width() * sin(fabs(verticalCurrentAngle)*M_PI/180.0f)/tan(M_PI/effects->numberOfDesktops()); - translate = addedHeight1 - float(rect.height()); - } else { - float radius = (rect.width() * 0.5) / cos(cubeAngle * 0.5 * M_PI / 180.0); - translate = -rect.height()-2*radius; - } - m_reflectionMatrix.translate(0.0f, translate, 0.0f); - - reflectionPainting = true; - glEnable(GL_CULL_FACE); - paintCap(true, -point - zTranslate, data.projectionMatrix()); - - // cube - glCullFace(GL_BACK); - paintCube(mask, region, data); - - glCullFace(GL_FRONT); - paintCube(mask, region, data); - - paintCap(false, -point - zTranslate, data.projectionMatrix()); - glDisable(GL_CULL_FACE); - reflectionPainting = false; - - const float width = rect.width(); - const float height = rect.height(); - float vertices[] = { - -width * 0.5f, height, 0.0, - width * 0.5f, height, 0.0, - width * scaleFactor, height, -5000, - -width * scaleFactor, height, -5000 - }; - // foreground - float alpha = 0.7; - if (animationState == AnimationState::Start) { - alpha = 0.3 + 0.4 * timeLine.value(); - } else if (animationState == AnimationState::Stop) { - alpha = 0.3 + 0.4 * (1.0 - timeLine.value()); - } - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if (m_reflectionShader && m_reflectionShader->isValid()) { - // ensure blending is enabled - no attribute stack - ShaderBinder binder(m_reflectionShader); - QMatrix4x4 windowTransformation = data.projectionMatrix(); - windowTransformation.translate(rect.x() + rect.width() * 0.5f, 0.0, 0.0); - m_reflectionShader->setUniform(GLShader::ModelViewProjectionMatrix, windowTransformation); - m_reflectionShader->setUniform("u_alpha", alpha); - QVector verts; - QVector texcoords; - verts.reserve(18); - texcoords.reserve(12); - texcoords << 0.0 << 0.0; - verts << vertices[6] << vertices[7] << vertices[8]; - texcoords << 0.0 << 0.0; - verts << vertices[9] << vertices[10] << vertices[11]; - texcoords << 1.0 << 0.0; - verts << vertices[0] << vertices[1] << vertices[2]; - texcoords << 1.0 << 0.0; - verts << vertices[0] << vertices[1] << vertices[2]; - texcoords << 1.0 << 0.0; - verts << vertices[3] << vertices[4] << vertices[5]; - texcoords << 0.0 << 0.0; - verts << vertices[6] << vertices[7] << vertices[8]; - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setData(6, 3, verts.data(), texcoords.data()); - vbo->render(GL_TRIANGLES); - } - glDisable(GL_BLEND); - } - glEnable(GL_CULL_FACE); - // caps - paintCap(false, -point - zTranslate, data.projectionMatrix()); - - // cube - glCullFace(GL_FRONT); - paintCube(mask, region, data); - - glCullFace(GL_BACK); - paintCube(mask, region, data); - - // cap - paintCap(true, -point - zTranslate, data.projectionMatrix()); - glDisable(GL_CULL_FACE); - - glDisable(GL_BLEND); - - // desktop name box - inspired from coverswitch - if (displayDesktopName) { - double opacity = 1.0; - if (animationState == AnimationState::Start) { - opacity = timeLine.value(); - } else if (animationState == AnimationState::Stop) { - opacity = 1.0 - timeLine.value(); - } - QRect screenRect = effects->clientArea(ScreenArea, activeScreen, frontDesktop); - QRect frameRect = QRect(screenRect.width() * 0.33f + screenRect.x(), screenRect.height() * 0.95f + screenRect.y(), - screenRect.width() * 0.34f, QFontMetrics(desktopNameFont).height()); - if (!desktopNameFrame) { - desktopNameFrame = effects->effectFrame(EffectFrameStyled); - desktopNameFrame->setFont(desktopNameFont); - } - desktopNameFrame->setGeometry(frameRect); - desktopNameFrame->setText(effects->desktopName(frontDesktop)); - desktopNameFrame->render(region, opacity); - } - } else { - effects->paintScreen(mask, region, data); - } -} - -void CubeEffect::rotateCube() -{ - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - m_rotationMatrix.setToIdentity(); - float internalCubeAngle = 360.0f / effects->numberOfDesktops(); - float zTranslate = zPosition + zoom; - float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 180.0f); - float point = rect.width() / 2 * tan(cubeAngle * 0.5f * M_PI / 180.0f); - /* Animations */ - if (animationState == AnimationState::Start) { - zTranslate *= timeLine.value(); - } else if (animationState == AnimationState::Stop) { - currentAngle = startAngle * (1.0 - timeLine.value()); - zTranslate *= (1.0 - timeLine.value()); - } else if (animationState != AnimationState::None) { - /* Left or right */ - float endAngle = animationState == AnimationState::Right ? internalCubeAngle : -internalCubeAngle; - currentAngle = startAngle + timeLine.value() * (endAngle - startAngle); - frontDesktop = startFrontDesktop; - } - /* Switching to next desktop: either by mouse or due to animation */ - if (currentAngle > internalCubeAngle * 0.5f) { - currentAngle -= internalCubeAngle; - frontDesktop--; - if (frontDesktop < 1) { - frontDesktop = effects->numberOfDesktops(); - } - } - if (currentAngle < -internalCubeAngle * 0.5f) { - currentAngle += internalCubeAngle; - frontDesktop++; - if (frontDesktop > effects->numberOfDesktops()) { - frontDesktop = 1; - } - } - /* Vertical animations */ - if (verticalAnimationState != VerticalAnimationState::None) { - float verticalEndAngle = 0.0; - if (verticalAnimationState == VerticalAnimationState::Upwards && verticalStartAngle >= 0.0) { - verticalEndAngle = 90.0; - } - if (verticalAnimationState == VerticalAnimationState::Downwards && verticalStartAngle <= 0.0) { - verticalEndAngle = -90.0; - } - // This also handles the "VerticalAnimationState::Stop" correctly, since it has endAngle = 0.0 - verticalCurrentAngle = verticalStartAngle + verticalTimeLine.value() * (verticalEndAngle - verticalStartAngle); - } - /* Updating rotation matrix */ - if (verticalAnimationState != VerticalAnimationState::None || verticalCurrentAngle != 0.0f) { - m_rotationMatrix.translate(rect.width() / 2, rect.height() / 2, -point - zTranslate); - m_rotationMatrix.rotate(verticalCurrentAngle, 1.0, 0.0, 0.0); - m_rotationMatrix.translate(-rect.width() / 2, -rect.height() / 2, point + zTranslate); - } - if (animationState != AnimationState::None || currentAngle != 0.0f) { - m_rotationMatrix.translate(rect.width() / 2, rect.height() / 2, -point - zTranslate); - m_rotationMatrix.rotate(currentAngle, 0.0, 1.0, 0.0); - m_rotationMatrix.translate(-rect.width() / 2, -rect.height() / 2, point + zTranslate); - } -} - -void CubeEffect::paintCube(int mask, QRegion region, ScreenPaintData& data) -{ - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - float internalCubeAngle = 360.0f / effects->numberOfDesktops(); - cube_painting = true; - float zTranslate = zPosition + zoom; - if (animationState == AnimationState::Start) { - zTranslate *= timeLine.value(); - } else if (animationState == AnimationState::Stop) { - zTranslate *= (1.0 - timeLine.value()); - } - - // Rotation of the cube - float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 180.0f); - float point = rect.width() / 2 * tan(cubeAngle * 0.5f * M_PI / 180.0f); - - for (int i = 0; i < effects->numberOfDesktops(); i++) { - // start painting the cube - painting_desktop = (i + frontDesktop) % effects->numberOfDesktops(); - if (painting_desktop == 0) { - painting_desktop = effects->numberOfDesktops(); - } - QMatrix4x4 matrix; - matrix.translate(0, 0, -zTranslate); - const QVector3D origin(rect.width() / 2, 0.0, -point); - matrix.translate(origin); - matrix.rotate(internalCubeAngle * i, 0, 1, 0); - matrix.translate(-origin); - m_currentFaceMatrix = matrix; - effects->paintScreen(mask, region, data); - } - cube_painting = false; - painting_desktop = effects->currentDesktop(); -} - -void CubeEffect::paintCap(bool frontFirst, float zOffset, const QMatrix4x4 &projection) -{ - if ((!paintCaps) || effects->numberOfDesktops() <= 2) - return; - GLenum firstCull = frontFirst ? GL_FRONT : GL_BACK; - GLenum secondCull = frontFirst ? GL_BACK : GL_FRONT; - const QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - - // create the VBO if not yet created - if (!m_cubeCapBuffer) { - switch(mode) { - case Cube: - paintCubeCap(); - break; - case Cylinder: - paintCylinderCap(); - break; - case Sphere: - paintSphereCap(); - break; - default: - // impossible - break; - } - } - - QMatrix4x4 capMvp; - QMatrix4x4 capMatrix; - capMatrix.translate(rect.width() / 2, 0.0, zOffset); - capMatrix.rotate((1 - frontDesktop) * 360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0); - capMatrix.translate(0.0, rect.height(), 0.0); - if (mode == Sphere) { - capMatrix.scale(1.0, -1.0, 1.0); - } - - bool capShader = false; - if (effects->compositingType() == OpenGL2Compositing && m_capShader && m_capShader->isValid()) { - capShader = true; - ShaderManager::instance()->pushShader(m_capShader); - float opacity = cubeOpacity; - if (animationState == AnimationState::Start) { - opacity *= timeLine.value(); - } else if (animationState == AnimationState::Stop) { - opacity *= (1.0 - timeLine.value()); - } - m_capShader->setUniform("u_opacity", opacity); - m_capShader->setUniform("u_mirror", 1); - if (reflectionPainting) { - capMvp = projection * m_reflectionMatrix * m_rotationMatrix; - } else { - capMvp = projection * m_rotationMatrix; - } - m_capShader->setUniform(GLShader::ModelViewProjectionMatrix, capMvp * capMatrix); - m_capShader->setUniform("u_untextured", texturedCaps ? 0 : 1); - if (texturedCaps && effects->numberOfDesktops() > 3 && capTexture) { - capTexture->bind(); - } - } - - glEnable(GL_BLEND); - glCullFace(firstCull); - m_cubeCapBuffer->render(GL_TRIANGLES); - - if (mode == Sphere) { - capMatrix.scale(1.0, -1.0, 1.0); - } - capMatrix.translate(0.0, -rect.height(), 0.0); - if (capShader) { - m_capShader->setUniform(GLShader::ModelViewProjectionMatrix, capMvp * capMatrix); - m_capShader->setUniform("u_mirror", 0); - } - glCullFace(secondCull); - m_cubeCapBuffer->render(GL_TRIANGLES); - glDisable(GL_BLEND); - - if (capShader) { - ShaderManager::instance()->popShader(); - if (texturedCaps && effects->numberOfDesktops() > 3 && capTexture) { - capTexture->unbind(); - } - } -} - -void CubeEffect::paintCubeCap() -{ - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 180.0f); - float z = rect.width() / 2 * tan(cubeAngle * 0.5f * M_PI / 180.0f); - float zTexture = rect.width() / 2 * tan(45.0f * M_PI / 180.0f); - float angle = 360.0f / effects->numberOfDesktops(); - bool texture = texturedCaps && effects->numberOfDesktops() > 3 && capTexture; - QVector verts; - QVector texCoords; - for (int i = 0; i < effects->numberOfDesktops(); i++) { - int triangleRows = effects->numberOfDesktops() * 5; - float zTriangleDistance = z / (float)triangleRows; - float widthTriangle = tan(angle * 0.5 * M_PI / 180.0) * zTriangleDistance; - float currentWidth = 0.0; - float cosValue = cos(i * angle * M_PI / 180.0); - float sinValue = sin(i * angle * M_PI / 180.0); - for (int j = 0; j < triangleRows; j++) { - float previousWidth = currentWidth; - currentWidth = tan(angle * 0.5 * M_PI / 180.0) * zTriangleDistance * (j + 1); - int evenTriangles = 0; - int oddTriangles = 0; - for (int k = 0; k < floor(currentWidth / widthTriangle * 2 - 1 + 0.5f); k++) { - float x1 = -previousWidth; - float x2 = -currentWidth; - float x3 = 0.0; - float z1 = 0.0; - float z2 = 0.0; - float z3 = 0.0; - if (k % 2 == 0) { - x1 += evenTriangles * widthTriangle * 2; - x2 += evenTriangles * widthTriangle * 2; - x3 = x2 + widthTriangle * 2; - z1 = j * zTriangleDistance; - z2 = (j + 1) * zTriangleDistance; - z3 = (j + 1) * zTriangleDistance; - float xRot = cosValue * x1 - sinValue * z1; - float zRot = sinValue * x1 + cosValue * z1; - x1 = xRot; - z1 = zRot; - xRot = cosValue * x2 - sinValue * z2; - zRot = sinValue * x2 + cosValue * z2; - x2 = xRot; - z2 = zRot; - xRot = cosValue * x3 - sinValue * z3; - zRot = sinValue * x3 + cosValue * z3; - x3 = xRot; - z3 = zRot; - evenTriangles++; - } else { - x1 += oddTriangles * widthTriangle * 2; - x2 += (oddTriangles + 1) * widthTriangle * 2; - x3 = x1 + widthTriangle * 2; - z1 = j * zTriangleDistance; - z2 = (j + 1) * zTriangleDistance; - z3 = j * zTriangleDistance; - float xRot = cosValue * x1 - sinValue * z1; - float zRot = sinValue * x1 + cosValue * z1; - x1 = xRot; - z1 = zRot; - xRot = cosValue * x2 - sinValue * z2; - zRot = sinValue * x2 + cosValue * z2; - x2 = xRot; - z2 = zRot; - xRot = cosValue * x3 - sinValue * z3; - zRot = sinValue * x3 + cosValue * z3; - x3 = xRot; - z3 = zRot; - oddTriangles++; - } - float texX1 = 0.0; - float texX2 = 0.0; - float texX3 = 0.0; - float texY1 = 0.0; - float texY2 = 0.0; - float texY3 = 0.0; - if (texture) { - if (capTexture->isYInverted()) { - texX1 = x1 / (rect.width()) + 0.5; - texY1 = 0.5 + z1 / zTexture * 0.5; - texX2 = x2 / (rect.width()) + 0.5; - texY2 = 0.5 + z2 / zTexture * 0.5; - texX3 = x3 / (rect.width()) + 0.5; - texY3 = 0.5 + z3 / zTexture * 0.5; - texCoords << texX1 << texY1; - } else { - texX1 = x1 / (rect.width()) + 0.5; - texY1 = 0.5 - z1 / zTexture * 0.5; - texX2 = x2 / (rect.width()) + 0.5; - texY2 = 0.5 - z2 / zTexture * 0.5; - texX3 = x3 / (rect.width()) + 0.5; - texY3 = 0.5 - z3 / zTexture * 0.5; - texCoords << texX1 << texY1; - } - } - verts << x1 << 0.0 << z1; - if (texture) { - texCoords << texX2 << texY2; - } - verts << x2 << 0.0 << z2; - if (texture) { - texCoords << texX3 << texY3; - } - verts << x3 << 0.0 << z3; - } - } - } - delete m_cubeCapBuffer; - m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); - m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : nullptr); -} - -void CubeEffect::paintCylinderCap() -{ - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 180.0f); - - float radian = (cubeAngle * 0.5) * M_PI / 180; - float radius = (rect.width() * 0.5) * tan(radian); - float segment = radius / 30.0f; - - bool texture = texturedCaps && effects->numberOfDesktops() > 3 && capTexture; - QVector verts; - QVector texCoords; - for (int i = 1; i <= 30; i++) { - int steps = 72; - for (int j = 0; j <= steps; j++) { - const float azimuthAngle = (j * (360.0f / steps)) * M_PI / 180.0f; - const float azimuthAngle2 = ((j + 1) * (360.0f / steps)) * M_PI / 180.0f; - const float x1 = segment * (i - 1) * sin(azimuthAngle); - const float x2 = segment * i * sin(azimuthAngle); - const float x3 = segment * (i - 1) * sin(azimuthAngle2); - const float x4 = segment * i * sin(azimuthAngle2); - const float z1 = segment * (i - 1) * cos(azimuthAngle); - const float z2 = segment * i * cos(azimuthAngle); - const float z3 = segment * (i - 1) * cos(azimuthAngle2); - const float z4 = segment * i * cos(azimuthAngle2); - if (texture) { - if (capTexture->isYInverted()) { - texCoords << (radius + x1) / (radius * 2.0f) << (z1 + radius) / (radius * 2.0f); - texCoords << (radius + x2) / (radius * 2.0f) << (z2 + radius) / (radius * 2.0f); - texCoords << (radius + x3) / (radius * 2.0f) << (z3 + radius) / (radius * 2.0f); - texCoords << (radius + x4) / (radius * 2.0f) << (z4 + radius) / (radius * 2.0f); - texCoords << (radius + x3) / (radius * 2.0f) << (z3 + radius) / (radius * 2.0f); - texCoords << (radius + x2) / (radius * 2.0f) << (z2 + radius) / (radius * 2.0f); - } else { - texCoords << (radius + x1) / (radius * 2.0f) << 1.0f - (z1 + radius) / (radius * 2.0f); - texCoords << (radius + x2) / (radius * 2.0f) << 1.0f - (z2 + radius) / (radius * 2.0f); - texCoords << (radius + x3) / (radius * 2.0f) << 1.0f - (z3 + radius) / (radius * 2.0f); - texCoords << (radius + x4) / (radius * 2.0f) << 1.0f - (z4 + radius) / (radius * 2.0f); - texCoords << (radius + x3) / (radius * 2.0f) << 1.0f - (z3 + radius) / (radius * 2.0f); - texCoords << (radius + x2) / (radius * 2.0f) << 1.0f - (z2 + radius) / (radius * 2.0f); - } - } - verts << x1 << 0.0 << z1; - verts << x2 << 0.0 << z2; - verts << x3 << 0.0 << z3; - verts << x4 << 0.0 << z4; - verts << x3 << 0.0 << z3; - verts << x2 << 0.0 << z2; - } - } - delete m_cubeCapBuffer; - m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); - m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : nullptr); -} - -void CubeEffect::paintSphereCap() -{ - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 180.0f); - float zTexture = rect.width() / 2 * tan(45.0f * M_PI / 180.0f); - float radius = (rect.width() * 0.5) / cos(cubeAngle * 0.5 * M_PI / 180.0); - float angle = acos((rect.height() * 0.5) / radius) * 180.0 / M_PI; - angle /= 30; - bool texture = texturedCaps && effects->numberOfDesktops() > 3 && capTexture; - QVector verts; - QVector texCoords; - for (int i = 0; i < 30; i++) { - float topAngle = angle * i * M_PI / 180.0; - float bottomAngle = angle * (i + 1) * M_PI / 180.0; - float yTop = (rect.height() * 0.5 - radius * cos(topAngle)); - yTop *= (1.0f-capDeformationFactor); - float yBottom = rect.height() * 0.5 - radius * cos(bottomAngle); - yBottom *= (1.0f - capDeformationFactor); - for (int j = 0; j < 36; j++) { - const float x1 = radius * sin(topAngle) * sin((90.0 + j * 10.0) * M_PI / 180.0); - const float z1 = radius * sin(topAngle) * cos((90.0 + j * 10.0) * M_PI / 180.0); - const float x2 = radius * sin(bottomAngle) * sin((90.0 + j * 10.0) * M_PI / 180.00); - const float z2 = radius * sin(bottomAngle) * cos((90.0 + j * 10.0) * M_PI / 180.0); - const float x3 = radius * sin(bottomAngle) * sin((90.0 + (j + 1) * 10.0) * M_PI / 180.0); - const float z3 = radius * sin(bottomAngle) * cos((90.0 + (j + 1) * 10.0) * M_PI / 180.0); - const float x4 = radius * sin(topAngle) * sin((90.0 + (j + 1) * 10.0) * M_PI / 180.0); - const float z4 = radius * sin(topAngle) * cos((90.0 + (j + 1) * 10.0) * M_PI / 180.0); - if (texture) { - if (capTexture->isYInverted()) { - texCoords << x4 / (rect.width()) + 0.5 << 0.5 + z4 / zTexture * 0.5; - texCoords << x1 / (rect.width()) + 0.5 << 0.5 + z1 / zTexture * 0.5; - texCoords << x2 / (rect.width()) + 0.5 << 0.5 + z2 / zTexture * 0.5; - texCoords << x2 / (rect.width()) + 0.5 << 0.5 + z2 / zTexture * 0.5; - texCoords << x3 / (rect.width()) + 0.5 << 0.5 + z3 / zTexture * 0.5; - texCoords << x4 / (rect.width()) + 0.5 << 0.5 + z4 / zTexture * 0.5; - } else { - texCoords << x4 / (rect.width()) + 0.5 << 0.5 - z4 / zTexture * 0.5; - texCoords << x1 / (rect.width()) + 0.5 << 0.5 - z1 / zTexture * 0.5; - texCoords << x2 / (rect.width()) + 0.5 << 0.5 - z2 / zTexture * 0.5; - texCoords << x2 / (rect.width()) + 0.5 << 0.5 - z2 / zTexture * 0.5; - texCoords << x3 / (rect.width()) + 0.5 << 0.5 - z3 / zTexture * 0.5; - texCoords << x4 / (rect.width()) + 0.5 << 0.5 - z4 / zTexture * 0.5; - } - } - verts << x4 << yTop << z4; - verts << x1 << yTop << z1; - verts << x2 << yBottom << z2; - verts << x2 << yBottom << z2; - verts << x3 << yBottom << z3; - verts << x4 << yTop << z4; - } - } - delete m_cubeCapBuffer; - m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); - m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : nullptr); -} - -void CubeEffect::postPaintScreen() -{ - effects->postPaintScreen(); - if (!activated) - return; - - bool animation = (animationState != AnimationState::None || verticalAnimationState != VerticalAnimationState::None); - if (animationState != AnimationState::None && timeLine.done()) { - /* An animation have just finished! */ - if (animationState == AnimationState::Stop) { - /* If the stop animation is finished, we're done */ - if (keyboard_grab) - effects->ungrabKeyboard(); - keyboard_grab = false; - effects->stopMouseInterception(this); - effects->setCurrentDesktop(frontDesktop); - effects->setActiveFullScreenEffect(nullptr); - delete m_cubeCapBuffer; - m_cubeCapBuffer = nullptr; - if (desktopNameFrame) - desktopNameFrame->free(); - activated = false; - // User can press Esc several times, and several Stop animations can be added to queue. We don't want it - animationState = AnimationState::None; - animations.clear(); - verticalAnimationState = VerticalAnimationState::None; - verticalAnimations.clear(); - lastPresentTime = std::chrono::milliseconds::zero(); - } else { - if (!animations.empty()) - startAnimation(animations.dequeue()); - else - animationState = AnimationState::None; - } - } - /* Vertical animation have finished */ - if (verticalAnimationState != VerticalAnimationState::None && verticalTimeLine.done()) { - if (!verticalAnimations.empty()) { - startVerticalAnimation(verticalAnimations.dequeue()); - } else { - verticalAnimationState = VerticalAnimationState::None; - } - } - /* Repaint if there is any animation */ - if (animation) { - effects->addRepaintFull(); - } else { - lastPresentTime = std::chrono::milliseconds::zero(); - } -} - -void CubeEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std::chrono::milliseconds presentTime) -{ - if (activated) { - if (cube_painting) { - if (mode == Cylinder || mode == Sphere) { - int leftDesktop = frontDesktop - 1; - int rightDesktop = frontDesktop + 1; - if (leftDesktop == 0) - leftDesktop = effects->numberOfDesktops(); - if (rightDesktop > effects->numberOfDesktops()) - rightDesktop = 1; - if (painting_desktop == frontDesktop) - data.quads = data.quads.makeGrid(40); - else if (painting_desktop == leftDesktop || painting_desktop == rightDesktop) - data.quads = data.quads.makeGrid(100); - else - data.quads = data.quads.makeGrid(250); - } - if (w->isOnDesktop(painting_desktop)) { - QRect rect = effects->clientArea(FullArea, activeScreen, 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()); - } - if (useZOrdering && !w->isDesktop() && !w->isDock() && !w->isOnAllDesktops()) - data.setTransformed(); - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } else { - // check for windows belonging to the previous desktop - int prev_desktop = painting_desktop - 1; - if (prev_desktop == 0) - prev_desktop = effects->numberOfDesktops(); - if (w->isOnDesktop(prev_desktop) && mode == Cube && !useZOrdering) { - QRect rect = effects->clientArea(FullArea, activeScreen, prev_desktop); - if (w->x() + w->width() > rect.x() + rect.width()) { - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - 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()); - } - data.setTransformed(); - effects->prePaintWindow(w, data, presentTime); - return; - } - } - // check for windows belonging to the next desktop - int next_desktop = painting_desktop + 1; - if (next_desktop > effects->numberOfDesktops()) - next_desktop = 1; - if (w->isOnDesktop(next_desktop) && mode == Cube && !useZOrdering) { - QRect rect = effects->clientArea(FullArea, activeScreen, next_desktop); - if (w->x() < rect.x()) { - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - data.quads = data.quads.splitAtX(-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()); - } - data.setTransformed(); - effects->prePaintWindow(w, data, presentTime); - return; - } - } - w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } - } - } - effects->prePaintWindow(w, data, presentTime); -} - -void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) -{ - ShaderManager *shaderManager = ShaderManager::instance(); - if (activated && cube_painting) { - region= infiniteRegion(); // we need to explicitly prevent any clipping, bug #325432 - //qCDebug(KWINEFFECTS) << w->caption(); - float opacity = cubeOpacity; - if (animationState == AnimationState::Start) { - opacity = 1.0 - (1.0 - opacity) * timeLine.value(); - if (reflectionPainting) - opacity = 0.5 + (cubeOpacity - 0.5) * timeLine.value(); - // fade in windows belonging to different desktops - if (painting_desktop == effects->currentDesktop() && (!w->isOnDesktop(painting_desktop))) - opacity = timeLine.value() * cubeOpacity; - } else if (animationState == AnimationState::Stop) { - opacity = 1.0 - (1.0 - opacity) * (1.0 - timeLine.value()); - if (reflectionPainting) - opacity = 0.5 + (cubeOpacity - 0.5) * (1.0 - timeLine.value()); - // fade out windows belonging to different desktops - if (painting_desktop == effects->currentDesktop() && (!w->isOnDesktop(painting_desktop))) - opacity = cubeOpacity * (1.0 - timeLine.value()); - } - // z-Ordering - if (!w->isDesktop() && !w->isDock() && useZOrdering && !w->isOnAllDesktops()) { - float zOrdering = (effects->stackingOrder().indexOf(w) + 1) * zOrderingFactor; - if (animationState == AnimationState::Start) { - zOrdering *= timeLine.value(); - } else if (animationState == AnimationState::Stop) { - zOrdering *= (1.0 - timeLine.value()); - } - data.translate(0.0, 0.0, zOrdering); - } - // check for windows belonging to the previous desktop - int prev_desktop = painting_desktop - 1; - if (prev_desktop == 0) - prev_desktop = effects->numberOfDesktops(); - int next_desktop = painting_desktop + 1; - if (next_desktop > effects->numberOfDesktops()) - next_desktop = 1; - if (w->isOnDesktop(prev_desktop) && (mask & PAINT_WINDOW_TRANSFORMED)) { - QRect rect = effects->clientArea(FullArea, activeScreen, prev_desktop); - 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; - data.setXTranslation(-rect.width()); - } - if (w->isOnDesktop(next_desktop) && (mask & PAINT_WINDOW_TRANSFORMED)) { - QRect rect = effects->clientArea(FullArea, activeScreen, next_desktop); - WindowQuadList new_quads; - Q_FOREACH (const WindowQuad & quad, data.quads) { - if (w->x() + quad.right() <= rect.x()) { - new_quads.append(quad); - } - } - data.quads = new_quads; - data.setXTranslation(rect.width()); - } - QRect rect = effects->clientArea(FullArea, activeScreen, painting_desktop); - - if (animationState == AnimationState::Start || animationState == AnimationState::Stop) { - // we have to change opacity values for fade in/out of windows which are shown on front-desktop - if (prev_desktop == effects->currentDesktop() && w->x() < rect.x()) { - if (animationState == AnimationState::Start) { - opacity = timeLine.value() * cubeOpacity; - } else if (animationState == AnimationState::Stop) { - opacity = cubeOpacity * (1.0 - timeLine.value()); - } - } - if (next_desktop == effects->currentDesktop() && w->x() + w->width() > rect.x() + rect.width()) { - if (animationState == AnimationState::Start) { - opacity = timeLine.value() * cubeOpacity; - } else if (animationState == AnimationState::Stop) { - opacity = cubeOpacity * (1.0 - timeLine.value()); - } - } - } - // HACK set opacity to 0.99 in case of fully opaque to ensure that windows are painted in correct sequence - // bug #173214 - if (opacity > 0.99f) - opacity = 0.99f; - if (opacityDesktopOnly && !w->isDesktop()) - opacity = 0.99f; - data.multiplyOpacity(opacity); - - if (w->isOnDesktop(painting_desktop) && 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->isOnDesktop(painting_desktop) && 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; - } - GLShader *currentShader = nullptr; - if (mode == Cylinder) { - shaderManager->pushShader(cylinderShader); - cylinderShader->setUniform("xCoord", (float)w->x()); - cylinderShader->setUniform("cubeAngle", (effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 90.0f); - float factor = 0.0f; - if (animationState == AnimationState::Start) { - factor = 1.0f - timeLine.value(); - } else if (animationState == AnimationState::Stop) { - factor = timeLine.value(); - } - cylinderShader->setUniform("timeLine", factor); - currentShader = cylinderShader; - } - if (mode == Sphere) { - shaderManager->pushShader(sphereShader); - sphereShader->setUniform("u_offset", QVector2D(w->x(), w->y())); - sphereShader->setUniform("cubeAngle", (effects->numberOfDesktops() - 2) / (float)effects->numberOfDesktops() * 90.0f); - float factor = 0.0f; - if (animationState == AnimationState::Start) { - factor = 1.0f - timeLine.value(); - } else if (animationState == AnimationState::Stop) { - factor = timeLine.value(); - } - sphereShader->setUniform("timeLine", factor); - currentShader = sphereShader; - } - if (currentShader) { - data.shader = currentShader; - } - data.setProjectionMatrix(data.screenProjectionMatrix()); - if (reflectionPainting) { - data.setModelViewMatrix(m_reflectionMatrix * m_rotationMatrix * m_currentFaceMatrix); - } else { - data.setModelViewMatrix(m_rotationMatrix * m_currentFaceMatrix); - } - } - effects->paintWindow(w, mask, region, data); - if (activated && cube_painting) { - if (mode == Cylinder || mode == Sphere) { - shaderManager->popShader(); - } - if (w->isDesktop() && effects->numScreens() > 1 && paintCaps) { - QRect rect = effects->clientArea(FullArea, activeScreen, painting_desktop); - QRegion paint = QRegion(rect); - for (int i = 0; i < effects->numScreens(); i++) { - if (i == w->screen()) - continue; - paint = paint.subtracted(QRegion(effects->clientArea(ScreenArea, i, painting_desktop))); - } - paint = paint.subtracted(QRegion(w->frameGeometry())); - // in case of free area in multiscreen setup fill it with cap color - if (!paint.isEmpty()) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - QVector verts; - float quadSize = 0.0f; - int leftDesktop = frontDesktop - 1; - int rightDesktop = frontDesktop + 1; - if (leftDesktop == 0) - leftDesktop = effects->numberOfDesktops(); - if (rightDesktop > effects->numberOfDesktops()) - rightDesktop = 1; - if (painting_desktop == frontDesktop) - quadSize = 100.0f; - else if (painting_desktop == leftDesktop || painting_desktop == rightDesktop) - quadSize = 150.0f; - else - quadSize = 250.0f; - for (const QRect &paintRect : paint) { - for (int i = 0; i <= (paintRect.height() / quadSize); i++) { - for (int j = 0; j <= (paintRect.width() / quadSize); j++) { - verts << qMin(paintRect.x() + (j + 1)*quadSize, (float)paintRect.x() + paintRect.width()) << paintRect.y() + i*quadSize; - verts << paintRect.x() + j*quadSize << paintRect.y() + i*quadSize; - verts << paintRect.x() + j*quadSize << qMin(paintRect.y() + (i + 1)*quadSize, (float)paintRect.y() + paintRect.height()); - verts << paintRect.x() + j*quadSize << qMin(paintRect.y() + (i + 1)*quadSize, (float)paintRect.y() + paintRect.height()); - verts << qMin(paintRect.x() + (j + 1)*quadSize, (float)paintRect.x() + paintRect.width()) << qMin(paintRect.y() + (i + 1)*quadSize, (float)paintRect.y() + paintRect.height()); - verts << qMin(paintRect.x() + (j + 1)*quadSize, (float)paintRect.x() + paintRect.width()) << paintRect.y() + i*quadSize; - } - } - } - bool capShader = false; - if (effects->compositingType() == OpenGL2Compositing && m_capShader && m_capShader->isValid()) { - capShader = true; - ShaderManager::instance()->pushShader(m_capShader); - m_capShader->setUniform("u_mirror", 0); - m_capShader->setUniform("u_untextured", 1); - QMatrix4x4 mvp = data.screenProjectionMatrix(); - if (reflectionPainting) { - mvp = mvp * m_reflectionMatrix * m_rotationMatrix * m_currentFaceMatrix; - } else { - mvp = mvp * m_rotationMatrix * m_currentFaceMatrix; - } - m_capShader->setUniform(GLShader::ModelViewProjectionMatrix, mvp); - } - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - QColor color = capColor; - capColor.setAlphaF(cubeOpacity); - vbo->setColor(color); - vbo->setData(verts.size() / 2, 2, verts.constData(), nullptr); - if (!capShader || mode == Cube) { - // TODO: use sphere and cylinder shaders - vbo->render(GL_TRIANGLES); - } - if (capShader) { - ShaderManager::instance()->popShader(); - } - glDisable(GL_BLEND); - } - } - } -} - -bool CubeEffect::borderActivated(ElectricBorder border) -{ - if (!borderActivate.contains(border) && - !borderActivateCylinder.contains(border) && - !borderActivateSphere.contains(border)) - return false; - if (effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this) - return false; - if (borderActivate.contains(border)) { - if (!activated || (activated && mode == Cube)) - toggleCube(); - else - return false; - } - if (borderActivateCylinder.contains(border)) { - if (!activated || (activated && mode == Cylinder)) - toggleCylinder(); - else - return false; - } - if (borderActivateSphere.contains(border)) { - if (!activated || (activated && mode == Sphere)) - toggleSphere(); - else - return false; - } - return true; -} - -void CubeEffect::toggleCube() -{ - qCDebug(KWINEFFECTS) << "toggle cube"; - toggle(Cube); -} - -void CubeEffect::toggleCylinder() -{ - qCDebug(KWINEFFECTS) << "toggle cylinder"; - if (!useShaders) - useShaders = loadShader(); - if (useShaders) - toggle(Cylinder); -} - -void CubeEffect::toggleSphere() -{ - qCDebug(KWINEFFECTS) << "toggle sphere"; - if (!useShaders) - useShaders = loadShader(); - if (useShaders) - toggle(Sphere); -} - -void CubeEffect::toggle(CubeMode newMode) -{ - if ((effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this) || - effects->numberOfDesktops() < 2) - return; - if (!activated) { - mode = newMode; - setActive(true); - } else { - setActive(false); - } -} - -void CubeEffect::grabbedKeyboardEvent(QKeyEvent* e) -{ - // If either stop is running or is scheduled - ignore all events - if ((!animations.isEmpty() && animations.last() == AnimationState::Stop) || animationState == AnimationState::Stop) { - return; - } - // taken from desktopgrid.cpp - if (e->type() == QEvent::KeyPress) { - // check for global shortcuts - // HACK: keyboard grab disables the global shortcuts so we have to check for global shortcut (bug 156155) - if (mode == Cube && cubeShortcut.contains(e->key() + e->modifiers())) { - toggleCube(); - return; - } - if (mode == Cylinder && cylinderShortcut.contains(e->key() + e->modifiers())) { - toggleCylinder(); - return; - } - if (mode == Sphere && sphereShortcut.contains(e->key() + e->modifiers())) { - toggleSphere(); - return; - } - - int desktop = -1; - // switch by F or just - if (e->key() >= Qt::Key_F1 && e->key() <= Qt::Key_F35) - desktop = e->key() - Qt::Key_F1 + 1; - else if (e->key() >= Qt::Key_0 && e->key() <= Qt::Key_9) - desktop = e->key() == Qt::Key_0 ? 10 : e->key() - Qt::Key_0; - if (desktop != -1) { - if (desktop <= effects->numberOfDesktops()) { - // we have to rotate to chosen desktop - // and end effect when rotation finished - rotateToDesktop(desktop); - setActive(false); - } - return; - } - - int key = e->key(); - if (invertKeys) { - if (key == Qt::Key_Left) - key = Qt::Key_Right; - else if (key == Qt::Key_Right) - key = Qt::Key_Left; - else if (key == Qt::Key_Up) - key = Qt::Key_Down; - else if (key == Qt::Key_Down) - key = Qt::Key_Up; - } - - switch(key) { - // wrap only on autorepeat - case Qt::Key_Left: - qCDebug(KWINEFFECTS) << "left"; - if (animations.count() < effects->numberOfDesktops()) - animations.enqueue(AnimationState::Left); - break; - case Qt::Key_Right: - qCDebug(KWINEFFECTS) << "right"; - if (animations.count() < effects->numberOfDesktops()) - animations.enqueue(AnimationState::Right); - break; - case Qt::Key_Up: - qCDebug(KWINEFFECTS) << "up"; - verticalAnimations.enqueue(VerticalAnimationState::Upwards); - break; - case Qt::Key_Down: - qCDebug(KWINEFFECTS) << "down"; - verticalAnimations.enqueue(VerticalAnimationState::Downwards); - break; - case Qt::Key_Escape: - rotateToDesktop(effects->currentDesktop()); - setActive(false); - return; - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_Space: - setActive(false); - return; - case Qt::Key_Plus: - case Qt::Key_Equal: - zoom -= 10.0; - zoom = qMax(-zPosition, zoom); - rotateCube(); - break; - case Qt::Key_Minus: - zoom += 10.0f; - rotateCube(); - break; - default: - break; - } - } - effects->addRepaintFull(); -} - -void CubeEffect::rotateToDesktop(int desktop) -{ - // all scheduled animations will be removed as a speed up - animations.clear(); - verticalAnimations.clear(); - // we want only startAnimation to finish gracefully - // all the others can be interrupted - if (animationState != AnimationState::Start) { - animationState = AnimationState::None; - } - verticalAnimationState = VerticalAnimationState::None; - // find the fastest rotation path from frontDesktop to desktop - int rightRotations = frontDesktop - desktop; - if (rightRotations < 0) { - rightRotations += effects->numberOfDesktops(); - } - int leftRotations = desktop - frontDesktop; - if (leftRotations < 0) { - leftRotations += effects->numberOfDesktops(); - } - if (leftRotations <= rightRotations) { - for (int i = 0; i < leftRotations; i++) { - animations.enqueue(AnimationState::Left); - } - } else { - for (int i = 0; i < rightRotations; i++) { - animations.enqueue(AnimationState::Right); - } - } - // we want the face of desktop to appear, it might need also vertical animation - if (verticalCurrentAngle > 0.0f) { - verticalAnimations.enqueue(VerticalAnimationState::Downwards); - } - if (verticalCurrentAngle < 0.0f) { - verticalAnimations.enqueue(VerticalAnimationState::Upwards); - } - /* Start immediately, so there is no pause: - * during that pause, actual frontDesktop might change - * if user moves his mouse fast, leading to incorrect desktop */ - if (animationState == AnimationState::None && !animations.empty()) { - startAnimation(animations.dequeue()); - } - if (verticalAnimationState == VerticalAnimationState::None && !verticalAnimations.empty()) { - startVerticalAnimation(verticalAnimations.dequeue()); - } -} - -void CubeEffect::setActive(bool active) -{ - Q_FOREACH (CubeInsideEffect * inside, m_cubeInsideEffects) { - inside->setActive(true); - } - if (active) { - QString capPath = CubeConfig::capPath(); - if (texturedCaps && !capTexture && !capPath.isEmpty()) { - QFutureWatcher *watcher = new QFutureWatcher(this); - connect(watcher, &QFutureWatcher::finished, this, &CubeEffect::slotCubeCapLoaded); - watcher->setFuture(QtConcurrent::run(this, &CubeEffect::loadCubeCap, capPath)); - } - QString wallpaperPath = CubeConfig::wallpaper().toLocalFile(); - if (!wallpaper && !wallpaperPath.isEmpty()) { - QFutureWatcher *watcher = new QFutureWatcher(this); - connect(watcher, &QFutureWatcher::finished, this, &CubeEffect::slotWallPaperLoaded); - watcher->setFuture(QtConcurrent::run(this, &CubeEffect::loadWallPaper, wallpaperPath)); - } - activated = true; - activeScreen = effects->activeScreen(); - keyboard_grab = effects->grabKeyboard(this); - effects->startMouseInterception(this, Qt::OpenHandCursor); - frontDesktop = effects->currentDesktop(); - zoom = 0.0; - zOrderingFactor = zPosition / (effects->stackingOrder().count() - 1); - animations.enqueue(AnimationState::Start); - animationState = AnimationState::None; - verticalAnimationState = VerticalAnimationState::None; - effects->setActiveFullScreenEffect(this); - qCDebug(KWINEFFECTS) << "Cube is activated"; - currentAngle = 0.0; - verticalCurrentAngle = 0.0; - if (reflection) { - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - float temporaryCoeff = float(rect.width()) / tan(M_PI / float(effects->numberOfDesktops())); - mAddedHeightCoeff1 = sqrt(float(rect.height()) * float(rect.height()) + temporaryCoeff * temporaryCoeff); - mAddedHeightCoeff2 = sqrt(float(rect.height()) * float(rect.height()) + float(rect.width()) * float(rect.width()) + temporaryCoeff * temporaryCoeff); - } - m_rotationMatrix.setToIdentity(); - } else { - animations.enqueue(AnimationState::Stop); - } - effects->addRepaintFull(); -} - -void CubeEffect::windowInputMouseEvent(QEvent* e) -{ - if (!activated) - return; - if (tabBoxMode) - return; - if ((!animations.isEmpty() && animations.last() == AnimationState::Stop) || animationState == AnimationState::Stop) - return; - - QMouseEvent *mouse = dynamic_cast< QMouseEvent* >(e); - if (!mouse) - return; - - static QPoint oldpos; - static QElapsedTimer dblClckTime; - static int dblClckCounter(0); - if (mouse->type() == QEvent::MouseMove && mouse->buttons().testFlag(Qt::LeftButton)) { - const QPoint pos = mouse->pos(); - QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); - bool repaint = false; - // vertical movement only if there is not a rotation - if (verticalAnimationState == VerticalAnimationState::None) { - // display height corresponds to 180* - int deltaY = pos.y() - oldpos.y(); - float deltaVerticalDegrees = (float)deltaY / rect.height() * 180.0f; - if (invertMouse) - verticalCurrentAngle += deltaVerticalDegrees; - else - verticalCurrentAngle -= deltaVerticalDegrees; - // don't get too excited - verticalCurrentAngle = qBound(-90.0f, verticalCurrentAngle, 90.0f); - - if (deltaVerticalDegrees != 0.0) - repaint = true; - } - // horizontal movement only if there is not a rotation - if (animationState == AnimationState::None) { - // display width corresponds to sum of angles of the polyhedron - int deltaX = oldpos.x() - pos.x(); - float deltaDegrees = (float)deltaX / rect.width() * 360.0f; - if (deltaX == 0) { - if (pos.x() == 0) - deltaDegrees = 5.0f; - if (pos.x() == rect.width() - 1) - deltaDegrees = -5.0f; - } - if (invertMouse) - currentAngle += deltaDegrees; - else - currentAngle -= deltaDegrees; - if (deltaDegrees != 0.0) - repaint = true; - } - if (repaint) { - rotateCube(); - effects->addRepaintFull(); - } - oldpos = pos; - } - - else if (mouse->type() == QEvent::MouseButtonPress && mouse->button() == Qt::LeftButton) { - oldpos = mouse->pos(); - if (dblClckTime.elapsed() > QApplication::doubleClickInterval()) - dblClckCounter = 0; - if (!dblClckCounter) - dblClckTime.start(); - } - - else if (mouse->type() == QEvent::MouseButtonRelease) { - effects->defineCursor(Qt::OpenHandCursor); - if (mouse->button() == Qt::LeftButton && ++dblClckCounter == 2) { - dblClckCounter = 0; - if (dblClckTime.elapsed() < QApplication::doubleClickInterval()) { - setActive(false); - return; - } - } - else if (mouse->button() == Qt::XButton1) { - if (animations.count() < effects->numberOfDesktops()) { - if (invertMouse) - animations.enqueue(AnimationState::Right); - else - animations.enqueue(AnimationState::Left); - } - effects->addRepaintFull(); - } else if (mouse->button() == Qt::XButton2) { - if (animations.count() < effects->numberOfDesktops()) { - if (invertMouse) - animations.enqueue(AnimationState::Left); - else - animations.enqueue(AnimationState::Right); - } - effects->addRepaintFull(); - } else if (mouse->button() == Qt::RightButton || (mouse->button() == Qt::LeftButton && closeOnMouseRelease)) { - setActive(false); - } - } -} - -void CubeEffect::slotTabBoxAdded(int mode) -{ - if (activated) - return; - if (effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this) - return; - if (useForTabBox && mode == TabBoxDesktopListMode) { - effects->refTabBox(); - tabBoxMode = true; - setActive(true); - rotateToDesktop(effects->currentTabBoxDesktop()); - } -} - -void CubeEffect::slotTabBoxUpdated() -{ - if (activated) { - rotateToDesktop(effects->currentTabBoxDesktop()); - effects->addRepaintFull(); - } -} - -void CubeEffect::slotTabBoxClosed() -{ - if (activated) { - effects->unrefTabBox(); - tabBoxMode = false; - setActive(false); - } -} - -void CubeEffect::globalShortcutChanged(QAction *action, const QKeySequence &seq) -{ - if (action->objectName() == QStringLiteral("Cube")) { - cubeShortcut.clear(); - cubeShortcut.append(seq); - } else if (action->objectName() == QStringLiteral("Cylinder")) { - cylinderShortcut.clear(); - cylinderShortcut.append(seq); - } else if (action->objectName() == QStringLiteral("Sphere")) { - sphereShortcut.clear(); - sphereShortcut.append(seq); - } -} - -void* CubeEffect::proxy() -{ - return &m_proxy; -} - -void CubeEffect::registerCubeInsideEffect(CubeInsideEffect* effect) -{ - m_cubeInsideEffects.append(effect); -} - -void CubeEffect::unregisterCubeInsideEffect(CubeInsideEffect* effect) -{ - m_cubeInsideEffects.removeAll(effect); -} - -bool CubeEffect::isActive() const -{ - return activated && !effects->isScreenLocked(); -} - -} // namespace diff --git a/src/effects/cube/cube.h b/src/effects/cube/cube.h deleted file mode 100644 index 5388bc3d3b..0000000000 --- a/src/effects/cube/cube.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#ifndef KWIN_CUBE_H -#define KWIN_CUBE_H - -#include -#include -#include -#include -#include -#include -#include "cube_inside.h" -#include "cube_proxy.h" - -namespace KWin -{ - -class CubeEffect - : public Effect -{ - Q_OBJECT - Q_PROPERTY(qreal cubeOpacity READ configuredCubeOpacity) - Q_PROPERTY(bool opacityDesktopOnly READ isOpacityDesktopOnly) - Q_PROPERTY(bool displayDesktopName READ isDisplayDesktopName) - Q_PROPERTY(bool reflection READ isReflection) - Q_PROPERTY(int rotationDuration READ configuredRotationDuration) - Q_PROPERTY(QColor backgroundColor READ configuredBackgroundColor) - Q_PROPERTY(QColor capColor READ configuredCapColor) - Q_PROPERTY(bool paintCaps READ isPaintCaps) - Q_PROPERTY(bool closeOnMouseRelease READ isCloseOnMouseRelease) - Q_PROPERTY(qreal zPosition READ configuredZPosition) - Q_PROPERTY(bool useForTabBox READ isUseForTabBox) - Q_PROPERTY(bool invertKeys READ isInvertKeys) - Q_PROPERTY(bool invertMouse READ isInvertMouse) - Q_PROPERTY(qreal capDeformationFactor READ configuredCapDeformationFactor) - Q_PROPERTY(bool useZOrdering READ isUseZOrdering) - Q_PROPERTY(bool texturedCaps READ isTexturedCaps) - // TODO: electric borders: not a registered type -public: - CubeEffect(); - ~CubeEffect() 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 borderActivated(ElectricBorder border) override; - void grabbedKeyboardEvent(QKeyEvent* e) override; - void windowInputMouseEvent(QEvent* e) override; - bool isActive() const override; - - int requestedEffectChainPosition() const override { - return 50; - } - - // proxy functions - void* proxy() override; - void registerCubeInsideEffect(CubeInsideEffect* effect); - void unregisterCubeInsideEffect(CubeInsideEffect* effect); - - static bool supported(); - - // for properties - qreal configuredCubeOpacity() const { - return cubeOpacity; - } - bool isOpacityDesktopOnly() const { - return opacityDesktopOnly; - } - bool isDisplayDesktopName() const { - return displayDesktopName; - } - bool isReflection() const { - return reflection; - } - int configuredRotationDuration() const { - return rotationDuration.count(); - } - QColor configuredBackgroundColor() const { - return backgroundColor; - } - QColor configuredCapColor() const { - return capColor; - } - bool isPaintCaps() const { - return paintCaps; - } - bool isCloseOnMouseRelease() const { - return closeOnMouseRelease; - } - qreal configuredZPosition() const { - return zPosition; - } - bool isUseForTabBox() const { - return useForTabBox; - } - bool isInvertKeys() const { - return invertKeys; - } - bool isInvertMouse() const { - return invertMouse; - } - qreal configuredCapDeformationFactor() const { - return capDeformationFactor; - } - bool isUseZOrdering() const { - return useZOrdering; - } - bool isTexturedCaps() const { - return texturedCaps; - } -private Q_SLOTS: - void toggleCube(); - void toggleCylinder(); - void toggleSphere(); - // slots for global shortcut changed - // needed to toggle the effect - void globalShortcutChanged(QAction *action, const QKeySequence &seq); - void slotTabBoxAdded(int mode); - void slotTabBoxUpdated(); - void slotTabBoxClosed(); - void slotCubeCapLoaded(); - void slotWallPaperLoaded(); -private: - enum class AnimationState { - None, - Start, - Stop, - Left, - Right - }; - enum class VerticalAnimationState { - None, - Upwards, - Downwards - }; - enum CubeMode { - Cube, - Cylinder, - Sphere - }; - void toggle(CubeMode newMode = Cube); - void paintCube(int mask, QRegion region, ScreenPaintData& data); - void paintCap(bool frontFirst, float zOffset, const QMatrix4x4 &projection); - void paintCubeCap(); - void paintCylinderCap(); - void paintSphereCap(); - bool loadShader(); - void rotateCube(); - void rotateToDesktop(int desktop); - void setActive(bool active); - QImage loadCubeCap(const QString &capPath); - QImage loadWallPaper(const QString &file); - void startAnimation(AnimationState state); - void startVerticalAnimation(VerticalAnimationState state); - - bool activated; - bool cube_painting; - bool keyboard_grab; - bool schedule_close; - QList borderActivate; - QList borderActivateCylinder; - QList borderActivateSphere; - int painting_desktop; - int frontDesktop; - float cubeOpacity; - bool opacityDesktopOnly; - bool displayDesktopName; - EffectFrame* desktopNameFrame; - QFont desktopNameFont; - bool reflection; - bool rotating; - bool verticalRotating; - bool desktopChangedWhileRotating; - bool paintCaps; - QColor backgroundColor; - QColor capColor; - GLTexture* wallpaper; - bool texturedCaps; - GLTexture* capTexture; - // animations - // Horizontal/start/stop - float startAngle; - float currentAngle; - int startFrontDesktop; - AnimationState animationState; - TimeLine timeLine; - QQueue animations; - // vertical - float verticalStartAngle; - float verticalCurrentAngle; - VerticalAnimationState verticalAnimationState; - TimeLine verticalTimeLine; - QQueue verticalAnimations; - std::chrono::milliseconds lastPresentTime; - - bool reflectionPainting; - std::chrono::milliseconds rotationDuration; - int activeScreen; - bool bottomCap; - bool closeOnMouseRelease; - float zoom; - float zPosition; - bool useForTabBox; - bool invertKeys; - bool invertMouse; - bool tabBoxMode; - bool shortcutsRegistered; - CubeMode mode; - bool useShaders; - GLShader* cylinderShader; - GLShader* sphereShader; - GLShader* m_reflectionShader; - GLShader* m_capShader; - float capDeformationFactor; - bool useZOrdering; - float zOrderingFactor; - bool useList; - // needed for reflection - float mAddedHeightCoeff1; - float mAddedHeightCoeff2; - - QMatrix4x4 m_rotationMatrix; - QMatrix4x4 m_reflectionMatrix; - QMatrix4x4 m_textureMirrorMatrix; - QMatrix4x4 m_currentFaceMatrix; - GLVertexBuffer *m_cubeCapBuffer; - - // Shortcuts - needed to toggle the effect - QList cubeShortcut; - QList cylinderShortcut; - QList sphereShortcut; - - // proxy - CubeEffectProxy m_proxy; - QList< CubeInsideEffect* > m_cubeInsideEffects; - - QAction *m_cubeAction; - QAction *m_cylinderAction; - QAction *m_sphereAction; -}; - -} // namespace - -#endif diff --git a/src/effects/cube/cube.kcfg b/src/effects/cube/cube.kcfg deleted file mode 100644 index ee9c5ec05a..0000000000 --- a/src/effects/cube/cube.kcfg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - 0 - - - 80 - - - false - - - true - - - true - - - QColor(Qt::black) - - - QColor(KColorScheme(QPalette::Active, KColorScheme::Window).background().color()) - - - QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("cubecap.png")) - - - true - - - true - - - false - - - false - - - 100 - - - - 0 - - - false - - - false - - - false - - - diff --git a/src/effects/cube/cube_config.cpp b/src/effects/cube/cube_config.cpp deleted file mode 100644 index 62ad11b7bc..0000000000 --- a/src/effects/cube/cube_config.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#include "cube_config.h" -// KConfigSkeleton -#include "cubeconfig.h" -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -K_PLUGIN_FACTORY_WITH_JSON(CubeEffectConfigFactory, - "cube_config.json", - registerPlugin();) - -namespace KWin -{ - -CubeEffectConfigForm::CubeEffectConfigForm(QWidget* parent) : QWidget(parent) -{ - setupUi(this); -} - -CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : - KCModule(parent, args) -{ - m_ui = new CubeEffectConfigForm(this); - - QVBoxLayout* layout = new QVBoxLayout(this); - - layout->addWidget(m_ui); - - m_ui->tabWidget->setTabText(0, i18nc("@title:tab Basic Settings", "Basic")); - m_ui->tabWidget->setTabText(1, i18nc("@title:tab Advanced Settings", "Advanced")); - - // Shortcut config. The shortcut belongs to the component "kwin"! - m_actionCollection = new KActionCollection(this, QStringLiteral("kwin")); - m_actionCollection->setComponentDisplayName(i18n("KWin")); - - m_actionCollection->setConfigGroup(QStringLiteral("Cube")); - m_actionCollection->setConfigGlobal(true); - - QAction* cubeAction = m_actionCollection->addAction(QStringLiteral("Cube")); - cubeAction->setText(i18n("Desktop Cube")); - cubeAction->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); - KGlobalAccel::self()->setShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); - QAction* cylinderAction = m_actionCollection->addAction(QStringLiteral("Cylinder")); - cylinderAction->setText(i18n("Desktop Cylinder")); - cylinderAction->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setShortcut(cylinderAction, QList()); - QAction* sphereAction = m_actionCollection->addAction(QStringLiteral("Sphere")); - sphereAction->setText(i18n("Desktop Sphere")); - sphereAction->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setShortcut(sphereAction, QList()); - - m_ui->editor->addCollection(m_actionCollection); - - capsSelectionChanged(); - connect(m_ui->kcfg_Caps, &QCheckBox::stateChanged, this, &CubeEffectConfig::capsSelectionChanged); - m_ui->kcfg_Wallpaper->setFilter(QStringLiteral("*.png *.jpeg *.jpg ")); - CubeConfig::instance(KWIN_CONFIG); - addConfig(CubeConfig::self(), m_ui); - load(); -} - -void CubeEffectConfig::save() -{ - KCModule::save(); - m_ui->editor->save(); - OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), - QStringLiteral("/Effects"), - QDBusConnection::sessionBus()); - interface.reconfigureEffect(QStringLiteral("cube")); -} - -void CubeEffectConfig::capsSelectionChanged() -{ - if (m_ui->kcfg_Caps->checkState() == Qt::Checked) { - // activate cap color - m_ui->kcfg_CapColor->setEnabled(true); - m_ui->capColorLabel->setEnabled(true); - m_ui->kcfg_TexturedCaps->setEnabled(true); - } else { - // deactivate cap color - m_ui->kcfg_CapColor->setEnabled(false); - m_ui->capColorLabel->setEnabled(false); - m_ui->kcfg_TexturedCaps->setEnabled(false); - } -} - -} // namespace - -#include "cube_config.moc" diff --git a/src/effects/cube/cube_config.desktop b/src/effects/cube/cube_config.desktop deleted file mode 100644 index 09e6d5453e..0000000000 --- a/src/effects/cube/cube_config.desktop +++ /dev/null @@ -1,83 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kwin_cube_config -X-KDE-ParentComponents=cube - -Name=Desktop Cube -Name[ar]=سطح مكتب مكعّب -Name[az]=İş Masası kubu -Name[be@latin]=Rabočy kub -Name[bg]=Кубичен работен плот -Name[bn]=ডেস্কটপ কিউব -Name[bs]=Kocka površi -Name[ca]=Cub de l'escriptori -Name[ca@valencia]=Cub d'escriptori -Name[cs]=Plochy na kostce -Name[csb]=Szescan pùltu -Name[da]=Skrivebordsterning -Name[de]=Arbeitsflächen-Würfel -Name[el]=Κύβος επιφάνειας εργασίας -Name[en_GB]=Desktop Cube -Name[eo]=Labortabla Kubo -Name[es]=Cubo de escritorio -Name[et]=Töölauakuubik -Name[eu]=Mahaigain kuboa -Name[fi]=Työpöytäkuutio -Name[fr]=Bureau en cube -Name[fy]=Buroblêdkubus -Name[ga]=Ciúb Deisce -Name[gl]=Cubo do escritorio -Name[gu]=ડેસ્કટોપ ટ્યુબ -Name[he]=שולחן עבודה בקובייה -Name[hi]=डेस्कटॉप घन -Name[hne]=डेस्कटाप घन -Name[hr]=Radna površina na kocki -Name[hsb]=Kóstka -Name[hu]=Asztalkocka -Name[ia]=Cubo de scriptorio -Name[id]=Kubus Desktop -Name[is]=Skjáborðskubbur -Name[it]=Cubo dei desktop -Name[ja]=デスクトップキューブ -Name[kk]=Үстел текшесі -Name[km]=គូប​ផ្ទៃតុ​ -Name[kn]=ಗಣಕತೆರೆ ಘನಾಕೃತಿ -Name[ko]=데스크톱 큐브 -Name[ku]=Sermaseya Mîkap -Name[lt]=Darbalaukio kubas -Name[lv]=Darbvirsmas kubs -Name[mai]=डेस्कटाप घन -Name[mk]=Работна коцка -Name[ml]=പണിയിടം ക്യൂബ് -Name[mr]=डेस्कटॉप क्यूब -Name[nb]=Skrivebordsterning -Name[nds]=Wörpel-Schriefdisch -Name[nl]=Bureaubladkubus -Name[nn]=Skrivebordskube -Name[pa]=ਡੈਸਕਟਾਪ ਘਣ -Name[pl]=Sześcian pulpitu -Name[pt]=Cubo de Ecrãs -Name[pt_BR]=Cubo de áreas de trabalho -Name[ro]=Cub de birou -Name[ru]=Куб рабочих столов -Name[si]=වැඩතල ඝනකය -Name[sk]=Plochy na kocke -Name[sl]=Kocka z namizji -Name[sr]=Коцка површи -Name[sr@ijekavian]=Коцка површи -Name[sr@ijekavianlatin]=Kocka površi -Name[sr@latin]=Kocka površi -Name[sv]=Skrivbordskub -Name[ta]=பணிமேசை க்யூப் -Name[te]=‍డెస్‍క్ టాప్ క్యూబ్ -Name[th]=พื้นที่ทำงานทรงลูกบาศก์ -Name[tr]=Masaüstü Küpü -Name[ug]=ئۈستەلئۈستى كۈپى -Name[uk]=Куб стільниць -Name[vi]=Khối vuông màn hình -Name[wa]=Cube di scribannes -Name[x-test]=xxDesktop Cubexx -Name[zh_CN]=3D 虚拟桌面切换 -Name[zh_TW]=桌面立方體 diff --git a/src/effects/cube/cube_config.h b/src/effects/cube/cube_config.h deleted file mode 100644 index 5bc13f69a2..0000000000 --- a/src/effects/cube/cube_config.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#ifndef KWIN_CUBE_CONFIG_H -#define KWIN_CUBE_CONFIG_H - -#include - -#include "ui_cube_config.h" - - -namespace KWin -{ - -class CubeEffectConfigForm : public QWidget, public Ui::CubeEffectConfigForm -{ - Q_OBJECT -public: - explicit CubeEffectConfigForm(QWidget* parent); -}; - -class CubeEffectConfig : public KCModule -{ - Q_OBJECT -public: - explicit CubeEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); - -public Q_SLOTS: - void save() override; - -private Q_SLOTS: - void capsSelectionChanged(); -private: - CubeEffectConfigForm* m_ui; - KActionCollection* m_actionCollection; -}; - -} // namespace - -#endif diff --git a/src/effects/cube/cube_config.ui b/src/effects/cube/cube_config.ui deleted file mode 100644 index ec79f1c59d..0000000000 --- a/src/effects/cube/cube_config.ui +++ /dev/null @@ -1,569 +0,0 @@ - - - KWin::CubeEffectConfigForm - - - - 0 - 0 - 747 - 566 - - - - - - - 0 - - - - Tab 1 - - - - - - Background - - - - - - Background color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_BackgroundColor - - - - - - - - 0 - 0 - - - - - - - - Wallpaper: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_Wallpaper - - - - - - - - 0 - 0 - - - - - - - - - - - Activation - - - - - - - 0 - 200 - - - - KShortcutsEditor::GlobalAction - - - - - - - - - - Appearance - - - - - - Display desktop name - - - - - - - Reflection - - - - - - - Rotation duration: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_RotationDuration - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - Default - - - 5000 - - - 10 - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Windows hover above cube - - - - - - - - - - Opacity - - - - - - - 200 - 0 - - - - 100 - - - 1 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 10 - - - - - - - - 75 - 0 - - - - % - - - 100 - - - 100 - - - - - - - Transparent - - - - - - - Opaque - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Do not change opacity of windows - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Tab 2 - - - - - - Caps - - - - - - Show caps - - - - - - - Cap color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_CapColor - - - - - - - - 0 - 0 - - - - - - - - Display image on caps - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Zoom - - - - - - Near - - - - - - - Far - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Define how far away the object should appear - - - 3000 - - - 10 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 100 - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Additional Options - - - - - - If enabled the effect will be deactivated after rotating the cube with the mouse, -otherwise it will remain active - - - Close after mouse dragging - - - - - - - Use this effect for walking through the desktops - - - - - - - Invert cursor keys - - - - - - - Invert mouse - - - - - - - - - - Sphere Cap Deformation - - - - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 25 - - - - - - - Sphere - - - - - - - Plane - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - KColorButton - QPushButton -
kcolorbutton.h
-
- - KUrlRequester - QFrame -
kurlrequester.h
- 1 -
- - KShortcutsEditor - QWidget -
KShortcutsEditor
- 1 -
-
- - tabWidget - kcfg_DisplayDesktopName - kcfg_Reflection - kcfg_ZOrdering - kcfg_RotationDuration - kcfg_Opacity - kcfg_OpacitySpin - kcfg_OpacityDesktopOnly - kcfg_BackgroundColor - kcfg_Wallpaper - kcfg_Caps - kcfg_CapColor - kcfg_TexturedCaps - kcfg_CloseOnMouseRelease - kcfg_TabBox - kcfg_InvertKeys - kcfg_InvertMouse - kcfg_ZPosition - kcfg_CapDeformation - - - - - kcfg_OpacitySpin - valueChanged(int) - kcfg_Opacity - setValue(int) - - - 727 - 85 - - - 611 - 88 - - - - - kcfg_Opacity - valueChanged(int) - kcfg_OpacitySpin - setValue(int) - - - 611 - 88 - - - 727 - 85 - - - - -
diff --git a/src/effects/cube/cube_inside.h b/src/effects/cube/cube_inside.h deleted file mode 100644 index fe96ab7183..0000000000 --- a/src/effects/cube/cube_inside.h +++ /dev/null @@ -1,29 +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_CUBE_INSIDE_H -#define KWIN_CUBE_INSIDE_H -#include - -namespace KWin -{ - -class CubeInsideEffect : public Effect -{ -public: - CubeInsideEffect() {} - ~CubeInsideEffect() override {} - - virtual void paint() = 0; - virtual void setActive(bool active) = 0; -}; - -} // namespace - -#endif // KWIN_CUBE_INSIDE_H diff --git a/src/effects/cube/cube_proxy.cpp b/src/effects/cube/cube_proxy.cpp deleted file mode 100644 index d9221b3125..0000000000 --- a/src/effects/cube/cube_proxy.cpp +++ /dev/null @@ -1,36 +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 "cube_proxy.h" -#include "cube.h" -#include "cube_inside.h" - -namespace KWin -{ - -CubeEffectProxy::CubeEffectProxy(CubeEffect* effect) - : m_effect(effect) -{ -} - -CubeEffectProxy::~CubeEffectProxy() -{ -} - -void CubeEffectProxy::registerCubeInsideEffect(CubeInsideEffect* effect) -{ - m_effect->registerCubeInsideEffect(effect); -} - -void CubeEffectProxy::unregisterCubeInsideEffect(CubeInsideEffect* effect) -{ - m_effect->unregisterCubeInsideEffect(effect); -} - -} // namespace diff --git a/src/effects/cube/cube_proxy.h b/src/effects/cube/cube_proxy.h deleted file mode 100644 index 8084701502..0000000000 --- a/src/effects/cube/cube_proxy.h +++ /dev/null @@ -1,34 +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_CUBE_PROXY_H -#define KWIN_CUBE_PROXY_H - -namespace KWin -{ - -class CubeEffect; -class CubeInsideEffect; - -class CubeEffectProxy -{ -public: - explicit CubeEffectProxy(CubeEffect* effect); - ~CubeEffectProxy(); - - void registerCubeInsideEffect(CubeInsideEffect* effect); - void unregisterCubeInsideEffect(CubeInsideEffect* effect); - -private: - CubeEffect* m_effect; -}; - -} // namespace - -#endif // KWIN_CUBE_PROXY_H diff --git a/src/effects/cube/cubeconfig.kcfgc b/src/effects/cube/cubeconfig.kcfgc deleted file mode 100644 index 4ee0f80307..0000000000 --- a/src/effects/cube/cubeconfig.kcfgc +++ /dev/null @@ -1,6 +0,0 @@ -File=cube.kcfg -ClassName=CubeConfig -NameSpace=KWin -Singleton=true -Mutators=true -IncludeFiles=kcolorscheme.h diff --git a/src/effects/cube/data/1.10/cube-cap.glsl b/src/effects/cube/data/1.10/cube-cap.glsl deleted file mode 100644 index 818905460d..0000000000 --- a/src/effects/cube/data/1.10/cube-cap.glsl +++ /dev/null @@ -1,29 +0,0 @@ -uniform sampler2D sampler; -uniform vec4 geometryColor; -uniform float u_opacity; -uniform int u_mirror; -uniform int u_untextured; - -varying vec2 texcoord0; - -vec2 mirrorTex(vec2 coords) { - vec2 mirrored = coords; - if (u_mirror != 0) { - mirrored.t = mirrored.t * (-1.0) + 1.0; - } - return mirrored; -} - -void main() { - vec4 color = geometryColor; - vec2 texCoord = mirrorTex(texcoord0); - vec4 tex = texture2D(sampler, texCoord); - if (texCoord.s < 0.0 || texCoord.s > 1.0 || - texCoord.t < 0.0 || texCoord.t > 1.0 || u_untextured != 0) { - tex = geometryColor; - } - color.rgb = tex.rgb*tex.a + color.rgb*(1.0-tex.a); - color.a = u_opacity; - - gl_FragColor = color; -} diff --git a/src/effects/cube/data/1.10/cube-reflection.glsl b/src/effects/cube/data/1.10/cube-reflection.glsl deleted file mode 100644 index d9335a2ce9..0000000000 --- a/src/effects/cube/data/1.10/cube-reflection.glsl +++ /dev/null @@ -1,8 +0,0 @@ -uniform float u_alpha; - -varying vec2 texcoord0; - -void main() -{ - gl_FragColor = vec4(0.0, 0.0, 0.0, u_alpha*texcoord0.s); -} diff --git a/src/effects/cube/data/1.10/cylinder.vert b/src/effects/cube/data/1.10/cylinder.vert deleted file mode 100644 index eeb250da86..0000000000 --- a/src/effects/cube/data/1.10/cylinder.vert +++ /dev/null @@ -1,35 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008, 2011 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -uniform mat4 modelViewProjectionMatrix; -uniform float width; -uniform float cubeAngle; -uniform float xCoord; -uniform float timeLine; - -attribute vec4 position; -attribute vec4 texcoord; - -varying vec2 texcoord0; - -void main() -{ - texcoord0 = texcoord.st; - vec4 transformedVertex = vec4(position.x - ( width - xCoord ), position.yzw); - float radian = radians(cubeAngle); - float radius = (width)*tan(radian); - float azimuthAngle = radians(transformedVertex.x/(width)*(90.0 - cubeAngle)); - - transformedVertex.x = width - xCoord + radius * sin( azimuthAngle ); - transformedVertex.z = position.z + radius * cos( azimuthAngle ) - radius; - - vec3 diff = (position.xyz - transformedVertex.xyz)*timeLine; - transformedVertex.xyz += diff; - - gl_Position = modelViewProjectionMatrix*transformedVertex; -} diff --git a/src/effects/cube/data/1.10/sphere.vert b/src/effects/cube/data/1.10/sphere.vert deleted file mode 100644 index 844044423e..0000000000 --- a/src/effects/cube/data/1.10/sphere.vert +++ /dev/null @@ -1,41 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008, 2011 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -uniform mat4 modelViewProjectionMatrix; -uniform float width; -uniform float height; -uniform float cubeAngle; -uniform vec2 u_offset; -uniform float timeLine; - -attribute vec4 position; -attribute vec4 texcoord; - -varying vec2 texcoord0; - -void main() -{ - texcoord0 = texcoord.st; - vec4 transformedVertex = position; - transformedVertex.x = transformedVertex.x - width; - transformedVertex.y = transformedVertex.y - height; - transformedVertex.xy = transformedVertex.xy + u_offset; - float radian = radians(cubeAngle); - float radius = (width)/cos(radian); - float zenithAngle = acos(transformedVertex.y/radius); - float azimuthAngle = asin(transformedVertex.x/radius); - transformedVertex.z = radius * sin( zenithAngle ) * cos( azimuthAngle ) - radius*cos( radians( 90.0 - cubeAngle ) ); - transformedVertex.x = radius * sin( zenithAngle ) * sin( azimuthAngle ); - - transformedVertex.xy += vec2( width - u_offset.x, height - u_offset.y ); - - vec3 diff = (position.xyz - transformedVertex.xyz)*timeLine; - transformedVertex.xyz += diff; - - gl_Position = modelViewProjectionMatrix*transformedVertex; -} diff --git a/src/effects/cube/data/1.40/cube-cap.glsl b/src/effects/cube/data/1.40/cube-cap.glsl deleted file mode 100644 index 20a830626e..0000000000 --- a/src/effects/cube/data/1.40/cube-cap.glsl +++ /dev/null @@ -1,32 +0,0 @@ -#version 140 -uniform sampler2D sampler; -uniform vec4 geometryColor; -uniform float u_opacity; -uniform int u_mirror; -uniform int u_untextured; - -in vec2 texcoord0; - -out vec4 fragColor; - -vec2 mirrorTex(vec2 coords) { - vec2 mirrored = coords; - if (u_mirror != 0) { - mirrored.t = mirrored.t * (-1.0) + 1.0; - } - return mirrored; -} - -void main() { - vec4 color = geometryColor; - vec2 texCoord = mirrorTex(texcoord0); - vec4 tex = texture(sampler, texCoord); - if (texCoord.s < 0.0 || texCoord.s > 1.0 || - texCoord.t < 0.0 || texCoord.t > 1.0 || u_untextured != 0) { - tex = geometryColor; - } - color.rgb = tex.rgb*tex.a + color.rgb*(1.0-tex.a); - color.a = u_opacity; - - fragColor = color; -} diff --git a/src/effects/cube/data/1.40/cube-reflection.glsl b/src/effects/cube/data/1.40/cube-reflection.glsl deleted file mode 100644 index b70e98d923..0000000000 --- a/src/effects/cube/data/1.40/cube-reflection.glsl +++ /dev/null @@ -1,11 +0,0 @@ -#version 140 -uniform float u_alpha; - -in vec2 texcoord0; - -out vec4 fragColor; - -void main() -{ - fragColor = vec4(0.0, 0.0, 0.0, u_alpha*texcoord0.s); -} diff --git a/src/effects/cube/data/1.40/cylinder.vert b/src/effects/cube/data/1.40/cylinder.vert deleted file mode 100644 index d30472ffbe..0000000000 --- a/src/effects/cube/data/1.40/cylinder.vert +++ /dev/null @@ -1,36 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008, 2011 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#version 140 -uniform mat4 modelViewProjectionMatrix; -uniform float width; -uniform float cubeAngle; -uniform float xCoord; -uniform float timeLine; - -in vec4 position; -in vec4 texcoord; - -out vec2 texcoord0; - -void main() -{ - texcoord0 = texcoord.st; - vec4 transformedVertex = vec4(position.x - ( width - xCoord ), position.yzw); - float radian = radians(cubeAngle); - float radius = (width)*tan(radian); - float azimuthAngle = radians(transformedVertex.x/(width)*(90.0 - cubeAngle)); - - transformedVertex.x = width - xCoord + radius * sin( azimuthAngle ); - transformedVertex.z = position.z + radius * cos( azimuthAngle ) - radius; - - vec3 diff = (position.xyz - transformedVertex.xyz)*timeLine; - transformedVertex.xyz += diff; - - gl_Position = modelViewProjectionMatrix*transformedVertex; -} diff --git a/src/effects/cube/data/1.40/sphere.vert b/src/effects/cube/data/1.40/sphere.vert deleted file mode 100644 index 82648a2cdd..0000000000 --- a/src/effects/cube/data/1.40/sphere.vert +++ /dev/null @@ -1,42 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2008, 2011 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#version 140 -uniform mat4 modelViewProjectionMatrix; -uniform float width; -uniform float height; -uniform float cubeAngle; -uniform vec2 u_offset; -uniform float timeLine; - -in vec4 position; -in vec4 texcoord; - -out vec2 texcoord0; - -void main() -{ - texcoord0 = texcoord.st; - vec4 transformedVertex = position; - transformedVertex.x = transformedVertex.x - width; - transformedVertex.y = transformedVertex.y - height; - transformedVertex.xy = transformedVertex.xy + u_offset; - float radian = radians(cubeAngle); - float radius = (width)/cos(radian); - float zenithAngle = acos(transformedVertex.y/radius); - float azimuthAngle = asin(transformedVertex.x/radius); - transformedVertex.z = radius * sin( zenithAngle ) * cos( azimuthAngle ) - radius*cos( radians( 90.0 - cubeAngle ) ); - transformedVertex.x = radius * sin( zenithAngle ) * sin( azimuthAngle ); - - transformedVertex.xy += vec2( width - u_offset.x, height - u_offset.y ); - - vec3 diff = (position.xyz - transformedVertex.xyz)*timeLine; - transformedVertex.xyz += diff; - - gl_Position = modelViewProjectionMatrix*transformedVertex; -} diff --git a/src/effects/cube/data/cubecap.png b/src/effects/cube/data/cubecap.png deleted file mode 100644 index 229fa04f2b..0000000000 Binary files a/src/effects/cube/data/cubecap.png and /dev/null differ diff --git a/src/effects/effect_builtins.cpp b/src/effects/effect_builtins.cpp index 7ad8dd1832..4d2a816e57 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 "cube/cube.h" #include "cubeslide/cubeslide.h" #include "glide/glide.h" #include "invert/invert.h" @@ -133,22 +132,6 @@ EFFECT_FALLBACK #endif EFFECT_FALLBACK QString() - }, { - QStringLiteral("cube"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Cube"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display each virtual desktop on a side of a cube"), - QStringLiteral("Window Management"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/desktop_cube.ogv")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &CubeEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_cube_config") }, { QStringLiteral("cubeslide"), i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Cube Animation"), diff --git a/src/effects/effect_builtins.h b/src/effects/effect_builtins.h index a9a2f270bb..00a6fca370 100644 --- a/src/effects/effect_builtins.h +++ b/src/effects/effect_builtins.h @@ -26,7 +26,6 @@ enum class BuiltInEffect Blur, ColorPicker, Contrast, - Cube, CubeSlide, DesktopGrid, DimInactive, diff --git a/src/effects/shaders.qrc b/src/effects/shaders.qrc index 6e1258a902..b93081caad 100644 --- a/src/effects/shaders.qrc +++ b/src/effects/shaders.qrc @@ -1,18 +1,10 @@ - cube/data/1.10/cube-cap.glsl - cube/data/1.10/cube-reflection.glsl - cube/data/1.10/cylinder.vert - cube/data/1.10/sphere.vert invert/data/1.10/invert.frag lookingglass/data/1.10/lookingglass.frag startupfeedback/data/1.10/blinking-startup-fragment.glsl - cube/data/1.40/cube-cap.glsl - cube/data/1.40/cube-reflection.glsl - cube/data/1.40/cylinder.vert - cube/data/1.40/sphere.vert invert/data/1.40/invert.frag lookingglass/data/1.40/lookingglass.frag startupfeedback/data/1.40/blinking-startup-fragment.glsl diff --git a/src/kcmkwin/kwinscreenedges/kwinscreenedgesettings.kcfg b/src/kcmkwin/kwinscreenedges/kwinscreenedgesettings.kcfg index 29368fc929..a88dfc0692 100644 --- a/src/kcmkwin/kwinscreenedges/kwinscreenedgesettings.kcfg +++ b/src/kcmkwin/kwinscreenedges/kwinscreenedgesettings.kcfg @@ -66,17 +66,6 @@ ElectricNone - - - ElectricNone - - - ElectricNone - - - ElectricNone - - ElectricLeft diff --git a/src/kcmkwin/kwinscreenedges/kwintouchscreensettings.kcfg b/src/kcmkwin/kwinscreenedges/kwintouchscreensettings.kcfg index feca5cb0cf..41528cddfb 100644 --- a/src/kcmkwin/kwinscreenedges/kwintouchscreensettings.kcfg +++ b/src/kcmkwin/kwinscreenedges/kwintouchscreensettings.kcfg @@ -34,17 +34,6 @@ ElectricNone - - - ElectricNone - - - ElectricNone - - - ElectricNone - - ElectricNone diff --git a/src/kcmkwin/kwinscreenedges/main.cpp b/src/kcmkwin/kwinscreenedges/main.cpp index a43123bdb1..7e76f9e0fb 100644 --- a/src/kcmkwin/kwinscreenedges/main.cpp +++ b/src/kcmkwin/kwinscreenedges/main.cpp @@ -92,7 +92,6 @@ void KWinScreenEdgesConfig::save() QDBusConnection::sessionBus()); interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::PresentWindows)); interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::DesktopGrid)); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::Cube)); KCModule::save(); } @@ -135,10 +134,6 @@ void KWinScreenEdgesConfig::monitorInit() m_form->monitorAddItem(i18n("%1 - Current Desktop", presentWindowsName)); m_form->monitorAddItem(i18n("%1 - Current Application", presentWindowsName)); m_form->monitorAddItem(BuiltInEffects::effectData(BuiltInEffect::DesktopGrid).displayName); - const QString cubeName = BuiltInEffects::effectData(BuiltInEffect::Cube).displayName; - m_form->monitorAddItem(i18n("%1 - Cube", cubeName)); - m_form->monitorAddItem(i18n("%1 - Cylinder", cubeName)); - m_form->monitorAddItem(i18n("%1 - Sphere", cubeName)); m_form->monitorAddItem(i18n("Toggle window switching")); m_form->monitorAddItem(i18n("Toggle alternative window switching")); @@ -189,11 +184,6 @@ void KWinScreenEdgesConfig::monitorLoadSettings() // Desktop Grid m_form->monitorChangeEdge(m_data->settings()->borderActivateDesktopGrid(), DesktopGrid); - // Desktop Cube - m_form->monitorChangeEdge(m_data->settings()->borderActivateCube(), Cube); - m_form->monitorChangeEdge(m_data->settings()->borderActivateCylinder(), Cylinder); - m_form->monitorChangeEdge(m_data->settings()->borderActivateSphere(), Sphere); - // TabBox m_form->monitorChangeEdge(m_data->settings()->borderActivateTabBox(), TabBox); // Alternative TabBox @@ -232,11 +222,6 @@ void KWinScreenEdgesConfig::monitorLoadDefaultSettings() // Desktop Grid m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateDesktopGridValue(), DesktopGrid); - // Desktop Cube - m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateCubeValue(), Cube); - m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateCylinderValue(), Cylinder); - m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateSphereValue(), Sphere); - // TabBox m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateTabBoxValue(), TabBox); // Alternative TabBox @@ -265,11 +250,6 @@ void KWinScreenEdgesConfig::monitorSaveSettings() // Desktop Grid m_data->settings()->setBorderActivateDesktopGrid(m_form->monitorCheckEffectHasEdge(DesktopGrid)); - // Desktop Cube - m_data->settings()->setBorderActivateCube(m_form->monitorCheckEffectHasEdge(Cube)); - m_data->settings()->setBorderActivateCylinder(m_form->monitorCheckEffectHasEdge(Cylinder)); - m_data->settings()->setBorderActivateSphere(m_form->monitorCheckEffectHasEdge(Sphere)); - // TabBox m_data->settings()->setBorderActivateTabBox(m_form->monitorCheckEffectHasEdge(TabBox)); m_data->settings()->setBorderAlternativeActivate(m_form->monitorCheckEffectHasEdge(TabBoxAlternative)); @@ -295,11 +275,6 @@ void KWinScreenEdgesConfig::monitorShowEvent() enabled = effectEnabled(BuiltInEffect::DesktopGrid, config); m_form->monitorItemSetEnabled(DesktopGrid, enabled); - // Desktop Cube - enabled = effectEnabled(BuiltInEffect::Cube, config); - m_form->monitorItemSetEnabled(Cube, enabled); - m_form->monitorItemSetEnabled(Cylinder, enabled); - m_form->monitorItemSetEnabled(Sphere, enabled); // tabbox, depends on reasonable focus policy. KConfigGroup config2(m_config, "Windows"); QString focusPolicy = config2.readEntry("FocusPolicy", QString()); diff --git a/src/kcmkwin/kwinscreenedges/main.h b/src/kcmkwin/kwinscreenedges/main.h index e96b1c9903..5f2a1d1244 100644 --- a/src/kcmkwin/kwinscreenedges/main.h +++ b/src/kcmkwin/kwinscreenedges/main.h @@ -53,9 +53,6 @@ private: PresentWindowsCurrent, PresentWindowsClass, DesktopGrid, - Cube, - Cylinder, - Sphere, TabBox, TabBoxAlternative, EffectCount diff --git a/src/kcmkwin/kwinscreenedges/touch.cpp b/src/kcmkwin/kwinscreenedges/touch.cpp index fc29732271..436d92971e 100644 --- a/src/kcmkwin/kwinscreenedges/touch.cpp +++ b/src/kcmkwin/kwinscreenedges/touch.cpp @@ -85,7 +85,6 @@ void KWinScreenEdgesConfig::save() QDBusConnection::sessionBus()); interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::PresentWindows)); interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::DesktopGrid)); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::Cube)); KCModule::save(); } @@ -133,10 +132,6 @@ void KWinScreenEdgesConfig::monitorInit() m_form->monitorAddItem(i18n("%1 - Current Desktop", presentWindowsName)); m_form->monitorAddItem(i18n("%1 - Current Application", presentWindowsName)); m_form->monitorAddItem(BuiltInEffects::effectData(BuiltInEffect::DesktopGrid).displayName); - const QString cubeName = BuiltInEffects::effectData(BuiltInEffect::Cube).displayName; - m_form->monitorAddItem(i18n("%1 - Cube", cubeName)); - m_form->monitorAddItem(i18n("%1 - Cylinder", cubeName)); - m_form->monitorAddItem(i18n("%1 - Sphere", cubeName)); m_form->monitorAddItem(i18n("Toggle window switching")); m_form->monitorAddItem(i18n("Toggle alternative window switching")); @@ -181,13 +176,6 @@ void KWinScreenEdgesConfig::monitorLoadSettings() // Desktop Grid BorderActivate m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateDesktopGrid(), DesktopGrid); - // Desktop Cube BorderActivate - m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateCube(), Cube); - // Desktop Cube BorderActivateCylinder - m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateCylinder(), Cylinder); - // Desktop Cube BorderActivateSphere - m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateSphere(), Sphere); - // TabBox BorderActivate m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateTabBox(), TabBox); // Alternative TabBox @@ -217,13 +205,6 @@ void KWinScreenEdgesConfig::monitorLoadDefaultSettings() // Desktop Grid BorderActivate m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateDesktopGridValue(), DesktopGrid); - // Desktop Cube BorderActivate - m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateCubeValue(), Cube); - // Desktop Cube BorderActivateCylinder - m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateCylinderValue(), Cylinder); - // Desktop Cube BorderActivateSphere - m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateSphereValue(), Sphere); - // TabBox BorderActivate m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateTabBoxValue(), TabBox); // Alternative TabBox @@ -248,11 +229,6 @@ void KWinScreenEdgesConfig::monitorSaveSettings() // Desktop Grid m_data->settings()->setTouchBorderActivateDesktopGrid(m_form->monitorCheckEffectHasEdge(DesktopGrid)); - // Desktop Cube - m_data->settings()->setTouchBorderActivateCube(m_form->monitorCheckEffectHasEdge(Cube)); - m_data->settings()->setTouchBorderActivateCylinder(m_form->monitorCheckEffectHasEdge(Cylinder)); - m_data->settings()->setTouchBorderActivateSphere(m_form->monitorCheckEffectHasEdge(Sphere)); - // TabBox m_data->settings()->setTouchBorderActivateTabBox(m_form->monitorCheckEffectHasEdge(TabBox)); m_data->settings()->setTouchBorderAlternativeActivate(m_form->monitorCheckEffectHasEdge(TabBoxAlternative)); @@ -278,11 +254,6 @@ void KWinScreenEdgesConfig::monitorShowEvent() enabled = effectEnabled(BuiltInEffect::DesktopGrid, config); m_form->monitorItemSetEnabled(DesktopGrid, enabled); - // Desktop Cube - enabled = effectEnabled(BuiltInEffect::Cube, config); - m_form->monitorItemSetEnabled(Cube, enabled); - m_form->monitorItemSetEnabled(Cylinder, enabled); - m_form->monitorItemSetEnabled(Sphere, enabled); // tabbox, depends on reasonable focus policy. KConfigGroup config2(m_config, "Windows"); QString focusPolicy = config2.readEntry("FocusPolicy", QString()); diff --git a/src/kcmkwin/kwinscreenedges/touch.h b/src/kcmkwin/kwinscreenedges/touch.h index 61403abb2e..96b33af318 100644 --- a/src/kcmkwin/kwinscreenedges/touch.h +++ b/src/kcmkwin/kwinscreenedges/touch.h @@ -53,9 +53,6 @@ private: PresentWindowsCurrent, PresentWindowsClass, DesktopGrid, - Cube, - Cylinder, - Sphere, TabBox, TabBoxAlternative, EffectCount