mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge branch 'main' of https://github.com/noctalia-dev/noctalia-shell
This commit is contained in:
+18
-7
@@ -129,18 +129,29 @@ Item {
|
||||
target: BarService
|
||||
function onWidgetsRevisionChanged() {
|
||||
Logger.d("Bar", "onWidgetsRevisionChanged, revision:", BarService.widgetsRevision, "screen:", root.screen?.name);
|
||||
var widgets = Settings.getBarWidgetsForScreen(root.screen?.name);
|
||||
if (widgets) {
|
||||
root.syncWidgetModel(root.leftWidgetsModel, widgets.left);
|
||||
root.syncWidgetModel(root.centerWidgetsModel, widgets.center);
|
||||
root.syncWidgetModel(root.rightWidgetsModel, widgets.right);
|
||||
}
|
||||
Qt.callLater(root._syncFromRevision);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize models
|
||||
function _syncFromRevision() {
|
||||
var widgets = Settings.getBarWidgetsForScreen(screen?.name);
|
||||
if (widgets) {
|
||||
syncWidgetModel(leftWidgetsModel, widgets.left);
|
||||
syncWidgetModel(centerWidgetsModel, widgets.center);
|
||||
syncWidgetModel(rightWidgetsModel, widgets.right);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize models — deferred to next event-loop tick via Qt.callLater to avoid
|
||||
// re-entrant incubation: Component.onCompleted fires during QQmlObjectCreator::finalize,
|
||||
// and ListModel.append synchronously creates Repeater delegates whose own finalization
|
||||
// can corrupt the V4 heap (SIGSEGV in QV4::Object::insertMember).
|
||||
Component.onCompleted: {
|
||||
Logger.d("Bar", "Bar Component.onCompleted for screen:", screen?.name);
|
||||
Qt.callLater(root._initModels);
|
||||
}
|
||||
|
||||
function _initModels() {
|
||||
var widgets = Settings.getBarWidgetsForScreen(screen?.name);
|
||||
if (widgets) {
|
||||
syncWidgetModel(leftWidgetsModel, widgets.left);
|
||||
|
||||
@@ -22,8 +22,9 @@ Item {
|
||||
readonly property bool isScaling: internal.isScaling
|
||||
|
||||
// All Desktop widgets have these settings, but fallback just in case
|
||||
property bool showBackground: widgetData.showBackground !== undefined ? widgetData.showBackground : (widgetMetadata?.showBackground ?? true)
|
||||
property bool roundedCorners: widgetData.roundedCorners !== undefined ? widgetData.roundedCorners : (widgetMetadata?.roundedCorners ?? true)
|
||||
readonly property var _metadata: widgetData?.id ? DesktopWidgetRegistry.widgetMetadata[widgetData.id] : null
|
||||
property bool showBackground: widgetData.showBackground !== undefined ? widgetData.showBackground : (_metadata?.showBackground ?? true)
|
||||
property bool roundedCorners: widgetData.roundedCorners !== undefined ? widgetData.roundedCorners : (_metadata?.roundedCorners ?? true)
|
||||
|
||||
property real widgetScale: 1.0
|
||||
property real minScale: 0.5
|
||||
|
||||
@@ -131,18 +131,19 @@ ShapePath {
|
||||
fillColor: isRenderable ? Qt.rgba(backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a * opacityFactor) : "transparent"
|
||||
fillRule: isFramed ? ShapePath.OddEvenFill : ShapePath.WindingFill
|
||||
|
||||
// Starting position — falls back to off-screen (-1,-1) when not renderable so that
|
||||
// all subsequent path elements form a valid non-degenerate 1×1 off-screen square,
|
||||
// preventing CurveRenderer triangulation crashes on zero-area or bare-moveto paths.
|
||||
startX: isRenderable ? (isFramed ? 0 : (barMappedPos.x + leftEdgeOvs + tlRadius * tlMultX)) : -1
|
||||
// Starting position — falls back to off-screen when not renderable so that
|
||||
// all subsequent path elements form a valid non-degenerate off-screen square.
|
||||
// Each edge is split between PathLine and PathArc so no arc has zero displacement,
|
||||
// preventing CurveRenderer triangulation crashes on degenerate arcs.
|
||||
startX: isRenderable ? (isFramed ? 0 : (barMappedPos.x + leftEdgeOvs + tlRadius * tlMultX)) : -0.75
|
||||
startY: isRenderable ? (isFramed ? 0 : (barMappedPos.y + topEdgeOvs)) : -1
|
||||
|
||||
// ========== PATH DEFINITION ==========
|
||||
|
||||
// 1. Main Bar / Outer Screen Rectangle
|
||||
// When !isRenderable all elements use fallback coordinates forming a valid 1×1
|
||||
// off-screen square ((-1,-1)→(0,-1)→(0,0)→(-1,0)→(-1,-1)) so CurveRenderer
|
||||
// never receives a zero-area or bare-moveto path.
|
||||
// off-screen square with non-degenerate arcs so CurveRenderer never receives
|
||||
// a zero-area, bare-moveto, or zero-displacement arc path.
|
||||
PathLine {
|
||||
x: root.isRenderable ? (root.isFramed ? root.screenWidth : (root.barMappedPos.x + root.barWidth + root.rightEdgeOvs - root.trRadius * root.trMultX)) : 0
|
||||
y: root.isRenderable ? (root.isFramed ? 0 : (root.barMappedPos.y + root.topEdgeOvs)) : -1
|
||||
@@ -151,7 +152,7 @@ ShapePath {
|
||||
// Bar top-right corner (only if not framed)
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? root.screenWidth : (root.barMappedPos.x + root.barWidth + root.rightEdgeOvs)) : 0
|
||||
y: root.isRenderable ? (root.isFramed ? 0 : (root.barMappedPos.y + root.topEdgeOvs + root.trRadius * root.trMultY)) : -1
|
||||
y: root.isRenderable ? (root.isFramed ? 0 : (root.barMappedPos.y + root.topEdgeOvs + root.trRadius * root.trMultY)) : -0.75
|
||||
radiusX: root.isRenderable ? (root.isFramed ? 0 : root.trRadius) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? 0 : root.trRadius) : 0
|
||||
direction: ShapeCornerHelper.getArcDirection(root.trMultX, root.trMultY)
|
||||
@@ -164,7 +165,7 @@ ShapePath {
|
||||
|
||||
// Bar bottom-right corner (only if not framed)
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? root.screenWidth : (root.barMappedPos.x + root.barWidth + root.rightEdgeOvs - root.brRadius * root.brMultX)) : 0
|
||||
x: root.isRenderable ? (root.isFramed ? root.screenWidth : (root.barMappedPos.x + root.barWidth + root.rightEdgeOvs - root.brRadius * root.brMultX)) : -0.25
|
||||
y: root.isRenderable ? (root.isFramed ? root.screenHeight : (root.barMappedPos.y + root.barHeight + root.bottomEdgeOvs)) : 0
|
||||
radiusX: root.isRenderable ? (root.isFramed ? 0 : root.brRadius) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? 0 : root.brRadius) : 0
|
||||
@@ -179,7 +180,7 @@ ShapePath {
|
||||
// Bar bottom-left corner (only if not framed)
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? 0 : (root.barMappedPos.x + root.leftEdgeOvs)) : -1
|
||||
y: root.isRenderable ? (root.isFramed ? root.screenHeight : (root.barMappedPos.y + root.barHeight + root.bottomEdgeOvs - root.blRadius * root.blMultY)) : 0
|
||||
y: root.isRenderable ? (root.isFramed ? root.screenHeight : (root.barMappedPos.y + root.barHeight + root.bottomEdgeOvs - root.blRadius * root.blMultY)) : -0.25
|
||||
radiusX: root.isRenderable ? (root.isFramed ? 0 : root.blRadius) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? 0 : root.blRadius) : 0
|
||||
direction: ShapeCornerHelper.getArcDirection(root.blMultX, root.blMultY)
|
||||
@@ -192,7 +193,7 @@ ShapePath {
|
||||
|
||||
// Bar top-left corner (only if not framed, back to start)
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? 0 : (root.barMappedPos.x + root.leftEdgeOvs + root.tlRadius * root.tlMultX)) : -1
|
||||
x: root.isRenderable ? (root.isFramed ? 0 : (root.barMappedPos.x + root.leftEdgeOvs + root.tlRadius * root.tlMultX)) : -0.75
|
||||
y: root.isRenderable ? (root.isFramed ? 0 : (root.barMappedPos.y + root.topEdgeOvs)) : -1
|
||||
radiusX: root.isRenderable ? (root.isFramed ? 0 : root.tlRadius) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? 0 : root.tlRadius) : 0
|
||||
@@ -208,7 +209,7 @@ ShapePath {
|
||||
readonly property real _nhX: barMappedPos.x + barWidth / 2
|
||||
readonly property real _nhY: barMappedPos.y + barHeight / 2
|
||||
PathMove {
|
||||
x: root.isRenderable ? (root.isFramed ? (root.holeX + root.frameRadius) : root._nhX) : -3
|
||||
x: root.isRenderable ? (root.isFramed ? (root.holeX + root.frameRadius) : (root._nhX + 0.25)) : -2.75
|
||||
y: root.isRenderable ? (root.isFramed ? root.holeY : root._nhY) : -3
|
||||
}
|
||||
|
||||
@@ -221,7 +222,7 @@ ShapePath {
|
||||
// Top-right corner
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? (root.holeX + root.holeWidth) : (root._nhX + 1)) : -2
|
||||
y: root.isRenderable ? (root.isFramed ? (root.holeY + root.frameRadius) : root._nhY) : -3
|
||||
y: root.isRenderable ? (root.isFramed ? (root.holeY + root.frameRadius) : (root._nhY + 0.25)) : -2.75
|
||||
radiusX: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
direction: PathArc.Clockwise
|
||||
@@ -235,7 +236,7 @@ ShapePath {
|
||||
|
||||
// Bottom-right corner
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? (root.holeX + root.holeWidth - root.frameRadius) : (root._nhX + 1)) : -2
|
||||
x: root.isRenderable ? (root.isFramed ? (root.holeX + root.holeWidth - root.frameRadius) : (root._nhX + 0.75)) : -2.25
|
||||
y: root.isRenderable ? (root.isFramed ? (root.holeY + root.holeHeight) : (root._nhY + 1)) : -2
|
||||
radiusX: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
@@ -251,7 +252,7 @@ ShapePath {
|
||||
// Bottom-left corner
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? root.holeX : root._nhX) : -3
|
||||
y: root.isRenderable ? (root.isFramed ? (root.holeY + root.holeHeight - root.frameRadius) : (root._nhY + 1)) : -2
|
||||
y: root.isRenderable ? (root.isFramed ? (root.holeY + root.holeHeight - root.frameRadius) : (root._nhY + 0.75)) : -2.25
|
||||
radiusX: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
direction: PathArc.Clockwise
|
||||
@@ -265,7 +266,7 @@ ShapePath {
|
||||
|
||||
// Top-left corner (back to start)
|
||||
PathArc {
|
||||
x: root.isRenderable ? (root.isFramed ? (root.holeX + root.frameRadius) : root._nhX) : -3
|
||||
x: root.isRenderable ? (root.isFramed ? (root.holeX + root.frameRadius) : (root._nhX + 0.25)) : -2.75
|
||||
y: root.isRenderable ? (root.isFramed ? root.holeY : root._nhY) : -3
|
||||
radiusX: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
radiusY: root.isRenderable ? (root.isFramed ? root.frameRadius : 0) : 0
|
||||
|
||||
@@ -89,7 +89,9 @@ ShapePath {
|
||||
strokeWidth: -1 // No stroke, fill only
|
||||
|
||||
// Start point - use tiny off-screen non-degenerate fallback when not renderable.
|
||||
startX: isRenderable ? (panelX + tlRadius * tlMultX) : -1
|
||||
// Fallback forms a 1×1 off-screen square where each edge is split between a PathLine
|
||||
// and a PathArc, ensuring no arc has zero displacement (which can crash qTriangulate).
|
||||
startX: isRenderable ? (panelX + tlRadius * tlMultX) : -0.75
|
||||
startY: isRenderable ? panelY : -1
|
||||
|
||||
fillColor: isRenderable ? effectiveBackgroundColor : "transparent"
|
||||
@@ -100,14 +102,14 @@ ShapePath {
|
||||
|
||||
// Top edge (moving right)
|
||||
PathLine {
|
||||
relativeX: root.isRenderable ? (root.panelWidth - root.tlRadius * root.tlMultX - root.trRadius * root.trMultX) : 1
|
||||
relativeX: root.isRenderable ? (root.panelWidth - root.tlRadius * root.tlMultX - root.trRadius * root.trMultX) : 0.75
|
||||
relativeY: 0
|
||||
}
|
||||
|
||||
// Top-right corner arc
|
||||
PathArc {
|
||||
relativeX: root.isRenderable ? (root.trRadius * root.trMultX) : 0
|
||||
relativeY: root.isRenderable ? (root.trRadius * root.trMultY) : 0
|
||||
relativeY: root.isRenderable ? (root.trRadius * root.trMultY) : 0.25
|
||||
radiusX: root.isRenderable ? root.trRadius : 0
|
||||
radiusY: root.isRenderable ? root.trRadius : 0
|
||||
direction: ShapeCornerHelper.getArcDirection(root.trMultX, root.trMultY)
|
||||
@@ -116,12 +118,12 @@ ShapePath {
|
||||
// Right edge (moving down)
|
||||
PathLine {
|
||||
relativeX: 0
|
||||
relativeY: root.isRenderable ? (root.panelHeight - root.trRadius * root.trMultY - root.brRadius * root.brMultY) : 1
|
||||
relativeY: root.isRenderable ? (root.panelHeight - root.trRadius * root.trMultY - root.brRadius * root.brMultY) : 0.75
|
||||
}
|
||||
|
||||
// Bottom-right corner arc
|
||||
PathArc {
|
||||
relativeX: root.isRenderable ? (-root.brRadius * root.brMultX) : 0
|
||||
relativeX: root.isRenderable ? (-root.brRadius * root.brMultX) : -0.25
|
||||
relativeY: root.isRenderable ? (root.brRadius * root.brMultY) : 0
|
||||
radiusX: root.isRenderable ? root.brRadius : 0
|
||||
radiusY: root.isRenderable ? root.brRadius : 0
|
||||
@@ -130,14 +132,14 @@ ShapePath {
|
||||
|
||||
// Bottom edge (moving left)
|
||||
PathLine {
|
||||
relativeX: root.isRenderable ? (-(root.panelWidth - root.brRadius * root.brMultX - root.blRadius * root.blMultX)) : -1
|
||||
relativeX: root.isRenderable ? (-(root.panelWidth - root.brRadius * root.brMultX - root.blRadius * root.blMultX)) : -0.75
|
||||
relativeY: 0
|
||||
}
|
||||
|
||||
// Bottom-left corner arc
|
||||
PathArc {
|
||||
relativeX: root.isRenderable ? (-root.blRadius * root.blMultX) : 0
|
||||
relativeY: root.isRenderable ? (-root.blRadius * root.blMultY) : 0
|
||||
relativeY: root.isRenderable ? (-root.blRadius * root.blMultY) : -0.25
|
||||
radiusX: root.isRenderable ? root.blRadius : 0
|
||||
radiusY: root.isRenderable ? root.blRadius : 0
|
||||
direction: ShapeCornerHelper.getArcDirection(root.blMultX, root.blMultY)
|
||||
@@ -146,12 +148,12 @@ ShapePath {
|
||||
// Left edge (moving up) - closes the path back to start
|
||||
PathLine {
|
||||
relativeX: 0
|
||||
relativeY: root.isRenderable ? (-(root.panelHeight - root.blRadius * root.blMultY - root.tlRadius * root.tlMultY)) : -1
|
||||
relativeY: root.isRenderable ? (-(root.panelHeight - root.blRadius * root.blMultY - root.tlRadius * root.tlMultY)) : -0.75
|
||||
}
|
||||
|
||||
// Top-left corner arc (back to start)
|
||||
PathArc {
|
||||
relativeX: root.isRenderable ? (root.tlRadius * root.tlMultX) : 0
|
||||
relativeX: root.isRenderable ? (root.tlRadius * root.tlMultX) : 0.25
|
||||
relativeY: root.isRenderable ? (-root.tlRadius * root.tlMultY) : 0
|
||||
radiusX: root.isRenderable ? root.tlRadius : 0
|
||||
radiusY: root.isRenderable ? root.tlRadius : 0
|
||||
|
||||
Reference in New Issue
Block a user