Merge pull request 'fix blobs dirty tracking' (#87) from blob-testing into main
Reviewed-on: #87 Reviewed-by: AramJonghu <2+aramjonghu@noreply.git.zach-dev.cc>
This commit was merged in pull request #87.
This commit is contained in:
@@ -7,4 +7,8 @@ JsonObject {
|
|||||||
property real alignX: 0.5
|
property real alignX: 0.5
|
||||||
property real alignY: 0.5
|
property real alignY: 0.5
|
||||||
property real zoom: 1.0
|
property real zoom: 1.0
|
||||||
|
property real sourceClipX: 0
|
||||||
|
property real sourceClipY: 0
|
||||||
|
property real sourceClipW: 0
|
||||||
|
property real sourceClipH: 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ JsonObject {
|
|||||||
property Popouts popouts: Popouts {
|
property Popouts popouts: Popouts {
|
||||||
}
|
}
|
||||||
property int rounding: 8
|
property int rounding: 8
|
||||||
|
property int smoothing: 32
|
||||||
|
|
||||||
component Popouts: JsonObject {
|
component Popouts: JsonObject {
|
||||||
property bool activeWindow: true
|
property bool activeWindow: true
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ Singleton {
|
|||||||
wallFadeDuration: background.wallFadeDuration,
|
wallFadeDuration: background.wallFadeDuration,
|
||||||
enabled: background.enabled,
|
enabled: background.enabled,
|
||||||
alignX: background.alignX,
|
alignX: background.alignX,
|
||||||
|
sourceClipX: background.sourceClipX,
|
||||||
|
sourceClipY: background.sourceClipY,
|
||||||
|
sourceClipW: background.sourceClipW,
|
||||||
|
sourceClipH: background.sourceClipH,
|
||||||
alignY: background.alignY,
|
alignY: background.alignY,
|
||||||
zoom: background.zoom
|
zoom: background.zoom
|
||||||
};
|
};
|
||||||
@@ -94,6 +98,7 @@ Singleton {
|
|||||||
hideWhenNotif: barConfig.hideWhenNotif,
|
hideWhenNotif: barConfig.hideWhenNotif,
|
||||||
rounding: barConfig.rounding,
|
rounding: barConfig.rounding,
|
||||||
border: barConfig.border,
|
border: barConfig.border,
|
||||||
|
smoothing: barConfig.smoothing,
|
||||||
height: barConfig.height,
|
height: barConfig.height,
|
||||||
popouts: {
|
popouts: {
|
||||||
tray: barConfig.popouts.tray,
|
tray: barConfig.popouts.tray,
|
||||||
@@ -236,6 +241,7 @@ Singleton {
|
|||||||
return {
|
return {
|
||||||
recolorLogo: lock.recolorLogo,
|
recolorLogo: lock.recolorLogo,
|
||||||
enableFprint: lock.enableFprint,
|
enableFprint: lock.enableFprint,
|
||||||
|
showNotifContent: lock.showNotifContent,
|
||||||
maxFprintTries: lock.maxFprintTries,
|
maxFprintTries: lock.maxFprintTries,
|
||||||
blurAmount: lock.blurAmount,
|
blurAmount: lock.blurAmount,
|
||||||
sizes: {
|
sizes: {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ JsonObject {
|
|||||||
property bool enableFprint: true
|
property bool enableFprint: true
|
||||||
property int maxFprintTries: 3
|
property int maxFprintTries: 3
|
||||||
property bool recolorLogo: false
|
property bool recolorLogo: false
|
||||||
|
property bool showNotifContent: false
|
||||||
property Sizes sizes: Sizes {
|
property Sizes sizes: Sizes {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-174
@@ -3,184 +3,33 @@ import QtQuick
|
|||||||
Canvas {
|
Canvas {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property rect dirtyRect: Qt.rect(0, 0, 0, 0)
|
|
||||||
property bool frameQueued: false
|
|
||||||
property bool fullRepaintPending: true
|
|
||||||
property point lastPoint: Qt.point(0, 0)
|
|
||||||
property real minPointDistance: 2.0
|
|
||||||
property color penColor: "white"
|
property color penColor: "white"
|
||||||
property real penWidth: 4
|
property real penWidth: 4
|
||||||
property var pendingSegments: []
|
property var points: []
|
||||||
property bool strokeActive: false
|
|
||||||
property var strokes: []
|
|
||||||
|
|
||||||
function appendPoint(x, y) {
|
function clear(): void {
|
||||||
if (!strokeActive || strokes.length === 0)
|
var ctx = getContext('2d');
|
||||||
|
root.points = [];
|
||||||
|
ctx.reset();
|
||||||
|
root.requestPaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
renderStrategy: Canvas.Cooperative
|
||||||
|
|
||||||
|
onPaint: {
|
||||||
|
if (points.length < 2)
|
||||||
return;
|
return;
|
||||||
const dx = x - lastPoint.x;
|
var ctx = root.getContext('2d');
|
||||||
const dy = y - lastPoint.y;
|
ctx.save();
|
||||||
|
ctx.lineWidth = root.penWidth;
|
||||||
if ((dx * dx + dy * dy) < (minPointDistance * minPointDistance))
|
ctx.strokeStyle = root.penColor;
|
||||||
return;
|
|
||||||
const x1 = lastPoint.x;
|
|
||||||
const y1 = lastPoint.y;
|
|
||||||
const x2 = x;
|
|
||||||
const y2 = y;
|
|
||||||
|
|
||||||
strokes[strokes.length - 1].push(Qt.point(x2, y2));
|
|
||||||
|
|
||||||
pendingSegments.push({
|
|
||||||
dot: false,
|
|
||||||
x1: x1,
|
|
||||||
y1: y1,
|
|
||||||
x2: x2,
|
|
||||||
y2: y2
|
|
||||||
});
|
|
||||||
|
|
||||||
lastPoint = Qt.point(x2, y2);
|
|
||||||
queueDirty(segmentDirtyRect(x1, y1, x2, y2));
|
|
||||||
}
|
|
||||||
|
|
||||||
function beginStroke(x, y) {
|
|
||||||
const p = Qt.point(x, y);
|
|
||||||
strokes.push([p]);
|
|
||||||
lastPoint = p;
|
|
||||||
strokeActive = true;
|
|
||||||
|
|
||||||
pendingSegments.push({
|
|
||||||
dot: true,
|
|
||||||
x: x,
|
|
||||||
y: y
|
|
||||||
});
|
|
||||||
|
|
||||||
queueDirty(pointDirtyRect(x, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
function clear() {
|
|
||||||
strokes = [];
|
|
||||||
pendingSegments = [];
|
|
||||||
dirtyRect = Qt.rect(0, 0, 0, 0);
|
|
||||||
fullRepaintPending = true;
|
|
||||||
markDirty(Qt.rect(0, 0, width, height));
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawDot(ctx, x, y) {
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.arc(x, y, penWidth / 2, 0, Math.PI * 2);
|
|
||||||
ctx.fill();
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawSegment(ctx, x1, y1, x2, y2) {
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(x1, y1);
|
|
||||||
ctx.lineTo(x2, y2);
|
|
||||||
ctx.stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
function endStroke() {
|
|
||||||
strokeActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pointDirtyRect(x, y) {
|
|
||||||
const pad = penWidth + 2;
|
|
||||||
return Qt.rect(x - pad, y - pad, pad * 2, pad * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function queueDirty(r) {
|
|
||||||
dirtyRect = unionRects(dirtyRect, r);
|
|
||||||
|
|
||||||
if (frameQueued)
|
|
||||||
return;
|
|
||||||
frameQueued = true;
|
|
||||||
|
|
||||||
requestAnimationFrame(function () {
|
|
||||||
frameQueued = false;
|
|
||||||
|
|
||||||
if (dirtyRect.width > 0 && dirtyRect.height > 0) {
|
|
||||||
markDirty(dirtyRect);
|
|
||||||
dirtyRect = Qt.rect(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function replayAll(ctx) {
|
|
||||||
ctx.clearRect(0, 0, width, height);
|
|
||||||
|
|
||||||
for (const stroke of strokes) {
|
|
||||||
if (!stroke || stroke.length === 0)
|
|
||||||
continue;
|
|
||||||
if (stroke.length === 1) {
|
|
||||||
const p = stroke[0];
|
|
||||||
drawDot(ctx, p.x, p.y);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(stroke[0].x, stroke[0].y);
|
|
||||||
for (let i = 1; i < stroke.length; ++i)
|
|
||||||
ctx.lineTo(stroke[i].x, stroke[i].y);
|
|
||||||
ctx.stroke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function requestFullRepaint() {
|
|
||||||
fullRepaintPending = true;
|
|
||||||
markDirty(Qt.rect(0, 0, width, height));
|
|
||||||
}
|
|
||||||
|
|
||||||
function segmentDirtyRect(x1, y1, x2, y2) {
|
|
||||||
const pad = penWidth + 2;
|
|
||||||
const left = Math.min(x1, x2) - pad;
|
|
||||||
const top = Math.min(y1, y2) - pad;
|
|
||||||
const right = Math.max(x1, x2) + pad;
|
|
||||||
const bottom = Math.max(y1, y2) + pad;
|
|
||||||
return Qt.rect(left, top, right - left, bottom - top);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unionRects(a, b) {
|
|
||||||
if (a.width <= 0 || a.height <= 0)
|
|
||||||
return b;
|
|
||||||
if (b.width <= 0 || b.height <= 0)
|
|
||||||
return a;
|
|
||||||
|
|
||||||
const left = Math.min(a.x, b.x);
|
|
||||||
const top = Math.min(a.y, b.y);
|
|
||||||
const right = Math.max(a.x + a.width, b.x + b.width);
|
|
||||||
const bottom = Math.max(a.y + a.height, b.y + b.height);
|
|
||||||
|
|
||||||
return Qt.rect(left, top, right - left, bottom - top);
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
contextType: "2d"
|
|
||||||
renderStrategy: Canvas.Threaded
|
|
||||||
renderTarget: Canvas.Image
|
|
||||||
|
|
||||||
onHeightChanged: requestFullRepaint()
|
|
||||||
onPaint: region => {
|
|
||||||
const ctx = getContext("2d");
|
|
||||||
|
|
||||||
ctx.lineCap = "round";
|
ctx.lineCap = "round";
|
||||||
ctx.lineJoin = "round";
|
ctx.beginPath();
|
||||||
ctx.lineWidth = penWidth;
|
ctx.moveTo(points[0].x, points[0].y);
|
||||||
ctx.strokeStyle = penColor;
|
for (var i = 1; i < points.length; i++)
|
||||||
ctx.fillStyle = penColor;
|
ctx.lineTo(points[i].x, points[i].y);
|
||||||
|
ctx.stroke();
|
||||||
if (fullRepaintPending) {
|
points = points.slice(points.length - 2);
|
||||||
fullRepaintPending = false;
|
ctx.restore();
|
||||||
replayAll(ctx);
|
|
||||||
pendingSegments = [];
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const seg of pendingSegments) {
|
|
||||||
if (seg.dot)
|
|
||||||
drawDot(ctx, seg.x, seg.y);
|
|
||||||
else
|
|
||||||
drawSegment(ctx, seg.x1, seg.y1, seg.x2, seg.y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
pendingSegments = [];
|
|
||||||
}
|
|
||||||
onWidthChanged: requestFullRepaint()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ CustomMouseArea {
|
|||||||
const x = event.x;
|
const x = event.x;
|
||||||
const y = event.y;
|
const y = event.y;
|
||||||
|
|
||||||
if (event.buttons & Qt.LeftButton)
|
if (root.visibilities.isDrawing && (event.buttons & Qt.LeftButton)) {
|
||||||
root.drawing.appendPoint(x, y);
|
root.drawing.points.push(Qt.point(x, y));
|
||||||
|
root.drawing.requestPaint();
|
||||||
|
}
|
||||||
|
|
||||||
if (root.inLeftPanel(root.popout, x, y)) {
|
if (root.inLeftPanel(root.popout, x, y)) {
|
||||||
root.z = -2;
|
root.z = -2;
|
||||||
@@ -44,7 +46,8 @@ CustomMouseArea {
|
|||||||
|
|
||||||
if (root.visibilities.isDrawing && (event.buttons & Qt.LeftButton)) {
|
if (root.visibilities.isDrawing && (event.buttons & Qt.LeftButton)) {
|
||||||
root.panels.drawing.expanded = false;
|
root.panels.drawing.expanded = false;
|
||||||
root.drawing.beginStroke(x, y);
|
root.drawing.points.push(Qt.point(x, y));
|
||||||
|
root.drawing.requestPaint();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +55,6 @@ CustomMouseArea {
|
|||||||
root.drawing.clear();
|
root.drawing.clear();
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
if (root.visibilities.isDrawing)
|
root.drawing.points = [];
|
||||||
root.drawing.endStroke();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ CustomMouseArea {
|
|||||||
const dragY = y - dragStart.y;
|
const dragY = y - dragStart.y;
|
||||||
|
|
||||||
if (root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, x, y)) {
|
if (root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, x, y)) {
|
||||||
root.input.z = 2;
|
// root.input.z = 2;
|
||||||
root.panels.drawing.expanded = false;
|
root.panels.drawing.expanded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Item {
|
|||||||
readonly property alias resourcesWrapper: resourcesWrapper
|
readonly property alias resourcesWrapper: resourcesWrapper
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
readonly property alias settings: settings
|
readonly property alias settings: settings
|
||||||
|
readonly property alias settingsWrapper: settingsWrapper
|
||||||
readonly property alias sidebar: sidebar
|
readonly property alias sidebar: sidebar
|
||||||
readonly property alias toasts: toasts
|
readonly property alias toasts: toasts
|
||||||
readonly property alias utilities: utilities
|
readonly property alias utilities: utilities
|
||||||
@@ -176,6 +177,15 @@ Item {
|
|||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: settingsWrapper
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
clip: true
|
||||||
|
implicitHeight: settings.implicitHeight * (1 - settings.offsetScale)
|
||||||
|
implicitWidth: settings.implicitWidth
|
||||||
|
|
||||||
Settings.Wrapper {
|
Settings.Wrapper {
|
||||||
id: settings
|
id: settings
|
||||||
|
|
||||||
@@ -186,6 +196,7 @@ Item {
|
|||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Dock.Wrapper {
|
Dock.Wrapper {
|
||||||
id: dock
|
id: dock
|
||||||
|
|||||||
+30
-17
@@ -158,6 +158,7 @@ Variants {
|
|||||||
id: blobGroup
|
id: blobGroup
|
||||||
|
|
||||||
color: DynamicColors.palette.m3surface
|
color: DynamicColors.palette.m3surface
|
||||||
|
smoothing: Config.barConfig.smoothing
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {
|
||||||
@@ -179,28 +180,34 @@ Variants {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: dashBg
|
id: dashBg
|
||||||
|
|
||||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
property real extraHeight: 0.2
|
||||||
implicitHeight: panels.dashboard.height
|
|
||||||
|
deformAmount: 0.08
|
||||||
|
implicitHeight: panels.dashboard.height * (1 + extraHeight)
|
||||||
implicitWidth: panels.dashboard.width
|
implicitWidth: panels.dashboard.width
|
||||||
panel: panels.dashboard
|
panel: panels.dashboardWrapper
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
x: panels.dashboardWrapper.x + panels.dashboard.x + Config.barConfig.border
|
x: panels.dashboardWrapper.x + panels.dashboard.x + Config.barConfig.border
|
||||||
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight
|
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight - panels.dashboard.height * extraHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
id: launcherBg
|
id: launcherBg
|
||||||
|
|
||||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
property real extraHeight: 0.2
|
||||||
|
|
||||||
|
deformAmount: 0.08
|
||||||
|
implicitHeight: panels.launcher.height * (1 + extraHeight)
|
||||||
panel: panels.launcher
|
panel: panels.launcher
|
||||||
radius: Appearance.rounding.smallest + 5
|
radius: Appearance.rounding.smallest + 5
|
||||||
|
y: panels.launcher.y + bar.implicitHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
id: sidebarBg
|
id: sidebarBg
|
||||||
|
|
||||||
bottomLeftRadius: 0
|
bottomLeftRadius: 0
|
||||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
deformAmount: 0.08
|
||||||
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [utilsBg]
|
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [utilsBg]
|
||||||
implicitHeight: panel.height * (1 / rawDeformMatrix.m22) + 2
|
implicitHeight: panel.height * (1 / rawDeformMatrix.m22) + 2
|
||||||
panel: panels.sidebar
|
panel: panels.sidebar
|
||||||
@@ -209,10 +216,10 @@ Variants {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: osdBg
|
id: osdBg
|
||||||
|
|
||||||
deformAmount: 0.1 * Config.appearance.deform.scale
|
deformAmount: 0.1
|
||||||
implicitHeight: panels.osd.height
|
implicitHeight: panels.osd.height
|
||||||
implicitWidth: panels.osd.width
|
implicitWidth: panels.osd.width
|
||||||
panel: panels.osd
|
panel: panels.osdWrapper
|
||||||
radius: 20
|
radius: 20
|
||||||
x: panels.osdWrapper.x + panels.osd.x + Config.barConfig.border
|
x: panels.osdWrapper.x + panels.osd.x + Config.barConfig.border
|
||||||
y: panels.osdWrapper.y + panels.osd.y + bar.implicitHeight
|
y: panels.osdWrapper.y + panels.osd.y + bar.implicitHeight
|
||||||
@@ -227,7 +234,7 @@ Variants {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: utilsBg
|
id: utilsBg
|
||||||
|
|
||||||
deformAmount: panels.sidebar.visible ? (0.1 * Config.appearance.deform.scale) : (0.1 * Config.appearance.deform.scale)
|
deformAmount: panels.sidebar.visible ? (0.1) : (0.1)
|
||||||
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [sidebarBg]
|
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [sidebarBg]
|
||||||
panel: panels.utilities
|
panel: panels.utilities
|
||||||
topLeftRadius: 0
|
topLeftRadius: 0
|
||||||
@@ -238,10 +245,10 @@ Variants {
|
|||||||
|
|
||||||
property real extraHeight: panels.popouts.isDetached ? 0 : 0.2
|
property real extraHeight: panels.popouts.isDetached ? 0 : 0.2
|
||||||
|
|
||||||
deformAmount: panels.popouts.isDetached ? 0.05 * Config.appearance.deform.scale : panels.popouts.hasCurrent ? 0.15 * Config.appearance.deform.scale : 0.1 * Config.appearance.deform.scale
|
deformAmount: panels.popouts.isDetached ? 0.05 : panels.popouts.hasCurrent ? 0.15 : 0.1
|
||||||
implicitHeight: panels.popouts.height * (1 + extraHeight)
|
implicitHeight: panels.popouts.height * (1 + extraHeight)
|
||||||
implicitWidth: panels.popouts.width
|
implicitWidth: panels.popouts.width
|
||||||
panel: panels.popouts
|
panel: panels.popoutsWrapper
|
||||||
radius: (panels.popouts.currentName.startsWith("audio") || panels.popouts.currentName.startsWith("updates")) ? Appearance.rounding.normal : 20 * Appearance.rounding.scale
|
radius: (panels.popouts.currentName.startsWith("audio") || panels.popouts.currentName.startsWith("updates")) ? Appearance.rounding.normal : 20 * Appearance.rounding.scale
|
||||||
x: panels.popoutsWrapper.x + panels.popouts.x + Config.barConfig.border
|
x: panels.popoutsWrapper.x + panels.popouts.x + Config.barConfig.border
|
||||||
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
|
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
|
||||||
@@ -255,10 +262,10 @@ Variants {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: resourcesBg
|
id: resourcesBg
|
||||||
|
|
||||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
deformAmount: 0.08
|
||||||
implicitHeight: panels.resources.height
|
implicitHeight: panels.resources.height
|
||||||
implicitWidth: panels.resources.width
|
implicitWidth: panels.resources.width
|
||||||
panel: panels.resources
|
panel: panels.resourcesWrapper
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
x: panels.resourcesWrapper.x + panels.resources.x + Config.barConfig.border
|
x: panels.resourcesWrapper.x + panels.resources.x + Config.barConfig.border
|
||||||
y: panels.resourcesWrapper.y + panels.resources.y + bar.implicitHeight
|
y: panels.resourcesWrapper.y + panels.resources.y + bar.implicitHeight
|
||||||
@@ -267,17 +274,23 @@ Variants {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: settingsBg
|
id: settingsBg
|
||||||
|
|
||||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
property real extraHeight: 0.2
|
||||||
|
|
||||||
|
deformAmount: 0.08
|
||||||
|
implicitHeight: panels.settings.height * (1 + extraHeight)
|
||||||
|
implicitWidth: panels.settings.width
|
||||||
panel: panels.settings
|
panel: panels.settings
|
||||||
radius: Appearance.rounding.large
|
radius: Appearance.rounding.large
|
||||||
topLeftRadius: Appearance.rounding.large + Appearance.padding.smaller
|
topLeftRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||||
topRightRadius: Appearance.rounding.large + Appearance.padding.smaller
|
topRightRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||||
|
x: panels.settingsWrapper.x + panels.settings.x + Config.barConfig.border
|
||||||
|
y: panels.settingsWrapper.y + panels.settings.y + bar.implicitHeight - panels.settings.height * extraHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
id: dockBg
|
id: dockBg
|
||||||
|
|
||||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
deformAmount: 0.08
|
||||||
panel: panels.dock
|
panel: panels.dock
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
}
|
}
|
||||||
@@ -285,7 +298,7 @@ Variants {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: drawingBg
|
id: drawingBg
|
||||||
|
|
||||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
deformAmount: 0.08
|
||||||
panel: panels.drawing
|
panel: panels.drawing
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
}
|
}
|
||||||
@@ -380,7 +393,7 @@ Variants {
|
|||||||
property real deformAmount: 0.15
|
property real deformAmount: 0.15
|
||||||
required property Item panel
|
required property Item panel
|
||||||
|
|
||||||
deformScale: deformAmount / 10000
|
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
||||||
group: blobGroup
|
group: blobGroup
|
||||||
implicitHeight: panel.height
|
implicitHeight: panel.height
|
||||||
implicitWidth: panel.width
|
implicitWidth: panel.width
|
||||||
|
|||||||
@@ -346,7 +346,6 @@ Singleton {
|
|||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
console.log("this is running");
|
|
||||||
if (root.gpuType === "GENERIC") {
|
if (root.gpuType === "GENERIC") {
|
||||||
const percs = text.trim().split("\n");
|
const percs = text.trim().split("\n");
|
||||||
const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0);
|
const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0);
|
||||||
|
|||||||
+20
-44
@@ -7,23 +7,30 @@ import QtQuick
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// The list of users that can log in graphically
|
readonly property string defaultUserFile: "/etc/zshell-greeter/default-user"
|
||||||
// Each user object has: username, uid, home, shell, gecos (full name), face (avatar path)
|
property int selectedIndex: 0
|
||||||
|
readonly property var selectedUser: selectedIndex >= 0 && selectedIndex < users.length ? users[selectedIndex] : null
|
||||||
|
readonly property string selectedUsername: selectedUser ? selectedUser.username : ""
|
||||||
property var users: []
|
property var users: []
|
||||||
|
|
||||||
// The currently selected user index
|
function saveDefaultUser(): void {
|
||||||
property int selectedIndex: 0
|
if (selectedUser) {
|
||||||
|
defaultUserStorage.setText(selectedUser.username);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The currently selected user object (or null if none)
|
function selectNext(): void {
|
||||||
readonly property var selectedUser: selectedIndex >= 0 && selectedIndex < users.length ? users[selectedIndex] : null
|
if (users.length === 0)
|
||||||
|
return;
|
||||||
|
selectedIndex = (selectedIndex + 1) % users.length;
|
||||||
|
}
|
||||||
|
|
||||||
// Convenience property for the selected username
|
function selectPrevious(): void {
|
||||||
readonly property string selectedUsername: selectedUser ? selectedUser.username : ""
|
if (users.length === 0)
|
||||||
|
return;
|
||||||
|
selectedIndex = (selectedIndex - 1 + users.length) % users.length;
|
||||||
|
}
|
||||||
|
|
||||||
// Path to store the default user preference
|
|
||||||
readonly property string defaultUserFile: "/etc/zshell-greeter/default-user"
|
|
||||||
|
|
||||||
// Select a user by username
|
|
||||||
function selectUser(username: string): bool {
|
function selectUser(username: string): bool {
|
||||||
for (let i = 0; i < users.length; i++) {
|
for (let i = 0; i < users.length; i++) {
|
||||||
if (users[i].username === username) {
|
if (users[i].username === username) {
|
||||||
@@ -34,28 +41,6 @@ Singleton {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the next user in the list (wraps around)
|
|
||||||
function selectNext(): void {
|
|
||||||
if (users.length === 0)
|
|
||||||
return;
|
|
||||||
selectedIndex = (selectedIndex + 1) % users.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select the previous user in the list (wraps around)
|
|
||||||
function selectPrevious(): void {
|
|
||||||
if (users.length === 0)
|
|
||||||
return;
|
|
||||||
selectedIndex = (selectedIndex - 1 + users.length) % users.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the current user as the default for next login
|
|
||||||
function saveDefaultUser(): void {
|
|
||||||
if (selectedUser) {
|
|
||||||
defaultUserStorage.setText(selectedUser.username);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process to fetch the list of graphical users
|
|
||||||
Process {
|
Process {
|
||||||
id: userLister
|
id: userLister
|
||||||
|
|
||||||
@@ -67,13 +52,10 @@ Singleton {
|
|||||||
try {
|
try {
|
||||||
root.users = JSON.parse(text);
|
root.users = JSON.parse(text);
|
||||||
|
|
||||||
// If we have users and no selection yet, try to select the default user
|
|
||||||
if (root.users.length > 0) {
|
if (root.users.length > 0) {
|
||||||
// Try to load the default user
|
|
||||||
if (defaultUserStorage.loaded) {
|
if (defaultUserStorage.loaded) {
|
||||||
const defaultUsername = defaultUserStorage.text().trim();
|
const defaultUsername = defaultUserStorage.text().trim();
|
||||||
if (defaultUsername && !root.selectUser(defaultUsername)) {
|
if (defaultUsername && !root.selectUser(defaultUsername)) {
|
||||||
// Default user not found, select first user
|
|
||||||
root.selectedIndex = 0;
|
root.selectedIndex = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -87,15 +69,14 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FileView for persisting the default user
|
|
||||||
FileView {
|
FileView {
|
||||||
id: defaultUserStorage
|
id: defaultUserStorage
|
||||||
|
|
||||||
path: root.defaultUserFile
|
path: root.defaultUserFile
|
||||||
preload: true
|
preload: true
|
||||||
|
|
||||||
|
onLoadFailed: {}
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
// If users are already loaded, try to select the default user
|
|
||||||
if (root.users.length > 0) {
|
if (root.users.length > 0) {
|
||||||
const defaultUsername = text().trim();
|
const defaultUsername = text().trim();
|
||||||
if (defaultUsername) {
|
if (defaultUsername) {
|
||||||
@@ -103,10 +84,5 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoadFailed: {
|
|
||||||
// File doesn't exist yet, that's fine - we'll create it on first save
|
|
||||||
console.log("No default user file found, will use first user");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Searcher {
|
|||||||
property string actualCurrent: WallpaperPath.currentWallpaperPath
|
property string actualCurrent: WallpaperPath.currentWallpaperPath
|
||||||
readonly property string current: showPreview ? previewPath : actualCurrent
|
readonly property string current: showPreview ? previewPath : actualCurrent
|
||||||
property string previewPath
|
property string previewPath
|
||||||
|
property bool recentlyChanged
|
||||||
property bool showPreview: false
|
property bool showPreview: false
|
||||||
|
|
||||||
function preview(path: string): void {
|
function preview(path: string): void {
|
||||||
|
|||||||
+22
-74
@@ -12,90 +12,29 @@ Item {
|
|||||||
|
|
||||||
required property Canvas drawing
|
required property Canvas drawing
|
||||||
property bool expanded: true
|
property bool expanded: true
|
||||||
|
property real offsetScale: shouldBeActive ? 0 : 1
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
readonly property bool shouldBeActive: visibilities.isDrawing
|
readonly property bool shouldBeActive: visibilities.isDrawing
|
||||||
required property var visibilities
|
required property var visibilities
|
||||||
|
|
||||||
|
anchors.leftMargin: (-implicitWidth - 5) * offsetScale
|
||||||
implicitHeight: content.implicitHeight
|
implicitHeight: content.implicitHeight
|
||||||
implicitWidth: 0
|
implicitWidth: root.expanded ? content.implicitWidth : icon.implicitWidth
|
||||||
visible: width > 0
|
opacity: 1 - offsetScale
|
||||||
|
visible: offsetScale < 1
|
||||||
|
|
||||||
states: [
|
Behavior on implicitWidth {
|
||||||
State {
|
|
||||||
name: "hidden"
|
|
||||||
when: !root.shouldBeActive
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
root.implicitWidth: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
icon.opacity: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
content.opacity: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "collapsed"
|
|
||||||
when: root.shouldBeActive && !root.expanded
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
root.implicitWidth: icon.implicitWidth
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
icon.opacity: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
content.opacity: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "visible"
|
|
||||||
when: root.shouldBeActive && root.expanded
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
root.implicitWidth: content.implicitWidth
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
icon.opacity: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
content.opacity: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
transitions: [
|
|
||||||
Transition {
|
|
||||||
from: "*"
|
|
||||||
to: "*"
|
|
||||||
|
|
||||||
ParallelAnimation {
|
|
||||||
Anim {
|
Anim {
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
property: "implicitWidth"
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
target: root
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Behavior on offsetScale {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Appearance.anim.durations.small
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
property: "opacity"
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
target: icon
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
duration: Appearance.anim.durations.small
|
|
||||||
property: "opacity"
|
|
||||||
target: content
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (!visible)
|
if (!visible)
|
||||||
@@ -109,8 +48,12 @@ Item {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
height: content.contentItem.height
|
height: content.contentItem.height
|
||||||
opacity: 1
|
opacity: root.expanded ? 0 : 1
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {
|
||||||
|
}
|
||||||
|
}
|
||||||
sourceComponent: MaterialIcon {
|
sourceComponent: MaterialIcon {
|
||||||
font.pointSize: Appearance.font.size.larger
|
font.pointSize: Appearance.font.size.larger
|
||||||
text: "arrow_forward_ios"
|
text: "arrow_forward_ios"
|
||||||
@@ -122,7 +65,12 @@ Item {
|
|||||||
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
opacity: root.expanded ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {
|
||||||
|
}
|
||||||
|
}
|
||||||
sourceComponent: Content {
|
sourceComponent: Content {
|
||||||
drawing: root.drawing
|
drawing: root.drawing
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ Searcher {
|
|||||||
|
|
||||||
function launch(entry: DesktopEntry): void {
|
function launch(entry: DesktopEntry): void {
|
||||||
appDb.incrementFrequency(entry.id);
|
appDb.incrementFrequency(entry.id);
|
||||||
console.log(root.command);
|
|
||||||
|
|
||||||
if (entry.runInTerminal)
|
if (entry.runInTerminal)
|
||||||
Quickshell.execDetached({
|
Quickshell.execDetached({
|
||||||
|
|||||||
@@ -284,6 +284,8 @@ CustomRect {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: root.urgency === "critical" ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurface
|
color: root.urgency === "critical" ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurface
|
||||||
text: {
|
text: {
|
||||||
|
if (!Config.lock.showNotifContent)
|
||||||
|
return "Unlock to view";
|
||||||
const summary = modelData.summary.replace(/\n/g, " ");
|
const summary = modelData.summary.replace(/\n/g, " ");
|
||||||
const body = modelData.body.replace(/\n/g, " ");
|
const body = modelData.body.replace(/\n/g, " ");
|
||||||
const color = root.urgency === "critical" ? DynamicColors.palette.m3secondary : DynamicColors.palette.m3outline;
|
const color = root.urgency === "critical" ? DynamicColors.palette.m3secondary : DynamicColors.palette.m3outline;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ SettingsPage {
|
|||||||
step: 50
|
step: 50
|
||||||
}
|
}
|
||||||
|
|
||||||
// Separator {
|
Separator {
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// WallpaperCropper {
|
WallpaperCropper {
|
||||||
// Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
// Layout.preferredHeight: 300
|
Layout.preferredHeight: 600
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsSection {
|
SettingsSection {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Height"
|
|
||||||
min: 1
|
min: 1
|
||||||
|
name: "Height"
|
||||||
object: Config.barConfig
|
object: Config.barConfig
|
||||||
setting: "height"
|
setting: "height"
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,8 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Rounding"
|
|
||||||
min: 0
|
min: 0
|
||||||
|
name: "Rounding"
|
||||||
object: Config.barConfig
|
object: Config.barConfig
|
||||||
setting: "rounding"
|
setting: "rounding"
|
||||||
}
|
}
|
||||||
@@ -39,11 +39,21 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Border"
|
|
||||||
min: 0
|
min: 0
|
||||||
|
name: "Border"
|
||||||
object: Config.barConfig
|
object: Config.barConfig
|
||||||
setting: "border"
|
setting: "border"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Separator {
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingSpinBox {
|
||||||
|
min: 0
|
||||||
|
name: "Smoothing"
|
||||||
|
object: Config.barConfig
|
||||||
|
setting: "smoothing"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsSection {
|
SettingsSection {
|
||||||
@@ -145,8 +155,8 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Dock height"
|
|
||||||
min: 1
|
min: 1
|
||||||
|
name: "Dock height"
|
||||||
object: Config.dock
|
object: Config.dock
|
||||||
setting: "height"
|
setting: "height"
|
||||||
}
|
}
|
||||||
@@ -173,8 +183,8 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingStringList {
|
SettingStringList {
|
||||||
name: "Pinned apps"
|
|
||||||
addLabel: qsTr("Add pinned app")
|
addLabel: qsTr("Add pinned app")
|
||||||
|
name: "Pinned apps"
|
||||||
object: Config.dock
|
object: Config.dock
|
||||||
setting: "pinnedApps"
|
setting: "pinnedApps"
|
||||||
}
|
}
|
||||||
@@ -183,8 +193,8 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingStringList {
|
SettingStringList {
|
||||||
name: "Ignored app regexes"
|
|
||||||
addLabel: qsTr("Add ignored regex")
|
addLabel: qsTr("Add ignored regex")
|
||||||
|
name: "Ignored app regexes"
|
||||||
object: Config.dock
|
object: Config.dock
|
||||||
setting: "ignoredAppRegexes"
|
setting: "ignoredAppRegexes"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Max fingerprint tries"
|
|
||||||
min: 1
|
min: 1
|
||||||
|
name: "Max fingerprint tries"
|
||||||
object: Config.lock
|
object: Config.lock
|
||||||
setting: "maxFprintTries"
|
setting: "maxFprintTries"
|
||||||
step: 1
|
step: 1
|
||||||
@@ -41,9 +41,18 @@ SettingsPage {
|
|||||||
Separator {
|
Separator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingSwitch {
|
||||||
|
name: "Show notification details"
|
||||||
|
object: Config.lock
|
||||||
|
setting: "showNotifContent"
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {
|
||||||
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Blur amount"
|
|
||||||
min: 0
|
min: 0
|
||||||
|
name: "Blur amount"
|
||||||
object: Config.lock
|
object: Config.lock
|
||||||
setting: "blurAmount"
|
setting: "blurAmount"
|
||||||
step: 1
|
step: 1
|
||||||
@@ -53,9 +62,9 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Height multiplier"
|
|
||||||
max: 2
|
max: 2
|
||||||
min: 0.1
|
min: 0.1
|
||||||
|
name: "Height multiplier"
|
||||||
object: Config.lock.sizes
|
object: Config.lock.sizes
|
||||||
setting: "heightMult"
|
setting: "heightMult"
|
||||||
step: 0.05
|
step: 0.05
|
||||||
@@ -65,9 +74,9 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Aspect ratio"
|
|
||||||
max: 4
|
max: 4
|
||||||
min: 0.5
|
min: 0.5
|
||||||
|
name: "Aspect ratio"
|
||||||
object: Config.lock.sizes
|
object: Config.lock.sizes
|
||||||
setting: "ratio"
|
setting: "ratio"
|
||||||
step: 0.05
|
step: 0.05
|
||||||
@@ -77,8 +86,8 @@ SettingsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
name: "Center width"
|
|
||||||
min: 100
|
min: 100
|
||||||
|
name: "Center width"
|
||||||
object: Config.lock.sizes
|
object: Config.lock.sizes
|
||||||
setting: "centerWidth"
|
setting: "centerWidth"
|
||||||
step: 10
|
step: 10
|
||||||
|
|||||||
@@ -6,97 +6,109 @@ import qs.Config
|
|||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
|
|
||||||
ColumnLayout {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
spacing: 15
|
|
||||||
width: Math.min(parent ? parent.width : 600, 600)
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: previewContainer
|
|
||||||
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.preferredWidth: height * (Quickshell.screens.length > 0 ? (Quickshell.screens[0].height / Math.max(1, Quickshell.screens[0].width)) : 16 / 9)
|
|
||||||
clip: true
|
|
||||||
color: DynamicColors.palette.m3surfaceContainer
|
|
||||||
radius: Config.appearance.rounding.scale * 10
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: img
|
id: imageView
|
||||||
|
|
||||||
|
property real displayH: paintedHeight
|
||||||
|
property real displayW: paintedWidth
|
||||||
|
property real displayX: (width - paintedWidth) * 0.5
|
||||||
|
property real displayY: (height - paintedHeight) * 0.5
|
||||||
|
property real scaleX: sourceW / displayW
|
||||||
|
property real scaleY: sourceH / displayH
|
||||||
|
property real sourceH: Quickshell.screens[0].height
|
||||||
|
property real sourceW: Quickshell.screens[0].width
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
asynchronous: true
|
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
smooth: true
|
||||||
source: Wallpapers.current
|
source: Wallpapers.current
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
|
id: overlay
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
height: imageView.displayH
|
||||||
|
width: imageView.displayW
|
||||||
|
x: imageView.displayX
|
||||||
|
y: imageView.displayY
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
id: cropRect
|
id: cropRect
|
||||||
|
|
||||||
property real cropHeight: (imageAspect > screenAspect ? paintedHeight : paintedWidth / screenAspect) / Config.background.zoom
|
property real aspectRatio: Quickshell.screens[0].width / Quickshell.screens[0].height
|
||||||
property real cropWidth: (imageAspect > screenAspect ? paintedHeight * screenAspect : paintedWidth) / Config.background.zoom
|
readonly property rect sourceRect: Qt.rect(x * imageView.scaleX, y * imageView.scaleY, width * imageView.scaleX, height * imageView.scaleY)
|
||||||
property real imageAspect: Math.max(1, paintedWidth) / Math.max(1, paintedHeight)
|
property real zoom: Config.background.zoom
|
||||||
property real paintedHeight: img.paintedHeight > 0 ? img.paintedHeight : img.height
|
|
||||||
property real paintedWidth: img.paintedWidth > 0 ? img.paintedWidth : img.width
|
function clampToBounds() {
|
||||||
property real paintedX: (img.width - paintedWidth) / 2
|
x = Math.max(0, Math.min(x, overlay.width - width));
|
||||||
property real paintedY: (img.height - paintedHeight) / 2
|
|
||||||
property real screenAspect: Quickshell.screens.length > 0 ? (Quickshell.screens[0].width / Math.max(1, Quickshell.screens[0].height)) : 16 / 9
|
y = Math.max(0, Math.min(y, overlay.height - height));
|
||||||
|
}
|
||||||
|
|
||||||
border.color: DynamicColors.palette.m3primary
|
border.color: DynamicColors.palette.m3primary
|
||||||
border.width: 2
|
border.width: 2
|
||||||
color: Qt.alpha(DynamicColors.palette.m3primaryContainer, 0.3)
|
color: DynamicColors.tPalette.m3primary
|
||||||
height: cropHeight
|
height: width / aspectRatio
|
||||||
width: cropWidth
|
radius: Appearance.rounding.small
|
||||||
x: paintedX + (paintedWidth - width) * Config.background.alignX
|
visible: imageView.status === Image.Ready
|
||||||
y: paintedY + (paintedHeight - height) * Config.background.alignY
|
width: Math.min(overlay.width / zoom, overlay.height * aspectRatio / zoom)
|
||||||
|
x: Config.background.sourceClipX / imageView.scaleX
|
||||||
|
y: Config.background.sourceClipY / imageView.scaleY
|
||||||
|
}
|
||||||
|
|
||||||
DragHandler {
|
MouseArea {
|
||||||
target: null
|
function updateCrop(mouseX, mouseY) {
|
||||||
|
let nx = mouseX - cropRect.width * 0.5;
|
||||||
|
let ny = mouseY - cropRect.height * 0.5;
|
||||||
|
|
||||||
onActiveTranslationChanged: {
|
nx = Math.max(0, Math.min(nx, overlay.width - cropRect.width));
|
||||||
if (active) {
|
|
||||||
let newX = cropRect.x - cropRect.paintedX + translation.x;
|
|
||||||
let newY = cropRect.y - cropRect.paintedY + translation.y;
|
|
||||||
|
|
||||||
let rangeX = cropRect.paintedWidth - cropRect.width;
|
ny = Math.max(0, Math.min(ny, overlay.height - cropRect.height));
|
||||||
let rangeY = cropRect.paintedHeight - cropRect.height;
|
|
||||||
|
|
||||||
if (rangeX > 0) {
|
cropRect.x = nx;
|
||||||
let valX = newX / rangeX;
|
cropRect.y = ny;
|
||||||
Config.background.alignX = Math.max(0.0, Math.min(1.0, valX));
|
}
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
preventStealing: true
|
||||||
|
|
||||||
|
onPositionChanged: mouse => {
|
||||||
|
if (pressed)
|
||||||
|
updateCrop(mouse.x, mouse.y);
|
||||||
|
}
|
||||||
|
onPressed: mouse => {
|
||||||
|
updateCrop(mouse.x, mouse.y);
|
||||||
|
}
|
||||||
|
onReleased: {
|
||||||
|
Wallpapers.recentlyChanged = false;
|
||||||
|
Config.background.sourceClipX = cropRect.sourceRect.x;
|
||||||
|
Config.background.sourceClipY = cropRect.sourceRect.y;
|
||||||
|
Config.background.sourceClipW = cropRect.sourceRect.width;
|
||||||
|
Config.background.sourceClipH = cropRect.sourceRect.height;
|
||||||
Config.save();
|
Config.save();
|
||||||
}
|
}
|
||||||
|
onWheel: wheel => {
|
||||||
|
let oldCenterX = cropRect.x + cropRect.width * 0.5;
|
||||||
|
let oldCenterY = cropRect.y + cropRect.height * 0.5;
|
||||||
|
|
||||||
if (rangeY > 0) {
|
if (wheel.angleDelta.y > 0)
|
||||||
let valY = newY / rangeY;
|
cropRect.zoom *= 1.1;
|
||||||
Config.background.alignY = Math.max(0.0, Math.min(1.0, valY));
|
else
|
||||||
Config.save();
|
cropRect.zoom /= 1.1;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PinchHandler {
|
cropRect.zoom = Math.max(1.0, Math.min(cropRect.zoom, 10.0));
|
||||||
maximumScale: 5.0
|
Config.background.zoom = cropRect.zoom;
|
||||||
minimumScale: 1.0
|
|
||||||
target: null
|
|
||||||
|
|
||||||
onActiveScaleChanged: {
|
cropRect.x = oldCenterX - cropRect.width * 0.5;
|
||||||
if (active) {
|
cropRect.y = oldCenterY - cropRect.height * 0.5;
|
||||||
let newZoom = Config.background.zoom * (1 / (1 + (activeScale - 1) * 0.1));
|
|
||||||
Config.background.zoom = Math.max(1.0, Math.min(newZoom, 5.0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingSpinBox {
|
cropRect.clampToBounds();
|
||||||
max: 5.0
|
}
|
||||||
min: 1.0
|
}
|
||||||
name: "Zoom"
|
|
||||||
object: Config.background
|
|
||||||
setting: "zoom"
|
|
||||||
step: 0.1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ import QtQuick.Controls
|
|||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Config
|
import qs.Config
|
||||||
import "../../scripts/fuzzysort.js" as Fuzzy
|
import "../../scripts/fuzzysort.js" as Fuzzy
|
||||||
import "./SettingsIndex.mjs" as SettingsIndex
|
import "../../scripts/SettingsIndex.mjs" as SettingsIndex
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -53,11 +53,10 @@ Item {
|
|||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: "/"
|
sequence: "/"
|
||||||
|
|
||||||
onActivated: searchField.forceActiveFocus()
|
onActivated: searchField.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: console.log(root.height)
|
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: resultsModel
|
id: resultsModel
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,45 +7,24 @@ import qs.Helpers
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property real offsetScale: shouldBeActive ? 0 : 1
|
||||||
required property var panels
|
required property var panels
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
readonly property bool shouldBeActive: visibilities.settings
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
implicitHeight: 0
|
anchors.topMargin: (-implicitHeight - 5) * offsetScale
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
implicitWidth: content.implicitWidth
|
implicitWidth: content.implicitWidth
|
||||||
visible: height > 0
|
opacity: 1 - offsetScale
|
||||||
|
visible: offsetScale < 1
|
||||||
states: State {
|
|
||||||
name: "visible"
|
|
||||||
when: root.visibilities.settings
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
root.implicitHeight: content.implicitHeight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
transitions: [
|
|
||||||
Transition {
|
|
||||||
from: ""
|
|
||||||
to: "visible"
|
|
||||||
|
|
||||||
|
Behavior on offsetScale {
|
||||||
Anim {
|
Anim {
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
property: "implicitHeight"
|
|
||||||
target: root
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Transition {
|
|
||||||
from: "visible"
|
|
||||||
to: ""
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
|
||||||
property: "implicitHeight"
|
|
||||||
target: root
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
|
||||||
CustomClippingRect {
|
CustomClippingRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ Scope {
|
|||||||
if (!root.launcherInterrupted && !root.hasFullscreen) {
|
if (!root.launcherInterrupted && !root.hasFullscreen) {
|
||||||
const visibilities = Visibilities.getForActive();
|
const visibilities = Visibilities.getForActive();
|
||||||
visibilities.launcher = !visibilities.launcher;
|
visibilities.launcher = !visibilities.launcher;
|
||||||
console.log(root.launcherInterrupted);
|
|
||||||
}
|
}
|
||||||
root.launcherInterrupted = false;
|
root.launcherInterrupted = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import qs.Components
|
||||||
|
import qs.Helpers
|
||||||
|
import qs.Config
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property Image current: one
|
||||||
|
property string source: Wallpapers.current
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (source)
|
||||||
|
Qt.callLater(() => one.update());
|
||||||
|
}
|
||||||
|
onSourceChanged: {
|
||||||
|
if (!source) {
|
||||||
|
current = null;
|
||||||
|
} else if (current === one) {
|
||||||
|
two.update();
|
||||||
|
} else {
|
||||||
|
one.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Img {
|
||||||
|
id: one
|
||||||
|
}
|
||||||
|
|
||||||
|
Img {
|
||||||
|
id: two
|
||||||
|
}
|
||||||
|
|
||||||
|
component Img: Image {
|
||||||
|
id: img
|
||||||
|
|
||||||
|
function update(): void {
|
||||||
|
if (source === root.source) {
|
||||||
|
root.current = this;
|
||||||
|
} else {
|
||||||
|
source = root.source;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
asynchronous: true
|
||||||
|
fillMode: Image.PreserveAspectCrop
|
||||||
|
opacity: 0
|
||||||
|
retainWhileLoading: true
|
||||||
|
scale: Wallpapers.showPreview ? 1 : 0.8
|
||||||
|
sourceClipRect: Qt.rect(Config.background.sourceClipX, Config.background.sourceClipY, Config.background.sourceClipW, Config.background.sourceClipH)
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "visible"
|
||||||
|
when: root.current === img
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
img.opacity: 1
|
||||||
|
img.scale: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transitions: Transition {
|
||||||
|
Anim {
|
||||||
|
duration: Config.background.wallFadeDuration
|
||||||
|
properties: "opacity,scale"
|
||||||
|
target: img
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status === Image.Ready) {
|
||||||
|
root.current = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
@@ -8,79 +9,34 @@ import qs.Config
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property Image current: one
|
required property ShellScreen screen
|
||||||
property string source: Wallpapers.current
|
property string source: Wallpapers.current
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Component.onCompleted: {
|
Image {
|
||||||
if (source)
|
|
||||||
Qt.callLater(() => one.update());
|
|
||||||
}
|
|
||||||
onSourceChanged: {
|
|
||||||
if (!source) {
|
|
||||||
current = null;
|
|
||||||
} else if (current === one) {
|
|
||||||
two.update();
|
|
||||||
} else {
|
|
||||||
one.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Img {
|
|
||||||
id: one
|
|
||||||
}
|
|
||||||
|
|
||||||
Img {
|
|
||||||
id: two
|
|
||||||
}
|
|
||||||
|
|
||||||
component Img: CachingImage {
|
|
||||||
id: img
|
id: img
|
||||||
|
|
||||||
property real imageRatio: Math.max(1, sourceSize.width) / Math.max(1, sourceSize.height)
|
anchors.fill: parent
|
||||||
property bool isValid: sourceSize.width > 0 && sourceSize.height > 0 && root.width > 0 && root.height > 0
|
|
||||||
property real windowRatio: root.width / Math.max(1, root.height)
|
|
||||||
|
|
||||||
function update(): void {
|
|
||||||
if (path === root.source) {
|
|
||||||
root.current = this;
|
|
||||||
} else {
|
|
||||||
path = root.source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: undefined
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
height: isValid ? (imageRatio > windowRatio ? root.height : root.width / imageRatio) * Config.background.zoom : root.height
|
opacity: 1
|
||||||
opacity: 0
|
retainWhileLoading: true
|
||||||
scale: Wallpapers.showPreview ? 1 : 0.8
|
source: root.source
|
||||||
width: isValid ? (imageRatio > windowRatio ? root.height * imageRatio : root.width) * Config.background.zoom : root.width
|
sourceClipRect: Wallpapers.recentlyChanged ? null : Qt.rect(Config.background.sourceClipX, Config.background.sourceClipY, Config.background.sourceClipW, Config.background.sourceClipH)
|
||||||
x: isValid ? (root.width - width) * Config.background.alignX : 0
|
sourceSize.height: root.screen.height
|
||||||
y: isValid ? (root.height - height) * Config.background.alignY : 0
|
sourceSize.width: root.screen.width
|
||||||
|
|
||||||
states: State {
|
onSourceChanged: {
|
||||||
name: "visible"
|
if (Wallpapers.recentlyChanged) {
|
||||||
when: root.current === img
|
Config.background.sourceClipH = 0;
|
||||||
|
Config.background.sourceClipW = 0;
|
||||||
PropertyChanges {
|
Config.background.sourceClipY = 0;
|
||||||
img.opacity: 1
|
Config.background.sourceClipX = 0;
|
||||||
img.scale: 1
|
Config.background.zoom = 1.0;
|
||||||
}
|
Config.save();
|
||||||
}
|
|
||||||
transitions: Transition {
|
|
||||||
Anim {
|
|
||||||
duration: Config.background.wallFadeDuration
|
|
||||||
properties: "opacity,scale"
|
|
||||||
target: img
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onStatusChanged: {
|
|
||||||
if (status === Image.Ready) {
|
|
||||||
root.current = this;
|
|
||||||
}
|
}
|
||||||
|
Wallpapers.recentlyChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Loader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WallBackground {
|
WallBackground {
|
||||||
|
screen: root.screen
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ qml_module(ZShell-blobs
|
|||||||
|
|
||||||
qt_add_shaders(ZShell-blobs "blob_shaders"
|
qt_add_shaders(ZShell-blobs "blob_shaders"
|
||||||
BATCHABLE OPTIMIZED NOHLSL NOMSL
|
BATCHABLE OPTIMIZED NOHLSL NOMSL
|
||||||
|
GLSL "300es,330"
|
||||||
PREFIX "/"
|
PREFIX "/"
|
||||||
FILES
|
FILES
|
||||||
shaders/blob.frag
|
shaders/blob.frag
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
static_assert(sizeof(decltype(BlobRectData::excludeMask)) == sizeof(float),
|
||||||
|
"BlobMaterial packs excludeMask into a float slot via memcpy");
|
||||||
|
|
||||||
QSGMaterialType* BlobMaterial::type() const {
|
QSGMaterialType* BlobMaterial::type() const {
|
||||||
static QSGMaterialType s_type;
|
static QSGMaterialType s_type;
|
||||||
return &s_type;
|
return &s_type;
|
||||||
@@ -82,8 +85,11 @@ bool BlobMaterialShader::updateUniformData(RenderState& state, QSGMaterial* newM
|
|||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
const auto& r = mat->m_rects[i];
|
const auto& r = mat->m_rects[i];
|
||||||
const int base = 160 + i * 80;
|
const int base = 160 + i * 80;
|
||||||
|
// Pack excludeMask into props.x via bit-cast (read in shader with floatBitsToInt)
|
||||||
|
float maskAsFloat;
|
||||||
|
memcpy(&maskAsFloat, &r.excludeMask, sizeof(float));
|
||||||
const float d0[4] = { r.cx, r.cy, r.hw, r.hh };
|
const float d0[4] = { r.cx, r.cy, r.hw, r.hh };
|
||||||
const float d1[4] = { 0.0f, r.offsetX, r.offsetY, r.minEig };
|
const float d1[4] = { maskAsFloat, r.offsetX, r.offsetY, r.minEig };
|
||||||
const float d3[4] = { r.screenHalfX, r.screenHalfY, 0.0f, 0.0f };
|
const float d3[4] = { r.screenHalfX, r.screenHalfY, 0.0f, 0.0f };
|
||||||
memcpy(buf->data() + base, d0, 16);
|
memcpy(buf->data() + base, d0, 16);
|
||||||
memcpy(buf->data() + base + 16, d1, 16);
|
memcpy(buf->data() + base + 16, d1, 16);
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ struct BlobRectData {
|
|||||||
float screenHalfX = 0, screenHalfY = 0;
|
float screenHalfX = 0, screenHalfY = 0;
|
||||||
// Effective per-corner radii (tr, br, bl, tl), pre-computed on CPU
|
// Effective per-corner radii (tr, br, bl, tl), pre-computed on CPU
|
||||||
float radius[4] = { 0, 0, 0, 0 };
|
float radius[4] = { 0, 0, 0, 0 };
|
||||||
|
// Bitmask of indices in this rect's m_cachedRects that mutually exclude (or are excluded by) this rect.
|
||||||
|
// Used by the shader to skip smin between excluded pairs.
|
||||||
|
int excludeMask = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BlobMaterial : public QSGMaterial {
|
class BlobMaterial : public QSGMaterial {
|
||||||
|
|||||||
@@ -72,11 +72,17 @@ void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeome
|
|||||||
// Accumulate sub-pixel drift so slow movements don't desync the shader
|
// Accumulate sub-pixel drift so slow movements don't desync the shader
|
||||||
m_pendingDx += static_cast<float>(newGeometry.x() - oldGeometry.x());
|
m_pendingDx += static_cast<float>(newGeometry.x() - oldGeometry.x());
|
||||||
m_pendingDy += static_cast<float>(newGeometry.y() - oldGeometry.y());
|
m_pendingDy += static_cast<float>(newGeometry.y() - oldGeometry.y());
|
||||||
const auto dw = std::abs(newGeometry.width() - oldGeometry.width());
|
// Accumulate size delta across multiple frames so incremental size
|
||||||
const auto dh = std::abs(newGeometry.height() - oldGeometry.height());
|
// changes that are each below the threshold still trigger a dirty
|
||||||
if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f || dw > 0.5 || dh > 0.5) {
|
// mark once their accumulated delta exceeds it.
|
||||||
|
m_pendingDw += static_cast<float>(newGeometry.width() - oldGeometry.width());
|
||||||
|
m_pendingDh += static_cast<float>(newGeometry.height() - oldGeometry.height());
|
||||||
|
if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f ||
|
||||||
|
std::abs(m_pendingDw) > 0.5f || std::abs(m_pendingDh) > 0.5f) {
|
||||||
m_pendingDx = 0;
|
m_pendingDx = 0;
|
||||||
m_pendingDy = 0;
|
m_pendingDy = 0;
|
||||||
|
m_pendingDw = 0;
|
||||||
|
m_pendingDh = 0;
|
||||||
m_group->markShapeDirty(this);
|
m_group->markShapeDirty(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,6 +155,10 @@ void BlobShape::updatePolish() {
|
|||||||
const QRectF myPadded(static_cast<double>(m_cachedPaddedX), static_cast<double>(m_cachedPaddedY),
|
const QRectF myPadded(static_cast<double>(m_cachedPaddedX), static_cast<double>(m_cachedPaddedY),
|
||||||
static_cast<double>(m_cachedPaddedW), static_cast<double>(m_cachedPaddedH));
|
static_cast<double>(m_cachedPaddedW), static_cast<double>(m_cachedPaddedH));
|
||||||
|
|
||||||
|
// Track shape pointers parallel to m_cachedRects for pairwise exclusion lookups
|
||||||
|
QVector<BlobShape*> rectShapes;
|
||||||
|
rectShapes.reserve(m_group->shapes().size());
|
||||||
|
|
||||||
for (BlobShape* other : m_group->shapes()) {
|
for (BlobShape* other : m_group->shapes()) {
|
||||||
if (other->isInvertedRect())
|
if (other->isInvertedRect())
|
||||||
continue;
|
continue;
|
||||||
@@ -210,12 +220,29 @@ void BlobShape::updatePolish() {
|
|||||||
r.screenHalfY = std::abs(b) * r.hw + std::abs(d) * r.hh;
|
r.screenHalfY = std::abs(b) * r.hw + std::abs(d) * r.hh;
|
||||||
|
|
||||||
m_cachedRects.append(r);
|
m_cachedRects.append(r);
|
||||||
|
rectShapes.append(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInvertedRect())
|
if (isInvertedRect())
|
||||||
m_cachedMyIndex = -1;
|
m_cachedMyIndex = -1;
|
||||||
|
|
||||||
|
// Compute pairwise exclude masks. Bit j in entry i is set iff rect i excludes rect j
|
||||||
|
// or rect j excludes rect i. The shader uses this to avoid smin between excluded pairs.
|
||||||
|
const auto cachedCount = m_cachedRects.size();
|
||||||
|
for (qsizetype i = 0; i < cachedCount; ++i) {
|
||||||
|
int mask = 0;
|
||||||
|
BlobShape* si = rectShapes[i];
|
||||||
|
for (qsizetype j = 0; j < cachedCount; ++j) {
|
||||||
|
if (j == i)
|
||||||
|
continue;
|
||||||
|
BlobShape* sj = rectShapes[j];
|
||||||
|
if (si->isExcluded(sj) || sj->isExcluded(si))
|
||||||
|
mask |= (1 << j);
|
||||||
|
}
|
||||||
|
m_cachedRects[i].excludeMask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
// Cache inverted rect data
|
// Cache inverted rect data
|
||||||
m_cachedHasInverted = false;
|
m_cachedHasInverted = false;
|
||||||
m_cachedInvertedRadius = 0;
|
m_cachedInvertedRadius = 0;
|
||||||
@@ -270,6 +297,7 @@ void BlobShape::updatePolish() {
|
|||||||
const auto rectCount = m_cachedRects.size();
|
const auto rectCount = m_cachedRects.size();
|
||||||
for (qsizetype i = 0; i < rectCount; ++i) {
|
for (qsizetype i = 0; i < rectCount; ++i) {
|
||||||
auto& ri = m_cachedRects[i];
|
auto& ri = m_cachedRects[i];
|
||||||
|
const int riExcludeMask = ri.excludeMask;
|
||||||
float fTr = 1.0f, fBr = 1.0f, fBl = 1.0f, fTl = 1.0f;
|
float fTr = 1.0f, fBr = 1.0f, fBl = 1.0f, fTl = 1.0f;
|
||||||
|
|
||||||
const float cTrX = ri.cx + ri.hw, cTrY = ri.cy - ri.hh;
|
const float cTrX = ri.cx + ri.hw, cTrY = ri.cy - ri.hh;
|
||||||
@@ -280,6 +308,8 @@ void BlobShape::updatePolish() {
|
|||||||
for (qsizetype j = 0; j < rectCount; ++j) {
|
for (qsizetype j = 0; j < rectCount; ++j) {
|
||||||
if (j == i)
|
if (j == i)
|
||||||
continue;
|
continue;
|
||||||
|
if (riExcludeMask & (1 << j))
|
||||||
|
continue;
|
||||||
const auto& rj = m_cachedRects[j];
|
const auto& rj = m_cachedRects[j];
|
||||||
fTr = std::min(fTr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cTrX, cTrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
fTr = std::min(fTr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cTrX, cTrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
||||||
fBr = std::min(fBr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cBrX, cBrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
fBr = std::min(fBr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cBrX, cBrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ QVector<BlobRectData> m_cachedRects;
|
|||||||
int m_cachedMyIndex = -2;
|
int m_cachedMyIndex = -2;
|
||||||
float m_pendingDx = 0;
|
float m_pendingDx = 0;
|
||||||
float m_pendingDy = 0;
|
float m_pendingDy = 0;
|
||||||
|
float m_pendingDw = 0;
|
||||||
|
float m_pendingDh = 0;
|
||||||
bool m_cachedHasInverted = false;
|
bool m_cachedHasInverted = false;
|
||||||
float m_cachedInvertedRadius = 0;
|
float m_cachedInvertedRadius = 0;
|
||||||
float m_cachedInvertedOuter[4] = {};
|
float m_cachedInvertedOuter[4] = {};
|
||||||
|
|||||||
@@ -63,13 +63,17 @@ float smaxSharpA(float a, float b, float k) {
|
|||||||
void main() {
|
void main() {
|
||||||
vec2 pixel = vec2(paddedX, paddedY) + qt_TexCoord0 * vec2(paddedW, paddedH);
|
vec2 pixel = vec2(paddedX, paddedY) + qt_TexCoord0 * vec2(paddedW, paddedH);
|
||||||
|
|
||||||
float mergedSdf = 1e10;
|
// Phase 1: compute per-rect SDF, track owner. We can't smin yet because
|
||||||
|
// excluded pairs need to skip the smooth blend, which requires pairwise pass
|
||||||
|
// below.
|
||||||
|
float dArr[16];
|
||||||
int owner = -2;
|
int owner = -2;
|
||||||
float minDist = 1e10;
|
float minDist = 1e10;
|
||||||
|
|
||||||
for (int i = 0; i < rectCount; i++) {
|
for (int i = 0; i < rectCount; i++) {
|
||||||
vec4 rect = rectData[i * 5]; // cx, cy, hw, hh
|
vec4 rect = rectData[i * 5]; // cx, cy, hw, hh
|
||||||
vec4 props = rectData[i * 5 + 1]; // radius, offsetX, offsetY, minEig
|
vec4 props =
|
||||||
|
rectData[i * 5 + 1]; // excludeMask(int bits), offsetX, offsetY, minEig
|
||||||
vec4 invDm = rectData[i * 5 + 2]; // inverse deform matrix
|
vec4 invDm = rectData[i * 5 + 2]; // inverse deform matrix
|
||||||
vec4 sh = rectData[i * 5 + 3]; // screenHalfX, screenHalfY, 0, 0
|
vec4 sh = rectData[i * 5 + 3]; // screenHalfX, screenHalfY, 0, 0
|
||||||
vec4 radii =
|
vec4 radii =
|
||||||
@@ -81,8 +85,10 @@ void main() {
|
|||||||
// AABB early-out: skip rects far from this pixel
|
// AABB early-out: skip rects far from this pixel
|
||||||
vec2 extent = sh.xy + vec2(smoothFactor * 1.5);
|
vec2 extent = sh.xy + vec2(smoothFactor * 1.5);
|
||||||
if (abs(pixel.x - center.x) > extent.x ||
|
if (abs(pixel.x - center.x) > extent.x ||
|
||||||
abs(pixel.y - center.y) > extent.y)
|
abs(pixel.y - center.y) > extent.y) {
|
||||||
|
dArr[i] = 1e10;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Apply pre-computed inverse deformation to the evaluation point
|
// Apply pre-computed inverse deformation to the evaluation point
|
||||||
mat2 invDeform = mat2(invDm.xy, invDm.zw);
|
mat2 invDeform = mat2(invDm.xy, invDm.zw);
|
||||||
@@ -138,13 +144,38 @@ void main() {
|
|||||||
d *= scale;
|
d *= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
mergedSdf = smin(mergedSdf, d, smoothFactor);
|
dArr[i] = d;
|
||||||
if (d < smoothFactor && d < minDist) {
|
if (d < smoothFactor && d < minDist) {
|
||||||
minDist = d;
|
minDist = d;
|
||||||
owner = i;
|
owner = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Phase 2: hard-min baseline over all rects.
|
||||||
|
float mergedSdf = 1e10;
|
||||||
|
for (int i = 0; i < rectCount; i++) {
|
||||||
|
mergedSdf = min(mergedSdf, dArr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Phase 3: pair-wise smin contributions, skipping excluded pairs. Pair smin
|
||||||
|
// <= min, so taking the min over all non-excluded pair smins gives the
|
||||||
|
// smoothly-merged SDF.
|
||||||
|
for (int i = 0; i < rectCount; i++) {
|
||||||
|
if (dArr[i] >= 1e9)
|
||||||
|
continue;
|
||||||
|
int excludeMask = floatBitsToInt(rectData[i * 5 + 1].x);
|
||||||
|
for (int j = i + 1; j < rectCount; j++) {
|
||||||
|
if (dArr[j] >= 1e9)
|
||||||
|
continue;
|
||||||
|
if ((excludeMask & (1 << j)) != 0)
|
||||||
|
continue;
|
||||||
|
// smin only deviates from min within smoothFactor
|
||||||
|
if (abs(dArr[i] - dArr[j]) >= smoothFactor)
|
||||||
|
continue;
|
||||||
|
mergedSdf = min(mergedSdf, smin(dArr[i], dArr[j], smoothFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasInverted != 0) {
|
if (hasInverted != 0) {
|
||||||
float dOuter = sdBox(pixel, invertedOuter.xy, invertedOuter.zw) - 1.0;
|
float dOuter = sdBox(pixel, invertedOuter.xy, invertedOuter.zw) - 1.0;
|
||||||
float dInner =
|
float dInner =
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user