mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-03 19:01:50 +00:00
Shadows: Unified in NFullScreenWindow
This commit is contained in:
+1
-19
@@ -49,7 +49,7 @@ Item {
|
||||
sourceComponent: Item {
|
||||
anchors.fill: parent
|
||||
|
||||
// Background fill with shadow
|
||||
// Background fill
|
||||
NShapedRectangle {
|
||||
id: bar
|
||||
|
||||
@@ -80,24 +80,6 @@ Item {
|
||||
// No border on the bar
|
||||
borderWidth: 0
|
||||
|
||||
// Shadow configuration
|
||||
shadowEnabled: true
|
||||
shadowBlur: 0.5
|
||||
// Fade shadow progressively when a panel is attached to the bar to avoid visual disconnection
|
||||
// shadowOpacity: {
|
||||
// if (PanelService.openedPanel && PanelService.openedPanel.attachedToBar) {
|
||||
// // Fade shadow out as panel opens (animationProgress goes from 0 to 1)
|
||||
// return 1.0 - PanelService.openedPanel.animationProgress
|
||||
// }
|
||||
// return 1.0
|
||||
// }
|
||||
Behavior on shadowOpacity {
|
||||
NumberAnimation {
|
||||
duration: Style.animationFast
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton
|
||||
|
||||
@@ -15,6 +15,16 @@ PanelWindow {
|
||||
required property var barComponent
|
||||
required property var panelComponents
|
||||
|
||||
// Shadow properties
|
||||
property bool shadowEnabled: true
|
||||
property real shadowOpacity: 1.0
|
||||
property real shadowBlur: 1.0
|
||||
property real shadowHorizontalOffset: 2
|
||||
property real shadowVerticalOffset: 3
|
||||
|
||||
property color black: "#000000"
|
||||
property color white: "#ffffff"
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.d("NFullScreenWindow", "Initialized for screen:", screen?.name, "- Dimensions:", screen?.width, "x", screen?.height, "- Position:", screen?.x, ",", screen?.y)
|
||||
}
|
||||
@@ -182,6 +192,23 @@ PanelWindow {
|
||||
width: root.width
|
||||
height: root.height
|
||||
|
||||
// Apply shadow effect
|
||||
layer.enabled: root.shadowEnabled
|
||||
layer.smooth: true
|
||||
// layer.textureSize: {
|
||||
// var dpr = CompositorService.getDisplayScale(screen.name)
|
||||
// return Qt.size(width * dpr, height * dpr)
|
||||
// }
|
||||
layer.effect: MultiEffect {
|
||||
shadowEnabled: root.shadowEnabled
|
||||
shadowOpacity: root.shadowOpacity
|
||||
shadowHorizontalOffset: root.shadowHorizontalOffset
|
||||
shadowVerticalOffset: root.shadowVerticalOffset
|
||||
shadowColor: black
|
||||
blur: root.shadowBlur
|
||||
blurMax: 32
|
||||
}
|
||||
|
||||
// Screen corners (integrated to avoid separate PanelWindow)
|
||||
// Always positioned at actual screen edges
|
||||
Loader {
|
||||
@@ -195,7 +222,7 @@ PanelWindow {
|
||||
id: cornersRoot
|
||||
anchors.fill: parent
|
||||
|
||||
property color cornerColor: Settings.data.general.forceBlackScreenCorners ? Qt.rgba(0, 0, 0, 1) : Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
|
||||
property color cornerColor: Settings.data.general.forceBlackScreenCorners ? black : Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
|
||||
property real cornerRadius: Style.screenRadius
|
||||
property real cornerSize: Style.screenRadius
|
||||
|
||||
@@ -220,7 +247,7 @@ PanelWindow {
|
||||
ctx.fillStyle = Qt.rgba(cornersRoot.cornerColor.r, cornersRoot.cornerColor.g, cornersRoot.cornerColor.b, cornersRoot.cornerColor.a)
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.fillStyle = white
|
||||
ctx.beginPath()
|
||||
ctx.arc(width, height, cornersRoot.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
@@ -253,7 +280,7 @@ PanelWindow {
|
||||
ctx.fillStyle = Qt.rgba(cornersRoot.cornerColor.r, cornersRoot.cornerColor.g, cornersRoot.cornerColor.b, cornersRoot.cornerColor.a)
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.fillStyle = white
|
||||
ctx.beginPath()
|
||||
ctx.arc(0, height, cornersRoot.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
@@ -286,7 +313,7 @@ PanelWindow {
|
||||
ctx.fillStyle = Qt.rgba(cornersRoot.cornerColor.r, cornersRoot.cornerColor.g, cornersRoot.cornerColor.b, cornersRoot.cornerColor.a)
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.fillStyle = white
|
||||
ctx.beginPath()
|
||||
ctx.arc(width, 0, cornersRoot.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
@@ -319,7 +346,7 @@ PanelWindow {
|
||||
ctx.fillStyle = Qt.rgba(cornersRoot.cornerColor.r, cornersRoot.cornerColor.g, cornersRoot.cornerColor.b, cornersRoot.cornerColor.a)
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
ctx.globalCompositeOperation = "destination-out"
|
||||
ctx.fillStyle = "#ffffff"
|
||||
ctx.fillStyle = white
|
||||
ctx.beginPath()
|
||||
ctx.arc(0, 0, cornersRoot.cornerRadius, 0, 2 * Math.PI)
|
||||
ctx.fill()
|
||||
@@ -411,14 +438,8 @@ PanelWindow {
|
||||
if (item) {
|
||||
// Set unique objectName per screen BEFORE registration: "calendarPanel-DP-1"
|
||||
item.objectName = panelId + "-" + (panelScreen?.name || "unknown")
|
||||
|
||||
// Set z-order for panels
|
||||
item.z = panelZIndex
|
||||
item.screen = panelScreen
|
||||
|
||||
// Now register with PanelService (after objectName is set)
|
||||
PanelService.registerPanel(item)
|
||||
|
||||
Logger.d("NFullScreenWindow", "Panel loaded with objectName:", item.objectName, "on screen:", panelScreen?.name)
|
||||
}
|
||||
}
|
||||
@@ -439,14 +460,11 @@ PanelWindow {
|
||||
onLoaded: {
|
||||
Logger.d("NFullScreenWindow", "Bar loaded:", item !== null)
|
||||
if (item) {
|
||||
Logger.d("NFullScreenWindow", "Bar size:", item.width, "x", item.height)
|
||||
// Bar always has highest z-index
|
||||
item.z = 100
|
||||
Logger.d("NFullScreenWindow", "Bar screen", item.screen?.name, "size:", item.width, "x", item.height)
|
||||
// Bind screen to bar component (use binding for reactivity)
|
||||
item.screen = Qt.binding(function () {
|
||||
return barLoader.screen
|
||||
})
|
||||
Logger.d("NFullScreenWindow", "Bar screen set to:", item.screen?.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ Item {
|
||||
}
|
||||
|
||||
// Animation offset for slide effect on bar-attached panels
|
||||
readonly property real slideOffset: root.attachedToBar ? (1 - root.animationProgress) * 20 : 0
|
||||
readonly property real slideOffset: root.attachedToBar ? (1 - root.animationProgress) * 40 : 0
|
||||
|
||||
// Position the panel using explicit x/y coordinates (no anchors)
|
||||
// This makes coordinates clearer for the click-through mask system
|
||||
|
||||
@@ -30,13 +30,6 @@ Item {
|
||||
property color borderColor: Color.mOutline
|
||||
property int borderWidth: Style.borderS
|
||||
|
||||
// Shadow properties
|
||||
property bool shadowEnabled: true
|
||||
property real shadowOpacity: 1.0 // 0.0 to 1.0
|
||||
property real shadowBlur: 0.9
|
||||
property real shadowHorizontalOffset: 3
|
||||
property real shadowVerticalOffset: 3
|
||||
|
||||
// Check if any corner is inverted
|
||||
readonly property bool hasInvertedCorners: topLeftInverted || topRightInverted || bottomLeftInverted || bottomRightInverted
|
||||
|
||||
@@ -46,26 +39,12 @@ Item {
|
||||
readonly property real leftPadding: Math.max((topLeftInverted && topLeftInvertedDirection === "horizontal") ? topLeftRadius : 0, (bottomLeftInverted && bottomLeftInvertedDirection === "horizontal") ? bottomLeftRadius : 0)
|
||||
readonly property real rightPadding: Math.max((topRightInverted && topRightInvertedDirection === "horizontal") ? topRightRadius : 0, (bottomRightInverted && bottomRightInvertedDirection === "horizontal") ? bottomRightRadius : 0)
|
||||
|
||||
// Background layer: shape with shadow effects (layer.enabled)
|
||||
// Background layer
|
||||
Item {
|
||||
id: shadowLayer
|
||||
id: backgroundLayer
|
||||
anchors.fill: parent
|
||||
z: 0
|
||||
|
||||
// Apply shadow effect to this layer only
|
||||
layer.enabled: root.shadowEnabled
|
||||
layer.smooth: true
|
||||
// layer.textureSize: Qt.size(width * Screen.devicePixelRatio, height * Screen.devicePixelRatio)
|
||||
layer.effect: MultiEffect {
|
||||
shadowEnabled: root.shadowEnabled
|
||||
shadowOpacity: root.shadowOpacity
|
||||
shadowColor: "#000000"
|
||||
shadowHorizontalOffset: root.shadowHorizontalOffset
|
||||
shadowVerticalOffset: root.shadowVerticalOffset
|
||||
blur: root.shadowBlur
|
||||
blurMax: 32
|
||||
}
|
||||
|
||||
// Simple rectangle for non-inverted corners (better performance)
|
||||
Rectangle {
|
||||
id: simpleBackground
|
||||
@@ -205,8 +184,7 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Content layer: for child elements (NO layer effects - keeps text sharp)
|
||||
// Child components can be added here and will render on top without blur
|
||||
// Content layer: for child elements
|
||||
default property alias contentChildren: contentLayer.data
|
||||
Item {
|
||||
id: contentLayer
|
||||
|
||||
@@ -233,52 +233,40 @@ ShellRoot {
|
||||
// Register all panel components
|
||||
panelComponents: [{
|
||||
"id": "launcherPanel",
|
||||
"component": launcherComponent,
|
||||
"zIndex": 50
|
||||
"component": launcherComponent
|
||||
}, {
|
||||
"id": "controlCenterPanel",
|
||||
"component": controlCenterComponent,
|
||||
"zIndex": 50
|
||||
"component": controlCenterComponent
|
||||
}, {
|
||||
"id": "calendarPanel",
|
||||
"component": calendarComponent,
|
||||
"zIndex": 50
|
||||
"component": calendarComponent
|
||||
}, {
|
||||
"id": "settingsPanel",
|
||||
"component": settingsComponent,
|
||||
"zIndex": 50
|
||||
"component": settingsComponent
|
||||
}, {
|
||||
"id": "directWidgetSettingsPanel",
|
||||
"component": directWidgetSettingsComponent,
|
||||
"zIndex": 50
|
||||
"component": directWidgetSettingsComponent
|
||||
}, {
|
||||
"id": "notificationHistoryPanel",
|
||||
"component": notificationHistoryComponent,
|
||||
"zIndex": 50
|
||||
"component": notificationHistoryComponent
|
||||
}, {
|
||||
"id": "sessionMenuPanel",
|
||||
"component": sessionMenuComponent,
|
||||
"zIndex": 50
|
||||
"component": sessionMenuComponent
|
||||
}, {
|
||||
"id": "wifiPanel",
|
||||
"component": wifiComponent,
|
||||
"zIndex": 50
|
||||
"component": wifiComponent
|
||||
}, {
|
||||
"id": "bluetoothPanel",
|
||||
"component": bluetoothComponent,
|
||||
"zIndex": 50
|
||||
"component": bluetoothComponent
|
||||
}, {
|
||||
"id": "audioPanel",
|
||||
"component": audioComponent,
|
||||
"zIndex": 50
|
||||
"component": audioComponent
|
||||
}, {
|
||||
"id": "wallpaperPanel",
|
||||
"component": wallpaperComponent,
|
||||
"zIndex": 50
|
||||
"component": wallpaperComponent
|
||||
}, {
|
||||
"id": "batteryPanel",
|
||||
"component": batteryComponent,
|
||||
"zIndex": 50
|
||||
"component": batteryComponent
|
||||
}]
|
||||
|
||||
// Bar component
|
||||
|
||||
Reference in New Issue
Block a user