DecorationShadow is supported through using the padding values. The window becomes larger by the padding and gets positioned accordingly. This requires to translate all mouse events. The DecorationShadow is just using the complete image, which is kind of a memory waste, but at least the SVG based Aurorae doesn't provide us better information (might be added, but would probably need changes in the theme). For switching back to non-compositing we recreate the QuickWindow. It's not fortunate, but as long as we do not yet have the render control it's needed.
82 lines
2.3 KiB
C++
82 lines
2.3 KiB
C++
/********************************************************************
|
|
Copyright (C) 2009, 2010, 2012 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*********************************************************************/
|
|
|
|
#ifndef AURORAE_H
|
|
#define AURORAE_H
|
|
|
|
#include <KDecoration2/Decoration>
|
|
#include <QVariant>
|
|
#include <QMutex>
|
|
|
|
class QOpenGLFramebufferObject;
|
|
class QQmlComponent;
|
|
class QQmlEngine;
|
|
class QQuickItem;
|
|
class QQuickWindow;
|
|
class QWindow;
|
|
|
|
namespace KWin
|
|
{
|
|
class Borders;
|
|
}
|
|
|
|
namespace Aurorae
|
|
{
|
|
|
|
class Decoration : public KDecoration2::Decoration
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit Decoration(QObject *parent = nullptr, const QVariantList &args = QVariantList());
|
|
virtual ~Decoration();
|
|
|
|
void paint(QPainter *painter) override;
|
|
|
|
Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant());
|
|
|
|
public Q_SLOTS:
|
|
void init() override;
|
|
void installTitleItem(QQuickItem *item);
|
|
|
|
protected:
|
|
void hoverEnterEvent(QHoverEvent *event) override;
|
|
void hoverLeaveEvent(QHoverEvent *event) override;
|
|
void hoverMoveEvent(QHoverEvent *event) override;
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
private:
|
|
void setupBorders(QQuickItem *item);
|
|
void updateBorders();
|
|
QMouseEvent translatedMouseEvent(QMouseEvent *orig);
|
|
QScopedPointer<QOpenGLFramebufferObject> m_fbo;
|
|
QImage m_buffer;
|
|
QScopedPointer<QWindow> m_decorationWindow;
|
|
QPointer<QQuickWindow> m_view;
|
|
QQuickItem *m_item;
|
|
KWin::Borders *m_borders;
|
|
KWin::Borders *m_maximizedBorders;
|
|
KWin::Borders *m_extendedBorders;
|
|
KWin::Borders *m_padding;
|
|
QString m_themeName;
|
|
QMutex m_mutex;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|