diff --git a/plasma/plasmoids/io.gitgud.wackyideas.desktopcontainment/contents/ui/FolderItemDelegate.qml b/plasma/plasmoids/io.gitgud.wackyideas.desktopcontainment/contents/ui/FolderItemDelegate.qml index 43ecbd6c..f4404887 100644 --- a/plasma/plasmoids/io.gitgud.wackyideas.desktopcontainment/contents/ui/FolderItemDelegate.qml +++ b/plasma/plasmoids/io.gitgud.wackyideas.desktopcontainment/contents/ui/FolderItemDelegate.qml @@ -39,8 +39,6 @@ Item { Accessible.role: Accessible.Canvas - readonly property real dpi: main.Window.window.devicePixelRatio - // This MouseArea exists to intercept press and hold; preventing edit mode // from being triggered when pressing and holding on an icon (if there is one). MouseArea { @@ -207,7 +205,7 @@ Item { active: impl.iconAndLabelsShouldlookSelected || model.selected asynchronous: true - width: Math.round(parent.width * main.dpi) / main.dpi + width: parent.width height: root.useListViewMode ? parent.height @@ -311,10 +309,22 @@ Item { PlasmaComponents.Label { id: label - z: 2 // So it's always above the highlight effect - renderType: main.dpi == 1.0 ? Text.NativeRendering : Text.QtRendering + renderType: Text.NativeRendering font.hintingPreference: Font.PreferFullHinting + z: 2 // So it's always above the highlight effect + font.kerning: Screen.devicePixelRatio == 1.0 + Timer { + id: hidpi_hack + interval: 50 + onTriggered: { + front.anchors.rightMargin += 1; + front.anchors.rightMargin -= 1; + behind.anchors.rightMargin += 1; + behind.anchors.rightMargin -= 1; + + } + } // Hacks to improve font rendering to increase contrast and text brightness // This is done to get darker subpixel rendering, closer to ClearType PlasmaComponents.Label { @@ -324,8 +334,9 @@ Item { anchors.rightMargin: 1 anchors.leftMargin: -1 color: model.selected && Plasmoid.configuration.selectionStyle ? "black" : "#F9000000" - renderType: main.dpi == 1.0 ? Text.NativeRendering : Text.QtRendering + renderType: Text.NativeRendering font.hintingPreference: Font.PreferFullHinting + font.kerning: Screen.devicePixelRatio == 1.0 text: parent.text elide: Text.ElideRight maximumLineCount: parent.maximumLineCount @@ -339,8 +350,9 @@ Item { anchors.fill: parent anchors.rightMargin: 0 color: model.selected && Plasmoid.configuration.selectionStyle ? "black" : "#ffffffff" - renderType: main.dpi == 1.0 ? Text.NativeRendering : Text.QtRendering + renderType: Text.NativeRendering font.hintingPreference: Font.PreferFullHinting + font.kerning: Screen.devicePixelRatio == 1.0 text: parent.text elide: Text.ElideRight maximumLineCount: parent.maximumLineCount @@ -357,7 +369,7 @@ Item { target: label anchors.topMargin: Kirigami.Units.smallSpacing // Ffs - width: Math.round((parent.width - Kirigami.Units.smallSpacing) * main.dpi) / main.dpi + width: Math.floor((parent.width - Kirigami.Units.smallSpacing + (Screen.devicePixelRatio != 1.0) * 2 * Screen.devicePixelRatio) * Screen.devicePixelRatio) / Screen.devicePixelRatio maximumLineCount: Plasmoid.configuration.textLines horizontalAlignment: Text.AlignHCenter } @@ -385,6 +397,11 @@ Item { anchors.rightMargin: 1 anchors.leftMargin: -1 } + StateChangeScript { + script: { + hidpi_hack.start(); + } + } }, State { // list view when: root.useListViewMode diff --git a/plasma/shells/io.gitgud.wackyideas.desktop/contents/views/Panel.qml b/plasma/shells/io.gitgud.wackyideas.desktop/contents/views/Panel.qml index 7372b9bf..d0e156ea 100644 --- a/plasma/shells/io.gitgud.wackyideas.desktop/contents/views/Panel.qml +++ b/plasma/shells/io.gitgud.wackyideas.desktop/contents/views/Panel.qml @@ -32,8 +32,6 @@ Item { } } - property real dpi: root.Window.window.devicePixelRatio - property Item containment property bool floatingPrefix: floatingPanelSvg.usedPrefix === "floating" readonly property bool verticalPanel: containment?.plasmoid?.formFactor === PlasmaCore.Types.Vertical @@ -153,7 +151,7 @@ Item { property var panelMask: floatingness === 0 ? (panelOpacity === 1 ? opaqueItem.mask : translucentItem.mask) : (panelOpacity === 1 ? floatingOpaqueItem.mask : floatingTranslucentItem.mask) // The point is read from panelview.cpp and is used as an offset for the mask - readonly property point floatingTranslucentItemOffset: Qt.point(floatingTranslucentItem.x+(root.rightEdge && root.dpi != 1.0 ? 1 : 0), floatingTranslucentItem.y+(root.bottomEdge && root.dpi != 1.0 ? 1 : 0)) + readonly property point floatingTranslucentItemOffset: Qt.point(floatingTranslucentItem.x, floatingTranslucentItem.y) KSvg.FrameSvgItem { id: translucentItem