Decorations: add new argument to margins() to allow exclude shadows
We can already have shadows to be part of decoration margins, but we need a way to also get size of shadow margins itself, because they should be ignored for the purposes of aligning, placing and constraining windows. This change breaks API/ABI compatibility of QWaylandAbstractDecoration plugin, however, as stated in the header file, it is a subject of change and its API is not meant to be stable. Alternatively we can make this a separate method. Change-Id: Ib2c9982e16c4acb13a83757e6371022c0a89b74e Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
4d666cd62e
commit
e101ffce1d
@ -73,7 +73,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstra
|
||||
public:
|
||||
QWaylandBradientDecoration();
|
||||
protected:
|
||||
QMargins margins() const override;
|
||||
QMargins margins(MarginsType marginsType = Full) const override;
|
||||
void paint(QPaintDevice *device) override;
|
||||
bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override;
|
||||
bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) override;
|
||||
@ -130,8 +130,11 @@ QRectF QWaylandBradientDecoration::minimizeButtonRect() const
|
||||
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
|
||||
}
|
||||
|
||||
QMargins QWaylandBradientDecoration::margins() const
|
||||
QMargins QWaylandBradientDecoration::margins(MarginsType marginsType) const
|
||||
{
|
||||
if (marginsType == ShadowsOnly)
|
||||
return QMargins();
|
||||
|
||||
return QMargins(3, 30, 3, 3);
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,12 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QWaylandAbstractDecoration)
|
||||
public:
|
||||
enum MarginsType {
|
||||
Full,
|
||||
ShadowsExcluded,
|
||||
ShadowsOnly
|
||||
};
|
||||
|
||||
QWaylandAbstractDecoration();
|
||||
~QWaylandAbstractDecoration() override;
|
||||
|
||||
@ -91,7 +97,8 @@ public:
|
||||
void update();
|
||||
bool isDirty() const;
|
||||
|
||||
virtual QMargins margins() const = 0;
|
||||
virtual QMargins margins(MarginsType marginsType = Full) const = 0;
|
||||
|
||||
QWindow *window() const;
|
||||
const QImage &contentImage();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user