1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-07 19:59:14 -04:00

fix(toast): align dimensions to whole pixels to avoid blurry rendering (#2494)

The toast Rectangle uses `layer.enabled: true`, which renders to a
texture before compositing. With fractional implicit/content sizes
(derived from text and icon metrics), the cached texture was being
sampled with sub-pixel interpolation and the toast looked blurry
under fractional-scale-aware compositors (e.g., niri).

Wrap toastWidth/toastHeight and implicitWidth/implicitHeight with
Theme.px(value, dpr), matching the alignment NotificationPopup.qml
already applies to its surface.
This commit is contained in:
Guilherme Pagano
2026-05-26 12:23:10 -03:00
committed by GitHub
parent 60b64f22c6
commit 54f272ba1e
+4 -4
View File
@@ -50,8 +50,8 @@ PanelWindow {
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
color: "transparent" color: "transparent"
readonly property real toastWidth: shouldBeVisible ? Math.min(900, messageText.implicitWidth + statusIcon.width + Theme.spacingM + (ToastService.hasDetails ? (expandButton.width + closeButton.width + 4) : (ToastService.currentLevel === ToastService.levelError ? closeButton.width + Theme.spacingS : 0)) + Theme.spacingL * 2 + Theme.spacingM * 2) : frozenWidth readonly property real toastWidth: shouldBeVisible ? Theme.px(Math.min(900, messageText.implicitWidth + statusIcon.width + Theme.spacingM + (ToastService.hasDetails ? (expandButton.width + closeButton.width + 4) : (ToastService.currentLevel === ToastService.levelError ? closeButton.width + Theme.spacingS : 0)) + Theme.spacingL * 2 + Theme.spacingM * 2), dpr) : frozenWidth
readonly property real toastHeight: toastContent.height + Theme.spacingL * 2 readonly property real toastHeight: Theme.px(toastContent.height + Theme.spacingL * 2, dpr)
anchors { anchors {
top: true top: true
@@ -63,8 +63,8 @@ PanelWindow {
top: Math.max(0, Theme.snap(toastY - shadowBuffer, dpr)) top: Math.max(0, Theme.snap(toastY - shadowBuffer, dpr))
} }
implicitWidth: toastWidth + (shadowBuffer * 2) implicitWidth: Theme.px(toastWidth + (shadowBuffer * 2), dpr)
implicitHeight: toastHeight + (shadowBuffer * 2) implicitHeight: Theme.px(toastHeight + (shadowBuffer * 2), dpr)
Rectangle { Rectangle {
id: toast id: toast