kwineffects: Remove WindowQuadType

The window quad type has become irrelevant.
icc-effect-5.26.4
Vlad Zahorodnii 2021-06-10 12:54:16 +03:00
parent 3ed363c498
commit 29cc319455
11 changed files with 15 additions and 102 deletions

View File

@ -26,7 +26,7 @@ private:
KWin::WindowQuad WindowQuadListTest::makeQuad(const QRectF &r) KWin::WindowQuad WindowQuadListTest::makeQuad(const QRectF &r)
{ {
KWin::WindowQuad quad(KWin::WindowQuadContents); KWin::WindowQuad quad;
quad[ 0 ] = KWin::WindowVertex(r.x(), r.y(), r.x(), r.y()); quad[ 0 ] = KWin::WindowVertex(r.x(), r.y(), r.x(), r.y());
quad[ 1 ] = KWin::WindowVertex(r.x() + r.width(), r.y(), r.x() + r.width(), r.y()); quad[ 1 ] = KWin::WindowVertex(r.x() + r.width(), r.y(), r.x() + r.width(), r.y());
quad[ 2 ] = KWin::WindowVertex(r.x() + r.width(), r.y() + r.height(), r.x() + r.width(), r.y() + r.height()); quad[ 2 ] = KWin::WindowVertex(r.x() + r.width(), r.y() + r.height(), r.x() + r.width(), r.y() + r.height());

View File

@ -149,9 +149,6 @@ public:
return false; return false;
} }
void moveWindow(KWin::EffectWindow *, const QPoint &, bool, double) override {} void moveWindow(KWin::EffectWindow *, const QPoint &, bool, double) override {}
KWin::WindowQuadType newWindowQuadType() override {
return KWin::WindowQuadError;
}
int numberOfDesktops() const override { int numberOfDesktops() const override {
return 0; return 0;
} }

View File

