[vlc-devel] [PATCH 03/38] qml: alter dp() so that it accepts negative values

Fatih Uzunoglu fuzun54 at outlook.com
Thu Aug 20 19:55:12 CEST 2020


---
 modules/gui/qt/style/VLCStyle.qml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/style/VLCStyle.qml b/modules/gui/qt/style/VLCStyle.qml
index 061ca40cbd..50aab35b5e 100644
--- a/modules/gui/qt/style/VLCStyle.qml
+++ b/modules/gui/qt/style/VLCStyle.qml
@@ -195,7 +195,14 @@ Item {
     function dp(px, scale) {
         if (typeof scale === "undefined")
             scale = mainInterface.intfScaleFactor
-        return Math.max(1, Math.round(px * scale))
+
+        var scaledPx = Math.round(px * scale)
+        if (scaledPx < 0)
+            return Math.min(-1, scaledPx)
+        else if (scaledPx > 0)
+            return Math.max(1, scaledPx)
+        else // scaledPx == 0
+            return 0
     }
 
     function colWidth(nb) {
-- 
2.25.1



More information about the vlc-devel mailing list