35e254a8a9
This is needed to make per-screen rendering work correctly. BUG: 431652
76 lines
1.8 KiB
C++
76 lines
1.8 KiB
C++
/*
|
|
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 GLRenderTarget;
|
|
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;
|
|
GLTexture *m_texture;
|
|
GLRenderTarget *m_fbo;
|
|
GLVertexBuffer *m_vbo;
|
|
GLShader *m_shader;
|
|
std::chrono::milliseconds m_lastPresentTime;
|
|
bool m_enabled;
|
|
bool m_valid;
|
|
};
|
|
|
|
} // namespace
|
|
|
|
#endif
|