@ -206,7 +206,7 @@ WindowQuadList DecorationItem::buildQuads() const
const int u1 = (x1 + offsets[i].x()) * textureScale; const int u1 = (x1 + offsets[i].x()) * textureScale;
const int v1 = (y1 + offsets[i].y()) * textureScale; const int v1 = (y1 + offsets[i].y()) * textureScale;
WindowQuad quad(WindowQuadDecoration, const_cast<DecorationItem *>(this)); WindowQuad quad(const_cast<DecorationItem *>(this));
quad.setUVAxisSwapped(swap); quad.setUVAxisSwapped(swap);
if (swap) { if (swap) {

View File

@ -113,7 +113,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
: EffectsHandler(scene->compositingType()) : EffectsHandler(scene->compositingType())
, keyboard_grab_effect(nullptr) , keyboard_grab_effect(nullptr)
, fullscreen_effect(nullptr) , fullscreen_effect(nullptr)
, next_window_quad_type(EFFECT_QUAD_TYPE_START)
, m_compositor(compositor) , m_compositor(compositor)
, m_scene(scene) , m_scene(scene)
, m_desktopRendering(false) , m_desktopRendering(false)
@ -1032,11 +1031,6 @@ double EffectsHandlerImpl::animationTimeFactor() const
return options->animationTimeFactor(); return options->animationTimeFactor();
} }
WindowQuadType EffectsHandlerImpl::newWindowQuadType()
{
return WindowQuadType(next_window_quad_type++);
}
EffectWindow* EffectsHandlerImpl::findWindow(WId id) const EffectWindow* EffectsHandlerImpl::findWindow(WId id) const
{ {
if (X11Client *w = Workspace::self()->findClient(Predicate::WindowMatch, id)) if (X11Client *w = Workspace::self()->findClient(Predicate::WindowMatch, id))

View File

@ -150,7 +150,6 @@ public:
QSize virtualScreenSize() const override; QSize virtualScreenSize() const override;
QRect virtualScreenGeometry() const override; QRect virtualScreenGeometry() const override;
double animationTimeFactor() const override; double animationTimeFactor() const override;
WindowQuadType newWindowQuadType() override;
void defineCursor(Qt::CursorShape shape) override; void defineCursor(Qt::CursorShape shape) override;
bool checkInputWindowEvent(QMouseEvent *e); bool checkInputWindowEvent(QMouseEvent *e);
@ -334,7 +333,6 @@ protected:
QList<EffectWindow*> elevated_windows; QList<EffectWindow*> elevated_windows;
QMultiMap< int, EffectPair > effect_order; QMultiMap< int, EffectPair > effect_order;
QHash< long, int > registered_atoms; QHash< long, int > registered_atoms;
int next_window_quad_type;
private: private:
void registerPropertyType(long atom, bool reg); void registerPropertyType(long atom, bool reg);

View File

@ -199,7 +199,7 @@ void MagicLampEffect::deform(EffectWindow* w, int mask, WindowPaintData& data, W
float offset[2] = {0,0}; // how far has a quad to be moved? Distance between icon and window multiplied by the progress and by the quadFactor float offset[2] = {0,0}; // how far has a quad to be moved? Distance between icon and window multiplied by the progress and by the quadFactor
float p_progress[2] = {0,0}; // the factor which defines how far the x values have to be changed float p_progress[2] = {0,0}; // the factor which defines how far the x values have to be changed
// factor is the current moved y value diveded by the distance between icon and window // factor is the current moved y value diveded by the distance between icon and window
WindowQuad lastQuad(WindowQuadError); WindowQuad lastQuad;
lastQuad[0].setX(-1); lastQuad[0].setX(-1);
lastQuad[0].setY(-1); lastQuad[0].setY(-1);
lastQuad[1].setX(-1); lastQuad[1].setX(-1);

View File

@ -176,7 +176,7 @@ void DeformEffect::drawWindow(EffectWindow *window, int mask, const QRegion& reg
QRectF visibleRect = expandedGeometry; QRectF visibleRect = expandedGeometry;
visibleRect.moveTopLeft(expandedGeometry.topLeft() - frameGeometry.topLeft()); visibleRect.moveTopLeft(expandedGeometry.topLeft() - frameGeometry.topLeft());
WindowQuad quad(WindowQuadContents); WindowQuad quad;
quad[0] = WindowVertex(visibleRect.topLeft(), QPointF(0, 0)); quad[0] = WindowVertex(visibleRect.topLeft(), QPointF(0, 0));
quad[1] = WindowVertex(visibleRect.topRight(), QPointF(1, 0)); quad[1] = WindowVertex(visibleRect.topRight(), QPointF(1, 0));
quad[2] = WindowVertex(visibleRect.bottomRight(), QPointF(1, 1)); quad[2] = WindowVertex(visibleRect.bottomRight(), QPointF(1, 1));

View File

@ -1255,36 +1255,6 @@ void WindowQuadList::makeArrays(float **vertices, float **texcoords, const QSize
} }
} }
WindowQuadList WindowQuadList::select(WindowQuadType type) const
{
Q_FOREACH (const WindowQuad & q, *this) {
if (q.type() != type) { // something else than ones to select, make a copy and filter
WindowQuadList ret;
Q_FOREACH (const WindowQuad & q, *this) {
if (q.type() == type)
ret.append(q);
}
return ret;
}
}
return *this; // nothing to filter out
}
WindowQuadList WindowQuadList::filterOut(WindowQuadType type) const
{
for (const WindowQuad & q : *this) {
if (q.type() == type) { // something to filter out, make a copy and filter
WindowQuadList ret;
Q_FOREACH (const WindowQuad & q, *this) {
if (q.type() != type)
ret.append(q);
}
return ret;
}
}
return *this; // nothing to filter out
}
bool WindowQuadList::smoothNeeded() const bool WindowQuadList::smoothNeeded() const
{ {
return std::any_of(constBegin(), constEnd(), [] (const WindowQuad & q) { return q.smoothNeeded(); }); return std::any_of(constBegin(), constEnd(), [] (const WindowQuad & q) { return q.smoothNeeded(); });

View File

@ -178,23 +178,6 @@ X-KDE-Library=kwin4_effect_cooleffect
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \ #define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
enum WindowQuadType {
WindowQuadError, // for the stupid default ctor
WindowQuadContents,
WindowQuadDecoration,
// Shadow Quad types
WindowQuadShadow, // OpenGL only. The other shadow types are only used by Xrender
WindowQuadShadowTop,
WindowQuadShadowTopRight,
WindowQuadShadowRight,
WindowQuadShadowBottomRight,
WindowQuadShadowBottom,
WindowQuadShadowBottomLeft,
WindowQuadShadowLeft,
WindowQuadShadowTopLeft,
EFFECT_QUAD_TYPE_START = 100 ///< @internal
};
/** /**
* EffectWindow::setData() and EffectWindow::data() global roles. * EffectWindow::setData() and EffectWindow::data() global roles.
* All values between 0 and 999 are reserved for global roles. * All values between 0 and 999 are reserved for global roles.
@ -1072,7 +1055,6 @@ public:
* if used manually. * if used manually.
*/ */
virtual double animationTimeFactor() const = 0; virtual double animationTimeFactor() const = 0;
virtual WindowQuadType newWindowQuadType() = 0;
Q_SCRIPTABLE virtual KWin::EffectWindow* findWindow(WId id) const = 0; Q_SCRIPTABLE virtual KWin::EffectWindow* findWindow(WId id) const = 0;
Q_SCRIPTABLE virtual KWin::EffectWindow* findWindow(KWaylandServer::SurfaceInterface *surf) const = 0; Q_SCRIPTABLE virtual KWin::EffectWindow* findWindow(KWaylandServer::SurfaceInterface *surf) const = 0;
@ -2614,16 +2596,13 @@ private:
class KWINEFFECTS_EXPORT WindowQuad class KWINEFFECTS_EXPORT WindowQuad
{ {
public: public:
explicit WindowQuad(WindowQuadType type, void *userData = nullptr); explicit WindowQuad(void *userData = nullptr);
WindowQuad makeSubQuad(double x1, double y1, double x2, double y2) const; WindowQuad makeSubQuad(double x1, double y1, double x2, double y2) const;
WindowVertex& operator[](int index); WindowVertex& operator[](int index);
const WindowVertex& operator[](int index) const; const WindowVertex& operator[](int index) const;
WindowQuadType type() const;
void setUVAxisSwapped(bool value) { uvSwapped = value; } void setUVAxisSwapped(bool value) { uvSwapped = value; }
bool uvAxisSwapped() const { return uvSwapped; } bool uvAxisSwapped() const { return uvSwapped; }
void *userData() const; void *userData() const;
bool decoration() const;
bool effect() const;
double left() const; double left() const;
double right() const; double right() const;
double top() const; double top() const;
@ -2638,7 +2617,6 @@ private:
friend class WindowQuadList; friend class WindowQuadList;
WindowVertex verts[ 4 ]; WindowVertex verts[ 4 ];
void *m_userData; void *m_userData;
WindowQuadType quadType; // 0 - contents, 1 - decoration
bool uvSwapped; bool uvSwapped;
}; };
@ -2650,8 +2628,6 @@ public:
WindowQuadList splitAtY(double y) const; WindowQuadList splitAtY(double y) const;
WindowQuadList makeGrid(int maxquadsize) const; WindowQuadList makeGrid(int maxquadsize) const;
WindowQuadList makeRegularGrid(int xSubdivisions, int ySubdivisions) const; WindowQuadList makeRegularGrid(int xSubdivisions, int ySubdivisions) const;
WindowQuadList select(WindowQuadType type) const;
WindowQuadList filterOut(WindowQuadType type) const;
bool smoothNeeded() const; bool smoothNeeded() const;
void makeInterleavedArrays(unsigned int type, GLVertex2D *vertices, const QMatrix4x4 &matrix) const; void makeInterleavedArrays(unsigned int type, GLVertex2D *vertices, const QMatrix4x4 &matrix) const;
void makeArrays(float** vertices, float** texcoords, const QSizeF &size, bool yInverted) const; void makeArrays(float** vertices, float** texcoords, const QSizeF &size, bool yInverted) const;
@ -3822,9 +3798,8 @@ void WindowVertex::setY(double y)
***************************************************************/ ***************************************************************/
inline inline
WindowQuad::WindowQuad(WindowQuadType t, void *userData) WindowQuad::WindowQuad(void *userData)
: m_userData(userData) : m_userData(userData)
, quadType(t)
, uvSwapped(false) , uvSwapped(false)
{ {
} }
@ -3843,33 +3818,12 @@ const WindowVertex& WindowQuad::operator[](int index) const
return verts[ index ]; return verts[ index ];
} }
inline
WindowQuadType WindowQuad::type() const
{
Q_ASSERT(quadType != WindowQuadError);
return quadType;
}
inline inline
void *WindowQuad::userData() const void *WindowQuad::userData() const
{ {
return m_userData; return m_userData;
} }
inline
bool WindowQuad::decoration() const
{
Q_ASSERT(quadType != WindowQuadError);
return quadType == WindowQuadDecoration;
}
inline
bool WindowQuad::effect() const
{
Q_ASSERT(quadType != WindowQuadError);
return quadType >= EFFECT_QUAD_TYPE_START;
}
inline inline
bool WindowQuad::isTransformed() const bool WindowQuad::isTransformed() const
{ {

View File

@ -160,7 +160,7 @@ WindowQuadList ShadowItem::buildQuads() const
ty1 = 0.0; ty1 = 0.0;
tx2 = topLeftRect.width() / width; tx2 = topLeftRect.width() / width;
ty2 = topLeftRect.height() / height; ty2 = topLeftRect.height() / height;
WindowQuad topLeftQuad(WindowQuadShadow, tag); WindowQuad topLeftQuad(tag);
topLeftQuad[0] = WindowVertex(topLeftRect.left(), topLeftRect.top(), tx1, ty1); topLeftQuad[0] = WindowVertex(topLeftRect.left(), topLeftRect.top(), tx1, ty1);
topLeftQuad[1] = WindowVertex(topLeftRect.right(), topLeftRect.top(), tx2, ty1); topLeftQuad[1] = WindowVertex(topLeftRect.right(), topLeftRect.top(), tx2, ty1);
topLeftQuad[2] = WindowVertex(topLeftRect.right(), topLeftRect.bottom(), tx2, ty2); topLeftQuad[2] = WindowVertex(topLeftRect.right(), topLeftRect.bottom(), tx2, ty2);
@ -173,7 +173,7 @@ WindowQuadList ShadowItem::buildQuads() const
ty1 = 0.0; ty1 = 0.0;
tx2 = 1.0; tx2 = 1.0;
ty2 = topRightRect.height() / height; ty2 = topRightRect.height() / height;
WindowQuad topRightQuad(WindowQuadShadow, tag); WindowQuad topRightQuad(tag);
topRightQuad[0] = WindowVertex(topRightRect.left(), topRightRect.top(), tx1, ty1); topRightQuad[0] = WindowVertex(topRightRect.left(), topRightRect.top(), tx1, ty1);
topRightQuad[1] = WindowVertex(topRightRect.right(), topRightRect.top(), tx2, ty1); topRightQuad[1] = WindowVertex(topRightRect.right(), topRightRect.top(), tx2, ty1);
topRightQuad[2] = WindowVertex(topRightRect.right(), topRightRect.bottom(), tx2, ty2); topRightQuad[2] = WindowVertex(topRightRect.right(), topRightRect.bottom(), tx2, ty2);
@ -186,7 +186,7 @@ WindowQuadList ShadowItem::buildQuads() const
tx2 = 1.0; tx2 = 1.0;
ty1 = 1.0 - bottomRightRect.height() / height; ty1 = 1.0 - bottomRightRect.height() / height;
ty2 = 1.0; ty2 = 1.0;
WindowQuad bottomRightQuad(WindowQuadShadow, tag); WindowQuad bottomRightQuad(tag);
bottomRightQuad[0] = WindowVertex(bottomRightRect.left(), bottomRightRect.top(), tx1, ty1); bottomRightQuad[0] = WindowVertex(bottomRightRect.left(), bottomRightRect.top(), tx1, ty1);
bottomRightQuad[1] = WindowVertex(bottomRightRect.right(), bottomRightRect.top(), tx2, ty1); bottomRightQuad[1] = WindowVertex(bottomRightRect.right(), bottomRightRect.top(), tx2, ty1);
bottomRightQuad[2] = WindowVertex(bottomRightRect.right(), bottomRightRect.bottom(), tx2, ty2); bottomRightQuad[2] = WindowVertex(bottomRightRect.right(), bottomRightRect.bottom(), tx2, ty2);
@ -199,7 +199,7 @@ WindowQuadList ShadowItem::buildQuads() const
tx2 = bottomLeftRect.width() / width; tx2 = bottomLeftRect.width() / width;
ty1 = 1.0 - bottomLeftRect.height() / height; ty1 = 1.0 - bottomLeftRect.height() / height;
ty2 = 1.0; ty2 = 1.0;
WindowQuad bottomLeftQuad(WindowQuadShadow, tag); WindowQuad bottomLeftQuad(tag);
bottomLeftQuad[0] = WindowVertex(bottomLeftRect.left(), bottomLeftRect.top(), tx1, ty1); bottomLeftQuad[0] = WindowVertex(bottomLeftRect.left(), bottomLeftRect.top(), tx1, ty1);
bottomLeftQuad[1] = WindowVertex(bottomLeftRect.right(), bottomLeftRect.top(), tx2, ty1); bottomLeftQuad[1] = WindowVertex(bottomLeftRect.right(), bottomLeftRect.top(), tx2, ty1);
bottomLeftQuad[2] = WindowVertex(bottomLeftRect.right(), bottomLeftRect.bottom(), tx2, ty2); bottomLeftQuad[2] = WindowVertex(bottomLeftRect.right(), bottomLeftRect.bottom(), tx2, ty2);
@ -232,7 +232,7 @@ WindowQuadList ShadowItem::buildQuads() const
ty1 = 0.0; ty1 = 0.0;
tx2 = tx1 + top.width() / width; tx2 = tx1 + top.width() / width;
ty2 = topRect.height() / height; ty2 = topRect.height() / height;
WindowQuad topQuad(WindowQuadShadow, tag); WindowQuad topQuad(tag);
topQuad[0] = WindowVertex(topRect.left(), topRect.top(), tx1, ty1); topQuad[0] = WindowVertex(topRect.left(), topRect.top(), tx1, ty1);
topQuad[1] = WindowVertex(topRect.right(), topRect.top(), tx2, ty1); topQuad[1] = WindowVertex(topRect.right(), topRect.top(), tx2, ty1);
topQuad[2] = WindowVertex(topRect.right(), topRect.bottom(), tx2, ty2); topQuad[2] = WindowVertex(topRect.right(), topRect.bottom(), tx2, ty2);
@ -245,7 +245,7 @@ WindowQuadList ShadowItem::buildQuads() const
ty1 = shadowMargins.top() / height; ty1 = shadowMargins.top() / height;
tx2 = 1.0; tx2 = 1.0;
ty2 = ty1 + right.height() / height; ty2 = ty1 + right.height() / height;
WindowQuad rightQuad(WindowQuadShadow, tag); WindowQuad rightQuad(tag);
rightQuad[0] = WindowVertex(rightRect.left(), rightRect.top(), tx1, ty1); rightQuad[0] = WindowVertex(rightRect.left(), rightRect.top(), tx1, ty1);
rightQuad[1] = WindowVertex(rightRect.right(), rightRect.top(), tx2, ty1); rightQuad[1] = WindowVertex(rightRect.right(), rightRect.top(), tx2, ty1);
rightQuad[2] = WindowVertex(rightRect.right(), rightRect.bottom(), tx2, ty2); rightQuad[2] = WindowVertex(rightRect.right(), rightRect.bottom(), tx2, ty2);
@ -258,7 +258,7 @@ WindowQuadList ShadowItem::buildQuads() const
ty1 = 1.0 - bottomRect.height() / height; ty1 = 1.0 - bottomRect.height() / height;
tx2 = tx1 + bottom.width() / width; tx2 = tx1 + bottom.width() / width;
ty2 = 1.0; ty2 = 1.0;
WindowQuad bottomQuad(WindowQuadShadow, tag); WindowQuad bottomQuad(tag);
bottomQuad[0] = WindowVertex(bottomRect.left(), bottomRect.top(), tx1, ty1); bottomQuad[0] = WindowVertex(bottomRect.left(), bottomRect.top(), tx1, ty1);
bottomQuad[1] = WindowVertex(bottomRect.right(), bottomRect.top(), tx2, ty1); bottomQuad[1] = WindowVertex(bottomRect.right(), bottomRect.top(), tx2, ty1);
bottomQuad[2] = WindowVertex(bottomRect.right(), bottomRect.bottom(), tx2, ty2); bottomQuad[2] = WindowVertex(bottomRect.right(), bottomRect.bottom(), tx2, ty2);
@ -271,7 +271,7 @@ WindowQuadList ShadowItem::buildQuads() const
ty1 = shadowMargins.top() / height; ty1 = shadowMargins.top() / height;
tx2 = leftRect.width() / width; tx2 = leftRect.width() / width;
ty2 = ty1 + left.height() / height; ty2 = ty1 + left.height() / height;
WindowQuad leftQuad(WindowQuadShadow, tag); WindowQuad leftQuad(tag);
leftQuad[0] = WindowVertex(leftRect.left(), leftRect.top(), tx1, ty1); leftQuad[0] = WindowVertex(leftRect.left(), leftRect.top(), tx1, ty1);
leftQuad[1] = WindowVertex(leftRect.right(), leftRect.top(), tx2, ty1); leftQuad[1] = WindowVertex(leftRect.right(), leftRect.top(), tx2, ty1);
leftQuad[2] = WindowVertex(leftRect.right(), leftRect.bottom(), tx2, ty2); leftQuad[2] = WindowVertex(leftRect.right(), leftRect.bottom(), tx2, ty2);

View File

@ -125,7 +125,7 @@ WindowQuadList SurfaceItem::buildQuads() const
quads.reserve(region.rectCount()); quads.reserve(region.rectCount());
for (const QRectF rect : region) { for (const QRectF rect : region) {
WindowQuad quad(WindowQuadContents, const_cast<SurfaceItem *>(this)); WindowQuad quad(const_cast<SurfaceItem *>(this));
const QPointF windowTopLeft = mapToWindow(rect.topLeft()); const QPointF windowTopLeft = mapToWindow(rect.topLeft());
const QPointF windowTopRight = mapToWindow(rect.topRight()); const QPointF windowTopRight = mapToWindow(rect.topRight());