feat: better notification storage and image caching + blobs
C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 11s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Successful in 12s
JS/TS / lint (pull_request) Successful in 10s
Python / static (pull_request) Failing after 27s
Rust / build (pull_request) Successful in 54s
Python / verify (pull_request) Failing after 1m26s
Rust / fmt (pull_request) Successful in 46s
Rust / clippy (pull_request) Successful in 1m6s

This commit is contained in:
2026-11-02 19:00:43 +01:00
parent 789305286a
commit 11e7aac195
56 changed files with 5003 additions and 2168 deletions
+56 -6
View File
@@ -16,6 +16,22 @@ constexpr float k_settleVel = 0.05f;
constexpr float k_identityEps = 0.0005f;
constexpr float k_stillPx = 0.5f;
constexpr int k_settleStillSamples = 3;
// How far the deform matrix is from identity, summed over its three distinct
// entries. The matrix is applied as a panel's transform, so it has to reach
// *exactly* identity rather than merely close to it: a residue of 1e-4 scales
// a 400 logical px panel by 0.04 px, which moves a device-aligned child onto a
// fraction of a device pixel, and anything that centers itself inside the
// panel (`anchors` with `alignWhenCentered`, `Layout.HCenter`/`VCenter`) then
// antialiases. The residue also differs per entry, so different children land
// on different sub-pixel offsets - which reads as random blur.
float identityResidue(float dm00, float dm01, float dm11) {
return std::abs(dm00 - 1.0f) + std::abs(dm01) + std::abs(dm11 - 1.0f);
}
bool nearIdentity(float dm00, float dm01, float dm11) {
return identityResidue(dm00, dm01, dm11) <= k_identityEps;
}
} // namespace
BlobRect::BlobRect(QQuickItem* parent) : BlobShape(parent) {
@@ -27,11 +43,12 @@ BlobRect::~BlobRect() {
}
bool BlobRect::needsFrame() const {
// Pump until the matrix is *exactly* identity, not merely within epsilon:
// updatePhysics() snaps it there once it is near enough, so this stays true
// only for the frames between the last integration and that snap.
return m_physicsActive || m_retiring ||
m_stillSamples < k_settleStillSamples ||
std::abs(m_dm00 - 1.0f) + std::abs(m_dm01) +
std::abs(m_dm11 - 1.0f) >
k_identityEps;
identityResidue(m_dm00, m_dm01, m_dm11) > 0.0f;
}
void BlobRect::resetDeformMatrix() {
@@ -55,10 +72,15 @@ void BlobRect::updatePolish() {
}
void BlobRect::finishAtIdentity() {
const bool settled = identityResidue(m_dm00, m_dm01, m_dm11) <= 0.0f &&
!m_retiring && !m_physicsActive;
if (settled) return;
m_dm00 = 1.0f;
m_dm01 = 0.0f;
m_dm11 = 1.0f;
m_deformMatrix = QMatrix4x4();
m_dmVel00 = m_dmVel01 = m_dmVel11 = 0.0f;
m_retiring = false;
m_physicsActive = false;
emit rawDeformMatrixChanged();
@@ -110,6 +132,16 @@ void BlobRect::updatePhysics() {
m_dm00 = m_retire00 + (1.0f - m_retire00) * s;
m_dm01 = m_retire01 - m_retire01 * s;
m_dm11 = m_retire11 + (1.0f - m_retire11) * s;
// Snap the emitted matrix to exact identity while the retire tail is
// below the visible threshold, but keep retiring: ending the retire early
// hides the background while the panel animation still has a tail.
if (nearIdentity(m_dm00, m_dm01, m_dm11)) {
m_dm00 = 1.0f;
m_dm01 = 0.0f;
m_dm11 = 1.0f;
}
m_deformMatrix = QMatrix4x4(
m_dm00, m_dm01, 0, 0, m_dm01, m_dm11, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
emit rawDeformMatrixChanged();
@@ -119,12 +151,15 @@ void BlobRect::updatePhysics() {
const QPointF scenePos = mapToScene(QPointF(width() / 2.0, height() / 2.0));
if (!m_physicsActive && !m_retiring) {
const float stuck = std::abs(m_dm00 - 1.0f) + std::abs(m_dm01) +
std::abs(m_dm11 - 1.0f);
if (stuck > k_identityEps) {
const float residue = identityResidue(m_dm00, m_dm01, m_dm11);
if (residue > k_identityEps) {
beginRetire();
return;
}
// Residue at or below the threshold is invisible, so it is written as
// exact identity - the panel transform then stops being a transform at
// all. Sampling continues below, so a new movement can restart physics.
if (residue > 0.0f) finishAtIdentity();
}
if (!m_hasPrevPos) {
@@ -215,6 +250,21 @@ void BlobRect::updatePhysics() {
m_dmVel11 = (m_dmVel11 - kStiffness * (m_dm11 - target11) * dt) * invDamp;
m_dm11 += m_dmVel11 * dt;
// Land on exact identity as soon as the spring is within the invisible
// threshold, so the panel's contents are back on the device pixel grid -
// but keep physicsActive until trySettle() completes: the at-rest drop
// must not happen while the panel animation still has a slow tail.
if (speed < k_moveSpeed && nearIdentity(m_dm00, m_dm01, m_dm11)) {
m_dm00 = 1.0f;
m_dm01 = 0.0f;
m_dm11 = 1.0f;
m_deformMatrix = QMatrix4x4();
emit rawDeformMatrixChanged();
updateCenteredDeformMatrix();
trySettle(speed);
return;
}
m_deformMatrix = QMatrix4x4(
m_dm00, m_dm01, 0, 0, m_dm01, m_dm11, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
emit rawDeformMatrixChanged();