Remove the lookingglass effect
It has been broken for a while (at least as long as 5.25) with no bugreports about it. It also doesn't look all that great from the video.
This commit is contained in:
parent
28210372a4
commit
6831f25125
14 changed files with 0 additions and 774 deletions
|
@ -95,7 +95,6 @@ add_subdirectory(blur)
|
|||
add_subdirectory(backgroundcontrast)
|
||||
add_subdirectory(glide)
|
||||
add_subdirectory(invert)
|
||||
add_subdirectory(lookingglass)
|
||||
add_subdirectory(magnifier)
|
||||
add_subdirectory(mouseclick)
|
||||
add_subdirectory(mousemark)
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
#######################################
|
||||
# Effect
|
||||
|
||||
set(lookingglass_SOURCES
|
||||
lookingglass.cpp
|
||||
lookingglass.qrc
|
||||
main.cpp
|
||||
)
|
||||
|
||||
kconfig_add_kcfg_files(lookingglass_SOURCES
|
||||
lookingglassconfig.kcfgc
|
||||
)
|
||||
|
||||
kwin4_add_effect_module(kwin4_effect_lookingglass ${lookingglass_SOURCES})
|
||||
target_link_libraries(kwin4_effect_lookingglass PRIVATE
|
||||
kwineffects
|
||||
kwinglutils
|
||||
|
||||
KF5::ConfigGui
|
||||
KF5::ConfigWidgets
|
||||
KF5::GlobalAccel
|
||||
KF5::I18n
|
||||
)
|
||||
|
||||
#######################################
|
||||
# Config
|
||||
if (KWIN_BUILD_KCMS)
|
||||
set(kwin_lookingglass_config_SRCS lookingglass_config.cpp)
|
||||
ki18n_wrap_ui(kwin_lookingglass_config_SRCS lookingglass_config.ui)
|
||||
kconfig_add_kcfg_files(kwin_lookingglass_config_SRCS lookingglassconfig.kcfgc)
|
||||
|
||||
kwin_add_effect_config(kwin_lookingglass_config ${kwin_lookingglass_config_SRCS})
|
||||
|
||||
target_link_libraries(kwin_lookingglass_config
|
||||
KF5::ConfigWidgets
|
||||
KF5::CoreAddons
|
||||
KF5::GlobalAccel
|
||||
KF5::I18n
|
||||
KF5::XmlGui
|
||||
KWinEffectsInterface
|
||||
)
|
||||
endif()
|
|
@ -1,270 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
SPDX-FileCopyrightText: 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "lookingglass.h"
|
||||
|
||||
// KConfigSkeleton
|
||||
#include "lookingglassconfig.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <kwinglplatform.h>
|
||||
#include <kwinglutils.h>
|
||||
|
||||
#include <KGlobalAccel>
|
||||
#include <KLocalizedString>
|
||||
#include <KStandardAction>
|
||||
#include <QFile>
|
||||
#include <QVector2D>
|
||||
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
Q_LOGGING_CATEGORY(KWIN_LOOKINGGLASS, "kwin_effect_lookingglass", QtWarningMsg)
|
||||
|
||||
static void ensureResources()
|
||||
{
|
||||
// Must initialize resources manually because the effect is a static lib.
|
||||
Q_INIT_RESOURCE(lookingglass);
|
||||
}
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
LookingGlassEffect::LookingGlassEffect()
|
||||
: zoom(1.0f)
|
||||
, target_zoom(1.0f)
|
||||
, polling(false)
|
||||
, m_texture(nullptr)
|
||||
, m_fbo(nullptr)
|
||||
, m_vbo(nullptr)
|
||||
, m_shader(nullptr)
|
||||
, m_lastPresentTime(std::chrono::milliseconds::zero())
|
||||
, m_enabled(false)
|
||||
, m_valid(false)
|
||||
{
|
||||
initConfig<LookingGlassConfig>();
|
||||
QAction *a;
|
||||
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this);
|
||||
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Equal));
|
||||
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Equal));
|
||||
effects->registerGlobalShortcut(Qt::META | Qt::Key_Equal, a);
|
||||
|
||||
a = KStandardAction::zoomOut(this, SLOT(zoomOut()), this);
|
||||
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Minus));
|
||||
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Minus));
|
||||
effects->registerGlobalShortcut(Qt::META | Qt::Key_Minus, a);
|
||||
|
||||
a = KStandardAction::actualSize(this, SLOT(toggle()), this);
|
||||
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_0));
|
||||
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_0));
|
||||
effects->registerGlobalShortcut(Qt::META | Qt::Key_0, a);
|
||||
|
||||
connect(effects, &EffectsHandler::mouseChanged, this, &LookingGlassEffect::slotMouseChanged);
|
||||
connect(effects, &EffectsHandler::windowDamaged, this, &LookingGlassEffect::slotWindowDamaged);
|
||||
|
||||
reconfigure(ReconfigureAll);
|
||||
}
|
||||
|
||||
LookingGlassEffect::~LookingGlassEffect() = default;
|
||||
|
||||
bool LookingGlassEffect::supported()
|
||||
{
|
||||
return effects->compositingType() == OpenGLCompositing && !GLPlatform::instance()->supports(LimitedNPOT);
|
||||
}
|
||||
|
||||
void LookingGlassEffect::reconfigure(ReconfigureFlags)
|
||||
{
|
||||
LookingGlassConfig::self()->read();
|
||||
initialradius = LookingGlassConfig::radius();
|
||||
radius = initialradius;
|
||||
qCDebug(KWIN_LOOKINGGLASS) << "Radius from config:" << radius;
|
||||
m_valid = loadData();
|
||||
}
|
||||
|
||||
bool LookingGlassEffect::loadData()
|
||||
{
|
||||
ensureResources();
|
||||
|
||||
const QSize screenSize = effects->virtualScreenSize();
|
||||
int texw = screenSize.width();
|
||||
int texh = screenSize.height();
|
||||
|
||||
// Create texture and render target
|
||||
const int levels = std::log2(qMin(texw, texh)) + 1;
|
||||
m_texture = std::make_unique<GLTexture>(GL_RGBA8, texw, texh, levels);
|
||||
m_texture->setFilter(GL_LINEAR_MIPMAP_LINEAR);
|
||||
m_texture->setWrapMode(GL_CLAMP_TO_EDGE);
|
||||
|
||||
m_fbo = std::make_unique<GLFramebuffer>(m_texture.get());
|
||||
if (!m_fbo->valid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_shader = ShaderManager::instance()->generateShaderFromFile(ShaderTrait::MapTexture, QString(), QStringLiteral(":/effects/lookingglass/shaders/lookingglass.frag"));
|
||||
if (m_shader->isValid()) {
|
||||
ShaderBinder binder(m_shader.get());
|
||||
m_shader->setUniform("u_textureSize", QVector2D(screenSize.width(), screenSize.height()));
|
||||
} else {
|
||||
qCCritical(KWIN_LOOKINGGLASS) << "The shader failed to load!";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_vbo = std::make_unique<GLVertexBuffer>(GLVertexBuffer::Static);
|
||||
QVector<float> verts;
|
||||
QVector<float> texcoords;
|
||||
texcoords << screenSize.width() << 0.0;
|
||||
verts << screenSize.width() << 0.0;
|
||||
texcoords << 0.0 << 0.0;
|
||||
verts << 0.0 << 0.0;
|
||||
texcoords << 0.0 << screenSize.height();
|
||||
verts << 0.0 << screenSize.height();
|
||||
texcoords << 0.0 << screenSize.height();
|
||||
verts << 0.0 << screenSize.height();
|
||||
texcoords << screenSize.width() << screenSize.height();
|
||||
verts << screenSize.width() << screenSize.height();
|
||||
texcoords << screenSize.width() << 0.0;
|
||||
verts << screenSize.width() << 0.0;
|
||||
m_vbo->setData(6, 2, verts.constData(), texcoords.constData());
|
||||
return true;
|
||||
}
|
||||
|
||||
void LookingGlassEffect::toggle()
|
||||
{
|
||||
if (target_zoom == 1.0f) {
|
||||
target_zoom = 2.0f;
|
||||
if (!polling) {
|
||||
polling = true;
|
||||
effects->startMousePolling();
|
||||
}
|
||||
m_enabled = true;
|
||||
} else {
|
||||
target_zoom = 1.0f;
|
||||
if (polling) {
|
||||
polling = false;
|
||||
effects->stopMousePolling();
|
||||
}
|
||||
if (zoom == target_zoom) {
|
||||
m_enabled = false;
|
||||
}
|
||||
}
|
||||
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
|
||||
}
|
||||
|
||||
void LookingGlassEffect::zoomIn()
|
||||
{
|
||||
target_zoom = qMin(7.0, target_zoom + 0.5);
|
||||
m_enabled = true;
|
||||
if (!polling) {
|
||||
polling = true;
|
||||
effects->startMousePolling();
|
||||
}
|
||||
effects->addRepaint(magnifierArea());
|
||||
}
|
||||
|
||||
void LookingGlassEffect::zoomOut()
|
||||
{
|
||||
target_zoom -= 0.5;
|
||||
if (target_zoom < 1) {
|
||||
target_zoom = 1;
|
||||
if (polling) {
|
||||
polling = false;
|
||||
effects->stopMousePolling();
|
||||
}
|
||||
if (zoom == target_zoom) {
|
||||
m_enabled = false;
|
||||
}
|
||||
}
|
||||
effects->addRepaint(magnifierArea());
|
||||
}
|
||||
|
||||
QRect LookingGlassEffect::magnifierArea() const
|
||||
{
|
||||
return QRect(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
|
||||
}
|
||||
|
||||
void LookingGlassEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime)
|
||||
{
|
||||
const int time = m_lastPresentTime.count() ? (presentTime - m_lastPresentTime).count() : 0;
|
||||
if (zoom != target_zoom) {
|
||||
double diff = time / animationTime(500.0);
|
||||
if (target_zoom > zoom) {
|
||||
zoom = qMin(zoom * qMax(1.0 + diff, 1.2), target_zoom);
|
||||
} else {
|
||||
zoom = qMax(zoom * qMin(1.0 - diff, 0.8), target_zoom);
|
||||
}
|
||||
qCDebug(KWIN_LOOKINGGLASS) << "zoom is now " << zoom;
|
||||
radius = qBound((double)initialradius, initialradius * zoom, 3.5 * initialradius);
|
||||
|
||||
if (zoom <= 1.0f) {
|
||||
m_enabled = false;
|
||||
}
|
||||
|
||||
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
|
||||
}
|
||||
if (zoom != target_zoom) {
|
||||
m_lastPresentTime = presentTime;
|
||||
} else {
|
||||
m_lastPresentTime = std::chrono::milliseconds::zero();
|
||||
}
|
||||
if (m_valid && m_enabled) {
|
||||
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
|
||||
// Start rendering to texture
|
||||
GLFramebuffer::pushFramebuffer(m_fbo.get());
|
||||
}
|
||||
|
||||
effects->prePaintScreen(data, presentTime);
|
||||
}
|
||||
|
||||
void LookingGlassEffect::slotMouseChanged(const QPoint &pos, const QPoint &old, Qt::MouseButtons,
|
||||
Qt::MouseButtons, Qt::KeyboardModifiers, Qt::KeyboardModifiers)
|
||||
{
|
||||
if (pos != old && m_enabled) {
|
||||
effects->addRepaint(pos.x() - radius, pos.y() - radius, 2 * radius, 2 * radius);
|
||||
effects->addRepaint(old.x() - radius, old.y() - radius, 2 * radius, 2 * radius);
|
||||
}
|
||||
}
|
||||
|
||||
void LookingGlassEffect::slotWindowDamaged()
|
||||
{
|
||||
if (isActive()) {
|
||||
effects->addRepaint(magnifierArea());
|
||||
}
|
||||
}
|
||||
|
||||
void LookingGlassEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData &data)
|
||||
{
|
||||
// Call the next effect.
|
||||
effects->paintScreen(mask, region, data);
|
||||
if (m_valid && m_enabled) {
|
||||
// Disable render texture
|
||||
GLFramebuffer *target = GLFramebuffer::popFramebuffer();
|
||||
Q_ASSERT(target == m_fbo.get());
|
||||
Q_UNUSED(target);
|
||||
m_texture->bind();
|
||||
m_texture->generateMipmaps();
|
||||
|
||||
// Use the shader
|
||||
ShaderBinder binder(m_shader.get());
|
||||
m_shader->setUniform("u_zoom", (float)zoom);
|
||||
m_shader->setUniform("u_radius", (float)radius);
|
||||
m_shader->setUniform("u_cursor", QVector2D(cursorPos().x(), cursorPos().y()));
|
||||
m_shader->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix());
|
||||
m_vbo->render(GL_TRIANGLES);
|
||||
m_texture->unbind();
|
||||
}
|
||||
}
|
||||
|
||||
bool LookingGlassEffect::isActive() const
|
||||
{
|
||||
return m_valid && m_enabled;
|
||||
}
|
||||
|
||||
} // namespace
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
SPDX-FileCopyrightText: 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef KWIN_LOOKINGGLASS_H
|
||||
#define KWIN_LOOKINGGLASS_H
|
||||
|
||||
#include <kwineffects.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class GLFramebuffer;
|
||||
class GLShader;
|
||||
class GLTexture;
|
||||
class GLVertexBuffer;
|
||||
|
||||
/**
|
||||
* Enhanced magnifier
|
||||
*/
|
||||
class LookingGlassEffect : public Effect
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int initialRadius READ initialRadius)
|
||||
public:
|
||||
LookingGlassEffect();
|
||||
~LookingGlassEffect() override;
|
||||
|
||||
void reconfigure(ReconfigureFlags) override;
|
||||
|
||||
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
|
||||
void paintScreen(int mask, const QRegion ®ion, ScreenPaintData &data) override;
|
||||
bool isActive() const override;
|
||||
|
||||
static bool supported();
|
||||
|
||||
// for properties
|
||||
int initialRadius() const
|
||||
{
|
||||
return initialradius;
|
||||
}
|
||||
QRect magnifierArea() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void toggle();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void slotMouseChanged(const QPoint &pos, const QPoint &old,
|
||||
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
|
||||
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
|
||||
void slotWindowDamaged();
|
||||
|
||||
private:
|
||||
bool loadData();
|
||||
double zoom;
|
||||
double target_zoom;
|
||||
bool polling; // Mouse polling
|
||||
int radius;
|
||||
int initialradius;
|
||||
std::unique_ptr<GLTexture> m_texture;
|
||||
std::unique_ptr<GLFramebuffer> m_fbo;
|
||||
std::unique_ptr<GLVertexBuffer> m_vbo;
|
||||
std::unique_ptr<GLShader> m_shader;
|
||||
std::chrono::milliseconds m_lastPresentTime;
|
||||
bool m_enabled;
|
||||
bool m_valid;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile arg="true"/>
|
||||
<group name="Effect-lookingglass">
|
||||
<entry name="Radius" type="UInt">
|
||||
<default>200</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/effects/lookingglass/">
|
||||
<file>shaders/lookingglass.frag</file>
|
||||
<file>shaders/lookingglass_core.frag</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "lookingglass_config.h"
|
||||
|
||||
#include <config-kwin.h>
|
||||
|
||||
// KConfigSkeleton
|
||||
#include "lookingglassconfig.h"
|
||||
#include <kwineffects_interface.h>
|
||||
|
||||
#include <KActionCollection>
|
||||
#include <KGlobalAccel>
|
||||
#include <KLocalizedString>
|
||||
#include <KPluginFactory>
|
||||
#include <kconfiggroup.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
K_PLUGIN_CLASS(KWin::LookingGlassEffectConfig)
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
LookingGlassEffectConfigForm::LookingGlassEffectConfigForm(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget *parent, const QVariantList &args)
|
||||
: KCModule(parent, args)
|
||||
, m_ui(this)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(&m_ui);
|
||||
|
||||
LookingGlassConfig::instance(KWIN_CONFIG);
|
||||
addConfig(LookingGlassConfig::self(), &m_ui);
|
||||
connect(m_ui.editor, &KShortcutsEditor::keyChange, this, &LookingGlassEffectConfig::markAsChanged);
|
||||
|
||||
// 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("LookingGlass"));
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
QAction *a;
|
||||
a = m_actionCollection->addAction(KStandardAction::ZoomIn);
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Equal));
|
||||
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Equal));
|
||||
|
||||
a = m_actionCollection->addAction(KStandardAction::ZoomOut);
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Minus));
|
||||
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Minus));
|
||||
|
||||
a = m_actionCollection->addAction(KStandardAction::ActualSize);
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_0));
|
||||
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_0));
|
||||
|
||||
m_ui.editor->addCollection(m_actionCollection);
|
||||
}
|
||||
|
||||
LookingGlassEffectConfig::~LookingGlassEffectConfig()
|
||||
{
|
||||
// Undo (only) unsaved changes to global key shortcuts
|
||||
m_ui.editor->undo();
|
||||
}
|
||||
|
||||
void LookingGlassEffectConfig::save()
|
||||
{
|
||||
qDebug() << "Saving config of LookingGlass";
|
||||
KCModule::save();
|
||||
|
||||
m_ui.editor->save(); // undo() will restore to this state from now on
|
||||
|
||||
OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"),
|
||||
QStringLiteral("/Effects"),
|
||||
QDBusConnection::sessionBus());
|
||||
interface.reconfigureEffect(QStringLiteral("lookingglass"));
|
||||
}
|
||||
|
||||
void LookingGlassEffectConfig::defaults()
|
||||
{
|
||||
m_ui.editor->allDefault();
|
||||
KCModule::defaults();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#include "lookingglass_config.moc"
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef KWIN_LOOKINGGLASS_CONFIG_H
|
||||
#define KWIN_LOOKINGGLASS_CONFIG_H
|
||||
|
||||
#include <kcmodule.h>
|
||||
|
||||
#include "ui_lookingglass_config.h"
|
||||
|
||||
class KActionCollection;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class LookingGlassEffectConfigForm : public QWidget, public Ui::LookingGlassEffectConfigForm
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LookingGlassEffectConfigForm(QWidget *parent);
|
||||
};
|
||||
|
||||
class LookingGlassEffectConfig : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LookingGlassEffectConfig(QWidget *parent = nullptr, const QVariantList &args = QVariantList());
|
||||
~LookingGlassEffectConfig() override;
|
||||
|
||||
void save() override;
|
||||
void defaults() override;
|
||||
|
||||
private:
|
||||
LookingGlassEffectConfigForm m_ui;
|
||||
KActionCollection *m_actionCollection;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,59 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KWin::LookingGlassEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::LookingGlassEffectConfigForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>275</width>
|
||||
<height>185</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="KShortcutsEditor" name="editor" native="true">
|
||||
<property name="actionTypes">
|
||||
<enum>KShortcutsEditor::GlobalAction</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&Radius:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>kcfg_Radius</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_Radius">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KShortcutsEditor</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">KShortcutsEditor</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,5 +0,0 @@
|
|||
File=lookingglass.kcfg
|
||||
ClassName=LookingGlassConfig
|
||||
NameSpace=KWin
|
||||
Singleton=true
|
||||
Mutators=true
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "lookingglass.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
KWIN_EFFECT_FACTORY_SUPPORTED(LookingGlassEffect,
|
||||
"metadata.json.stripped",
|
||||
return LookingGlassEffect::supported();)
|
||||
|
||||
} // namespace KWin
|
||||
|
||||
#include "main.moc"
|
|
@ -1,81 +0,0 @@
|
|||
{
|
||||
"KPlugin": {
|
||||
"Category": "Accessibility",
|
||||
"Description": "A screen magnifier that looks like a fisheye lens",
|
||||
"Description[ar]": "مكبّرة شاشة تطالع كما عدسة عينا السمكة",
|
||||
"Description[az]": "Ekrandakı sahəni linza effekti ilə göstərir",
|
||||
"Description[bg]": "Екранна лупа, която прилича на леща тип рибешко око",
|
||||
"Description[ca@valencia]": "Una lupa de pantalla que pareix una lent amb ull de peix",
|
||||
"Description[ca]": "Una lupa de pantalla que sembla una lent amb ull de peix",
|
||||
"Description[cs]": "Lupa, která vypadá jako rybí oko",
|
||||
"Description[de]": "Eine Lupe, die wie eine Fischaugen-Linse funktioniert",
|
||||
"Description[en_GB]": "A screen magnifier that looks like a fisheye lens",
|
||||
"Description[es]": "Una lupa de pantalla que simula una lente de ojo de pez",
|
||||
"Description[fi]": "Kalansilmälinssiltä näyttävä suurennuslasi",
|
||||
"Description[fr]": "Une loupe d'écran ressemblant à une lentille grand angle",
|
||||
"Description[hu]": "Halszem-optikájú nagyító",
|
||||
"Description[ia]": "Un aggranditor de schermo semblante lentes fisheye",
|
||||
"Description[id]": "Sebuah kaca-pembesar layar yang terlihat seperti lensa mata ikan",
|
||||
"Description[it]": "Un ingranditore dello schermo che sembra una lente a occhio di pesce",
|
||||
"Description[ko]": "어안 렌즈를 통해서 화면을 확대합니다",
|
||||
"Description[nl]": "Een schermvergrootglas dat er uitziet als een visooglens",
|
||||
"Description[nn]": "Skjermforstørring forma som ei fiskeaugelinse",
|
||||
"Description[pl]": "Powiększa ekran przez \"rybie oko\"",
|
||||
"Description[pt]": "Uma lupa do ecrã que parece uma lente de olho-de-peixe",
|
||||
"Description[pt_BR]": "Uma lupa da área de trabalho que parece uma lente de olho-de-peixe",
|
||||
"Description[ro]": "Lupă pentru ecran ce arată ca o lentilă de ochi de pește",
|
||||
"Description[ru]": "Показ области экрана с эффектом линзы",
|
||||
"Description[sk]": "Lupa obrazovky s efektom rybieho oka",
|
||||
"Description[sl]": "Povečevalo zaslona, ki deluje kot objektiv ribjega očesa",
|
||||
"Description[sv]": "Ett skärmförstoringsglas som ser ut som en fiskögonlins",
|
||||
"Description[ta]": "பூதக்கண்ணாடியை போல திரையில் உள்ளவற்றை பெரிதாக்கும்",
|
||||
"Description[tr]": "Bir balık gözlü lense benzeyen bir ekran büyüteci",
|
||||
"Description[uk]": "Екранна лупа, яка робить вигляд стільниці схожим на зображення, отримане з ефектом «риб’ячого ока»",
|
||||
"Description[vi]": "Một trình phóng đại màn hình trông như một thấu kính mắt cá",
|
||||
"Description[x-test]": "xxA screen magnifier that looks like a fisheye lensxx",
|
||||
"Description[zh_CN]": "放大显示鼠标光标附近的一块圆形的屏幕内容,效果类似鱼眼镜头",
|
||||
"Description[zh_TW]": "看起來像是魚眼鏡頭的螢幕放大鏡",
|
||||
"EnabledByDefault": false,
|
||||
"Id": "lookingglass",
|
||||
"License": "GPL",
|
||||
"Name": "Looking Glass",
|
||||
"Name[ar]": "عدسة عين السمكة",
|
||||
"Name[az]": "Linza",
|
||||
"Name[bg]": "Стъклена леща",
|
||||
"Name[ca@valencia]": "Aspecte de vidre",
|
||||
"Name[ca]": "Aspecte de vidre",
|
||||
"Name[cs]": "Lupa",
|
||||
"Name[de]": "Bildschirmlupe",
|
||||
"Name[en_GB]": "Looking Glass",
|
||||
"Name[es]": "Espejo",
|
||||
"Name[fi]": "Suurennuslasi",
|
||||
"Name[fr]": "Mirroir",
|
||||
"Name[hu]": "Tükör",
|
||||
"Name[ia]": "Looking Glass",
|
||||
"Name[id]": "Looking Glass",
|
||||
"Name[it]": "Specchio",
|
||||
"Name[ko]": "들여다보는 돋보기",
|
||||
"Name[nl]": "Vergrootglas",
|
||||
"Name[nn]": "Forstørringsglas",
|
||||
"Name[pl]": "Lupa",
|
||||
"Name[pt]": "Aparência de Vidro",
|
||||
"Name[pt_BR]": "Espelho",
|
||||
"Name[ro]": "Lentilă",
|
||||
"Name[ru]": "Линза",
|
||||
"Name[sk]": "Šošovka",
|
||||
"Name[sl]": "Izložba",
|
||||
"Name[sv]": "Förstoringsglas",
|
||||
"Name[ta]": "பூதக்கண்ணாடி",
|
||||
"Name[tr]": "Ayna",
|
||||
"Name[uk]": "Збільшувальне скло",
|
||||
"Name[vi]": "Kính lúp",
|
||||
"Name[x-test]": "xxLooking Glassxx",
|
||||
"Name[zh_CN]": "放大镜 (鱼眼)",
|
||||
"Name[zh_TW]": "鏡中世界"
|
||||
},
|
||||
"X-KDE-ConfigModule": "kwin_lookingglass_config",
|
||||
"org.kde.kwin.effect": {
|
||||
"exclusiveGroup": "magnifiers",
|
||||
"video": "https://files.kde.org/plasma/kwin/effect-videos/looking_glass.ogv"
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
uniform sampler2D sampler;
|
||||
uniform vec2 u_cursor;
|
||||
uniform float u_zoom;
|
||||
uniform float u_radius;
|
||||
uniform vec2 u_textureSize;
|
||||
|
||||
varying vec2 texcoord0;
|
||||
|
||||
#define PI 3.14159
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 d = u_cursor - texcoord0;
|
||||
float dist = sqrt(d.x*d.x + d.y*d.y);
|
||||
vec2 texcoord = texcoord0;
|
||||
if (dist < u_radius) {
|
||||
float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
|
||||
texcoord += d / dist * disp;
|
||||
}
|
||||
|
||||
texcoord = texcoord/u_textureSize;
|
||||
texcoord.t = 1.0 - texcoord.t;
|
||||
gl_FragColor = texture2D(sampler, texcoord);
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#version 140
|
||||
uniform sampler2D sampler;
|
||||
uniform vec2 u_cursor;
|
||||
uniform float u_zoom;
|
||||
uniform float u_radius;
|
||||
uniform vec2 u_textureSize;
|
||||
|
||||
in vec2 texcoord0;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
#define PI 3.14159
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 d = u_cursor - texcoord0;
|
||||
float dist = sqrt(d.x*d.x + d.y*d.y);
|
||||
vec2 texcoord = texcoord0;
|
||||
if (dist < u_radius) {
|
||||
float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
|
||||
texcoord += d / dist * disp;
|
||||
}
|
||||
|
||||
texcoord = texcoord/u_textureSize;
|
||||
texcoord.t = 1.0 - texcoord.t;
|
||||
fragColor = texture(sampler, texcoord);
|
||||
}
|
||||
|
Loading…
Reference in a new issue