forked from quickshell/quickshell
core/window: move input mask handling + commit scheduling to polish
This commit is contained in:
parent
d6b58521e9
commit
6464ead0f1
7 changed files with 76 additions and 32 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <qregion.h>
|
||||
#include <qtmetamacros.h>
|
||||
#include <qtypes.h>
|
||||
#include <qvectornd.h>
|
||||
|
||||
PendingRegion::PendingRegion(QObject* parent): QObject(parent) {
|
||||
QObject::connect(this, &PendingRegion::shapeChanged, this, &PendingRegion::changed);
|
||||
|
@ -105,8 +106,19 @@ QRegion PendingRegion::applyTo(QRegion& region) const {
|
|||
return region;
|
||||
}
|
||||
|
||||
QRegion PendingRegion::applyTo(const QRect& rect) const {
|
||||
// if left as the default, dont combine it with the whole rect area, leave it as is.
|
||||
if (this->mIntersection == Intersection::Combine) {
|
||||
return this->build();
|
||||
} else {
|
||||
auto baseRegion = QRegion(rect);
|
||||
return this->applyTo(baseRegion);
|
||||
}
|
||||
}
|
||||
|
||||
void PendingRegion::regionsAppend(QQmlListProperty<PendingRegion>* prop, PendingRegion* region) {
|
||||
auto* self = static_cast<PendingRegion*>(prop->object); // NOLINT
|
||||
if (!region) return;
|
||||
|
||||
QObject::connect(region, &QObject::destroyed, self, &PendingRegion::onChildDestroyed);
|
||||
QObject::connect(region, &PendingRegion::changed, self, &PendingRegion::childrenChanged);
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
[[nodiscard]] bool empty() const;
|
||||
[[nodiscard]] QRegion build() const;
|
||||
[[nodiscard]] QRegion applyTo(QRegion& region) const;
|
||||
[[nodiscard]] QRegion applyTo(const QRect& rect) const;
|
||||
|
||||
RegionShape::Enum mShape = RegionShape::Rect;
|
||||
Intersection::Enum mIntersection = Intersection::Combine;
|
||||
|
@ -109,6 +110,11 @@ signals:
|
|||
void widthChanged();
|
||||
void heightChanged();
|
||||
void childrenChanged();
|
||||
|
||||
/// Triggered when the region's geometry changes.
|
||||
///
|
||||
/// In some cases the region does not update automatically.
|
||||
/// In those cases you can emit this signal manually.
|
||||
void changed();
|
||||
|
||||
private slots:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue