From 19ed7e8179c79a2f41e4cee8f2e920576c70f5dc Mon Sep 17 00:00:00 2001 From: catpswin56 Date: Wed, 12 Feb 2025 13:45:53 -0300 Subject: [PATCH 001/329] Fix Desktop Containment plasmoid for Plasma 6.3 --- .../contents/ui/ConfigFilter.qml | 2 +- .../contents/ui/ConfigIcons.qml | 2 +- .../contents/ui/ConfigLocation.qml | 16 ++--- .../ui/FolderItemPreviewPluginsDialog.qml | 2 +- .../contents/ui/FolderView.qml | 64 +++++++++++++------ .../contents/ui/FolderViewDialog.qml | 2 +- .../contents/ui/FolderViewLayer.qml | 44 +------------ .../contents/ui/main.qml | 56 +++++++++------- 8 files changed, 90 insertions(+), 98 deletions(-) diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigFilter.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigFilter.qml index fc52c8cd..b2978f2a 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigFilter.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigFilter.qml @@ -10,7 +10,7 @@ import QtQuick.Layouts 1.15 import org.kde.kirigami 2.20 as Kirigami import org.kde.plasma.core as PlasmaCore -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder import org.kde.kitemmodels 1.0 as KItemModels ColumnLayout { diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigIcons.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigIcons.qml index 95441f12..208bdc8e 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigIcons.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigIcons.qml @@ -16,7 +16,7 @@ import org.kde.iconthemes as KIconThemes import org.kde.config // for KAuthorized import org.kde.kirigami 2.20 as Kirigami -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder Item { id: configIcons diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigLocation.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigLocation.qml index bb40f56d..306ad934 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigLocation.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/ConfigLocation.qml @@ -11,7 +11,7 @@ import QtQuick.Layouts 1.15 import org.kde.plasma.plasmoid 2.0 import org.kde.kirigami 2.20 as Kirigami -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder Item { id: configLocation @@ -19,7 +19,7 @@ Item { property string cfg_url property alias cfg_labelMode: labelMode.currentIndex property alias cfg_labelText: labelText.text - property bool titleVisible: !("containmentType" in plasmoid) + property bool titleVisible: Plasmoid.containment != Plasmoid onCfg_urlChanged: applyConfig() @@ -112,12 +112,12 @@ Item { onEnabledChanged: { if (enabled && currentIndex !== -1) { - cfg_url = placesModel.urlForIndex(currentIndex); + cfg_url = Folder.DesktopSchemeHelper.getDesktopUrl(placesModel.urlForIndex(currentIndex)); } } onActivated: { - cfg_url = placesModel.urlForIndex(index); + cfg_url = Folder.DesktopSchemeHelper.getDesktopUrl(placesModel.urlForIndex(index)); } } } @@ -140,13 +140,13 @@ Item { onEnabledChanged: { if (enabled && text !== "") { - cfg_url = text; + cfg_url = Folder.DesktopSchemeHelper.getDesktopUrl(text); } } onTextChanged: { if (enabled) { - cfg_url = text; + cfg_url = Folder.DesktopSchemeHelper.getDesktopUrl(text); } } } @@ -163,7 +163,7 @@ Item { id: directoryPicker onUrlChanged: { - locationCustomValue.text = url; + locationCustomValue.text = Folder.DesktopSchemeHelper.getDesktopUrl(url); } } } @@ -186,7 +186,7 @@ Item { visible: titleVisible Item { - width: Kirigami.Units.iconSizes.small + width: Kirigami.Units.gridUnit } TextField { diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderItemPreviewPluginsDialog.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderItemPreviewPluginsDialog.qml index ce3ad28b..5e398226 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderItemPreviewPluginsDialog.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderItemPreviewPluginsDialog.qml @@ -8,7 +8,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder import org.kde.kirigami 2.20 as Kirigami Kirigami.OverlaySheet { diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderView.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderView.qml index 644907cf..b4a98adf 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderView.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderView.qml @@ -14,7 +14,7 @@ import org.kde.kirigami 2.20 as Kirigami import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder import "code/FolderTools.js" as FolderTools FocusScope { @@ -31,7 +31,7 @@ FocusScope { property alias url: dir.url property alias status: dir.status property alias perStripe: positioner.perStripe - property alias positions: positioner.positions + property alias positionerApplet: positioner.applet property alias errorString: dir.errorString property alias dragging: dir.dragging property alias dragInProgressAnywhere: dir.dragInProgressAnywhere @@ -151,6 +151,13 @@ FocusScope { } } + function generateDragImage() { + for (var i = 0; i < gridView.count; i++) { + var item = gridView.itemAtIndex(i); + item.updateDragImage(); + } + } + Connections { target: dir function onPopupMenuAboutToShow(dropJob, mimeData, x, y) { @@ -158,6 +165,13 @@ FocusScope { root.processMimeData(mimeData, x, y, dropJob); } } + + // Create drag images before dragging + // Due to async operations we can't call this before dragging starts, + // but we have to call it after a selection is done + function onSelectionDone() { + main.generateDragImage(); + } } Connections { @@ -233,6 +247,7 @@ FocusScope { property int dragY: -1 property var cPress: null property bool doubleClickInProgress: false + property bool renameByLabelClickInitiated: false acceptedButtons: { if (hoveredItem === null && main.isRootView) { @@ -259,6 +274,12 @@ FocusScope { return; } + // Ignore clicks if editor is enabled and we click on that + // BUG:494558 + if (editor && childAt(mouse.x, mouse.y) === editor) { + return; + } + scrollArea.focus = true; if (mouse.buttons & Qt.BackButton) { @@ -410,8 +431,8 @@ FocusScope { if (!(pos.x <= hoveredItem.actionsOverlay.width && pos.y <= hoveredItem.actionsOverlay.height)) { - // Clicked on the label of an already-selected item: rename it - if (pos.x > hoveredItem.labelArea.x + // Clicked on the label of an already-selected item: schedule it for renaming when doubleClickTimer expires + renameByLabelClickInitiated = (pos.x > hoveredItem.labelArea.x && pos.x <= hoveredItem.labelArea.x + hoveredItem.labelArea.width && pos.y > hoveredItem.labelArea.y && pos.y <= hoveredItem.labelArea.y + hoveredItem.labelArea.height @@ -419,16 +440,14 @@ FocusScope { && gridView.currentIndex !== -1 && !Qt.styleHints.singleClickActivation && Plasmoid.configuration.renameInline - && !doubleClickInProgress - ) { - rename(); - return; - } + ) - // Single-click mode or list view and single-clicked on the item or + // Single-click mode and single-clicked on the item or // double-click mode and double-clicked on the item: open it - if (Qt.styleHints.singleClickActivation || root.useListViewMode || doubleClickInProgress || mouse.source === Qt.MouseEventSynthesizedByQt) { + if (Qt.styleHints.singleClickActivation || doubleClickInProgress || mouse.source === Qt.MouseEventSynthesizedByQt) { + doubleClickInProgress = false var func = root.useListViewMode && mouse.button === Qt.LeftButton && hoveredItem.isDir ? doCd : dir.run; + func(positioner.map(gridView.currentIndex)); previouslySelectedItemIndex = gridView.currentIndex; hoveredItem = null; @@ -446,8 +465,8 @@ FocusScope { gridView.ctrlPressed = (mouse.modifiers & Qt.ControlModifier); gridView.shiftPressed = (mouse.modifiers & Qt.ShiftModifier); - var cPos = mapToItem(gridView.contentItem, mouse.x, mouse.y); - var item = gridView.itemAt(cPos.x, cPos.y); + const mappedPos = mapToItem(gridView.contentItem, mouse.x, mouse.y) + var item = gridView.itemAt(mappedPos.x, mappedPos.y); var leftEdge = Math.min(gridView.contentX, gridView.originX); if (!item || item.blank) { @@ -475,6 +494,7 @@ FocusScope { // Update rubberband geometry. if (main.rubberBand) { var rB = main.rubberBand; + var cPos = mapToItem(gridView.contentItem, mouse.x, mouse.y); if (cPos.x < cPress.x) { rB.x = Math.max(leftEdge, cPos.x); @@ -548,9 +568,6 @@ FocusScope { if (!containsMouse && !main.rubberBand) { clearPressState(); } - if(!containsMouse) { - hoveredItem = null; - } } onHoveredItemChanged: { @@ -585,6 +602,10 @@ FocusScope { id: doubleClickTimer onTriggered: { + if (listener.renameByLabelClickInitiated && listener.doubleClickInProgress) { + main.rename() + } + listener.renameByLabelClickInitiated = false listener.doubleClickInProgress = false; } } @@ -623,7 +644,6 @@ FocusScope { scrollArea.ready = true; } - GridView { id: gridView clip: true @@ -676,6 +696,7 @@ FocusScope { } return Math.floor(extraSpacing); } + cellWidth: { if (root.useListViewMode) { return gridView.width - (verticalScrollBar.visible ? verticalScrollBar.width : 0); @@ -911,7 +932,7 @@ FocusScope { // Check if the rubberband intersects this cell first to avoid doing more // expensive work. - if (main.rubberBand.intersects(Qt.rect(itemX + Kirigami.Units.smallSpacing, itemY + Kirigami.Units.smallSpacing, + if (rubberBand.intersects(Qt.rect(itemX + Kirigami.Units.smallSpacing, itemY + Kirigami.Units.smallSpacing, cWidth, cHeight))) { var item = gridView.contentItem.childAt(itemX + midWidth, itemY + midHeight); @@ -921,7 +942,7 @@ FocusScope { var iconRect = Qt.rect(itemX + item.iconArea.x, itemY + item.iconArea.y, item.iconArea.width, item.iconArea.height); - if (main.rubberBand.intersects(iconRect)) { + if (rubberBand.intersects(iconRect)) { indices.push(index); continue; } @@ -929,7 +950,7 @@ FocusScope { var labelRect = Qt.rect(itemX + item.labelArea.x, itemY + item.labelArea.y, item.labelArea.width, item.labelArea.height); - if (main.rubberBand.intersects(labelRect)) { + if (rubberBand.intersects(labelRect)) { indices.push(index); continue; } @@ -1288,7 +1309,6 @@ FocusScope { folderModel: dir - perStripe: Math.floor((gridView.flow === GridView.FlowLeftToRight) ? (gridView.width / gridView.cellWidth) : (gridView.height / gridView.cellHeight)) @@ -1310,6 +1330,7 @@ FocusScope { Component { id: editorComponent + RenameEditor { id: editor @@ -1319,6 +1340,7 @@ FocusScope { if (targetItem) { dir.rename(positioner.map(targetItem.index), text); targetItem = null; + gridView.forceActiveFocus(); } } diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewDialog.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewDialog.qml index d61e1023..770c9d60 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewDialog.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewDialog.qml @@ -10,7 +10,7 @@ import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core as PlasmaCore import org.kde.kirigami 2.20 as Kirigami -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder Folder.SubDialog { id: dialog diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewLayer.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewLayer.qml index 667c0adf..4dc7ea68 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewLayer.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderViewLayer.qml @@ -13,7 +13,7 @@ import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.config // for KAuthorized import org.kde.kirigami 2.20 as Kirigami -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder FocusScope { id: folderViewLayerComponent @@ -165,28 +165,6 @@ FocusScope { } } - function getPositions() { - let allPositions; - try { - allPositions = JSON.parse(Plasmoid.configuration.positions); - } catch (err) { - allPositions = {}; - allPositions[resolution] = Plasmoid.configuration.positions; - } - return allPositions[resolution] || ""; - } - - function savePositions(positions) { - let allPositions; - try { - allPositions = JSON.parse(Plasmoid.configuration.positions); - } catch (err) { - allPositions = {}; - } - allPositions[resolution] = positions; - Plasmoid.configuration.positions = JSON.stringify(allPositions, Object.keys(allPositions).sort()); - } - Connections { target: Plasmoid.configuration @@ -218,10 +196,6 @@ FocusScope { function onIconSizeChanged() { viewPropertiesMenu.iconSize = Plasmoid.configuration.iconSize; } - - function onPositionsChanged() { - folderView.positions = getPositions(); - } } FolderView { @@ -235,6 +209,7 @@ FocusScope { focus: true isRootView: true + positionerApplet: Plasmoid url: Plasmoid.configuration.url locked: (Plasmoid.configuration.locked || !isContainment || lockedByKiosk) @@ -250,23 +225,8 @@ FocusScope { Plasmoid.configuration.sortMode = sortMode; } - onPositionsChanged: { - saveTimer.restart() - } - - onPerStripeChanged: { - folderView.positions = getPositions(); - } - - Timer { - id: saveTimer - interval: Kirigami.Units.humanMoment - onTriggered: savePositions(folderView.positions) - } - Component.onCompleted: { folderView.sortMode = Plasmoid.configuration.sortMode; - folderView.positions = getPositions(); } } diff --git a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml index df1e3c7a..7048101e 100644 --- a/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml +++ b/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml @@ -15,7 +15,7 @@ import org.kde.ksvg 1.0 as KSvg import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons import org.kde.kirigami 2.20 as Kirigami -import org.kde.private.desktopcontainment.folder 0.1 as Folder +import org.kde.private.desktopcontainment.folder as Folder import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager @@ -61,10 +61,6 @@ ContainmentItem { property int handleDelay: 800 property real haloOpacity: 0.5 - property int iconSize: Kirigami.Units.iconSizes.small - property int iconWidth: iconSize - property int iconHeight: iconWidth - readonly property int hoverActivateDelay: 750 // Magic number that matches Dolphin's auto-expand folders delay. readonly property Loader folderViewLayer: fullRepresentationItem.folderViewLayer @@ -74,8 +70,6 @@ ContainmentItem { toolTipSubText: "" Plasmoid.icon: (!Plasmoid.configuration.useCustomIcon && folderViewLayer.ready) ? symbolicizeIconName(folderViewLayer.view.model.iconName) : Plasmoid.configuration.icon - onIconHeightChanged: updateGridSize() - // We want to do this here rather than in the model because we don't always want // symbolic icons everywhere, but we do know that we always want them in this // specific representation right here @@ -88,17 +82,6 @@ ContainmentItem { return iconName + symbolicSuffix; } - function updateGridSize() { - // onIconHeightChanged can be triggered before this component is complete and all the children are created - if (!toolBoxSvg) { - return; - } - appletsLayout.cellWidth = root.iconWidth + toolBoxSvg.elementSize("left").width + toolBoxSvg.elementSize("right").width; - appletsLayout.cellHeight = root.iconHeight + toolBoxSvg.elementSize("top").height + toolBoxSvg.elementSize("bottom").height; - appletsLayout.defaultItemWidth = appletsLayout.cellWidth * 6; - appletsLayout.defaultItemHeight = appletsLayout.cellHeight * 6; - } - function addLauncher(desktopUrl) { if (!isFolder) { return; @@ -319,6 +302,8 @@ ContainmentItem { cellWidth: Kirigami.Units.iconSizes.small cellHeight: cellWidth + defaultItemWidth: cellWidth * 6 + defaultItemHeight: cellHeight * 6 eventManagerToFilter: folderViewLayer.item?.view.view ?? null @@ -331,17 +316,43 @@ ContainmentItem { configOverlaySource: "ConfigOverlay.qml" + onAppletChanged: { + applet.visible = true + } + + Drag.dragType: Drag.Automatic + Drag.active: false + Drag.supportedActions: Qt.MoveAction + Drag.mimeData: { + "text/x-plasmoidinstanceid": Plasmoid.containment.id+':'+appletContainer.applet.plasmoid.id + } + Drag.onDragFinished: dropEvent => { + if (dropEvent == Qt.MoveAction) { + appletContainer.visible = true + appletContainer.applet.visible = true + //currentApplet.applet.plasmoid.internalAction("remove").trigger() + } else { + appletContainer.visible = true + //appletsModel.insert(configurationArea.draggedItemIndex - 1, {applet: appletContainer.applet}); + } + //appletContainer.destroy() + //root.dragAndDropping = false + //root.layoutManager.save() + } + onUserDrag: (newPosition, dragCenter) => { const pos = mapToItem(root.parent, dragCenter.x, dragCenter.y); const newCont = root.containmentItemAt(pos.x, pos.y); - if (newCont && newCont.plasmoid !== Plasmoid) { - const newPos = newCont.mapFromApplet(Plasmoid, pos.x, pos.y); - + if (!newCont || newCont.plasmoid !== Plasmoid) { // First go out of applet edit mode, get rid of the config overlay, release mouse grabs in preparation of applet reparenting cancelEdit(); - newCont.Plasmoid.addApplet(appletContainer.applet.plasmoid, Qt.rect(newPos.x, newPos.y, appletContainer.applet.width, appletContainer.applet.height)); appletsLayout.hidePlaceHolder(); + appletContainer.grabToImage(result => { + appletContainer.Drag.imageSource = result.url + appletContainer.visible = false + appletContainer.Drag.active = true + }) } } @@ -398,7 +409,6 @@ ContainmentItem { } Plasmoid.setInternalAction("configure", configAction) - updateGridSize(); } } } From 13db2f317e72268cfd3c1364a16d05dec7e1b381 Mon Sep 17 00:00:00 2001 From: wackyideas Date: Wed, 12 Feb 2025 18:13:11 +0100 Subject: [PATCH 002/329] Fix notification plasmoid not working in Plasma 6.3 --- .../contents/ui/FullRepresentation.qml | 27 ++++++-------- .../contents/ui/SelectableLabel.qml | 36 ++++++++++++++++--- 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml b/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml index bf882516..81a1db05 100644 --- a/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml +++ b/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/FullRepresentation.qml @@ -232,29 +232,22 @@ PlasmaExtras.Representation { } } - Notifications.WheelForwarder { - id: wheelForwarder - toItem: scrollView.contentItem - } - PlasmaComponents3.ScrollView { - id: scrollView - anchors.fill: parent - background: null - focus: true - - contentItem: ListView { + ListView { id: list - width: scrollView.availableWidth focus: true model: root.expanded ? historyModel : null currentIndex: -1 - + anchors.fill: parent + anchors.bottomMargin: Kirigami.Units.smallSpacing / 2 + clip: true + boundsBehavior: Flickable.StopAtBounds topMargin: Kirigami.Units.largeSpacing bottomMargin: Kirigami.Units.largeSpacing spacing: Kirigami.Units.smallSpacing - readonly property alias wheelForwarder: wheelForwarder + QQC2.ScrollBar.vertical: QQC2.ScrollBar { } + property bool scrollBarVisible: QQC2.ScrollBar.vertical.visible KeyNavigation.up: dndCheck @@ -332,7 +325,7 @@ PlasmaExtras.Representation { delegate: DraggableDelegate { id: delegate - width: ListView.view.width + width: ListView.view.width - (list.scrollBarVisible ? Kirigami.Units.iconSizes.small : 0) contentItem: delegateLoader // NOTE: The following animations replace the Transitions in the ListView @@ -394,7 +387,7 @@ PlasmaExtras.Representation { NumberAnimation { target: transl property: "x" - to: list.width - (scrollView.PlasmaComponents3.ScrollBar.vertical.visible ? Kirigami.Units.largeSpacing * 2 : 0) + to: list.width - (list.scrollBarVisible ? Kirigami.Units.iconSizes.small : 0) duration: Kirigami.Units.longDuration } } @@ -640,5 +633,5 @@ PlasmaExtras.Representation { } } } - } + //} } diff --git a/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/SelectableLabel.qml b/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/SelectableLabel.qml index a295efaa..8d4822b5 100644 --- a/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/SelectableLabel.qml +++ b/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/SelectableLabel.qml @@ -76,6 +76,38 @@ PlasmaComponents3.ScrollView { contextMenu.open(eventPoint.position.x, eventPoint.position.y); } } + MouseArea { + id: scrollMA + anchors.fill: parent + visible: bodyTextContainer.listViewParent !== null + propagateComposedEvents: true + onPressed: mouse => { + mouse.accepted = false + } + onReleased: mouse => { + mouse.accepted = false + } + onWheel: wheel => { + + var listView = bodyTextContainer.listViewParent; + + if (wheel.angleDelta.y < 0) { + //make sure not to scroll too far + if (!listView.atYEnd) + listView.contentY -= wheel.angleDelta.y / 2 + } + else { + //make sure not to scroll too far + if (!listView.atYBeginning) + listView.contentY -= wheel.angleDelta.y / 2 + + } + if(listView.verticalOvershoot != 0.0) { + listView.contentY += -listView.verticalOvershoot + } + } + + } } Component { @@ -85,8 +117,4 @@ PlasmaComponents3.ScrollView { target: bodyText } } - - Component.onCompleted: if (bodyTextContainer.listViewParent !== null) { - bodyTextContainer.listViewParent.wheelForwarder.interceptWheelEvent(bodyText); - } } From 3e7cfc9c6329f5c6e774bdf589b06915abb7ef7f Mon Sep 17 00:00:00 2001 From: wackyideas Date: Wed, 12 Feb 2025 19:08:12 +0100 Subject: [PATCH 003/329] Dirty fix for KDecoration3 and Plasma 6.3 Requires updating: - SMOD Decoration - All C++ KWin effects --- kwin/decoration/CMakeLists.txt | 8 +- kwin/decoration/kdecoration/CMakeLists.txt | 4 +- kwin/decoration/kdecoration/breezebutton.cpp | 44 ++++----- kwin/decoration/kdecoration/breezebutton.h | 16 ++-- .../kdecoration/breezedecoration.cpp | 96 +++++++++---------- .../decoration/kdecoration/breezedecoration.h | 60 ++++++------ .../kdecoration/breezesettingsprovider.cpp | 2 +- kwin/decoration/kdecoration/smod.json | 2 +- .../kdecoration/smod/smodbutton.cpp | 12 +-- .../kdecoration/smod/smoddecoration.cpp | 34 +++---- kwin/effects_cpp/aeroglide/CMakeLists.txt | 2 +- .../kde-effects-aeroglassblur/CMakeLists.txt | 2 +- .../src/CMakeLists.txt | 2 +- .../kde-effects-aeroglassblur/src/blur.cpp | 6 +- .../kwin-effect-smodsnap-v2/CMakeLists.txt | 4 +- .../kwin-effect-smodsnap-v2/src/smodsnap.cpp | 4 +- kwin/effects_cpp/smodglow/CMakeLists.txt | 4 +- kwin/effects_cpp/smodglow/src/smodglow.cpp | 16 ++-- kwin/effects_cpp/smodglow/src/smodglow.h | 2 +- 19 files changed, 160 insertions(+), 160 deletions(-) diff --git a/kwin/decoration/CMakeLists.txt b/kwin/decoration/CMakeLists.txt index 59081fa1..b017d36f 100644 --- a/kwin/decoration/CMakeLists.txt +++ b/kwin/decoration/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.16) project(breeze) -set(PROJECT_VERSION "5.93.0") +set(PROJECT_VERSION "6.3.80") set(PROJECT_VERSION_MAJOR 6) set(KF5_MIN_VERSION "5.102.0") -set(KF6_MIN_VERSION "5.240.0") +set(KF6_MIN_VERSION "6.10.0") set(KDE_COMPILERSETTINGS_LEVEL "5.82") set(QT5_MIN_VERSION "5.15.2") -set(QT_MIN_VERSION "6.6.0") +set(QT_MIN_VERSION "6.7.0") include(GenerateExportHeader) include(WriteBasicConfigVersionFile) @@ -153,7 +153,7 @@ function(build_Qt6) add_subdirectory(libbreezecommon libbreezecommon6) if(WITH_DECORATIONS) - find_package(KDecoration2 REQUIRED) + find_package(KDecoration3 REQUIRED) add_subdirectory(kdecoration) endif() diff --git a/kwin/decoration/kdecoration/CMakeLists.txt b/kwin/decoration/kdecoration/CMakeLists.txt index c53529ec..58258abb 100644 --- a/kwin/decoration/kdecoration/CMakeLists.txt +++ b/kwin/decoration/kdecoration/CMakeLists.txt @@ -47,7 +47,7 @@ target_link_libraries(smoddecoration KF6::GuiAddons KF6::I18n KF6::IconThemes - KDecoration2::KDecoration + KDecoration3::KDecoration ) install(TARGETS smoddecoration DESTINATION ${KDE_INSTALL_PLUGINDIR}/${KDECORATION_PLUGIN_DIR}) @@ -82,7 +82,7 @@ ecm_generate_pkgconfig_file( BASE_NAME "smoddecoration" LIB_NAME ":org.smod.smod.so" INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR} - LIB_INSTALL_DIR ${KDE_INSTALL_PLUGINDIR}/org.kde.kdecoration2 + LIB_INSTALL_DIR ${KDE_INSTALL_PLUGINDIR}/org.kde.kdecoration3 FILENAME_VAR pkgconfig_filename ) diff --git a/kwin/decoration/kdecoration/breezebutton.cpp b/kwin/decoration/kdecoration/breezebutton.cpp index 3593ebda..651b1c1c 100644 --- a/kwin/decoration/kdecoration/breezebutton.cpp +++ b/kwin/decoration/kdecoration/breezebutton.cpp @@ -7,7 +7,7 @@ #include "breezebutton.h" #include -#include +#include #include #include @@ -16,9 +16,9 @@ namespace Breeze { -using KDecoration2::ColorGroup; -using KDecoration2::ColorRole; -using KDecoration2::DecorationButtonType; +using KDecoration3::ColorGroup; +using KDecoration3::ColorRole; +using KDecoration3::DecorationButtonType; //__________________________________________________________________ Button::Button(DecorationButtonType type, Decoration *decoration, QObject *parent) @@ -39,9 +39,9 @@ Button::Button(DecorationButtonType type, Decoration *decoration, QObject *paren updateGeometry(); // connections - connect(decoration->client(), SIGNAL(iconChanged(QIcon)), this, SLOT(update())); - connect(decoration->settings().get(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure); - connect(this, &KDecoration2::DecorationButton::hoveredChanged, this, &Button::updateAnimationState); + connect(decoration->window(), SIGNAL(iconChanged(QIcon)), this, SLOT(update())); + connect(decoration->settings().get(), &KDecoration3::DecorationSettings::reconfigured, this, &Button::reconfigure); + connect(this, &KDecoration3::DecorationButton::hoveredChanged, this, &Button::updateAnimationState); connect(this, &Button::buttonHoverStatus, decoration, &Decoration::buttonHoverStatus); @@ -65,31 +65,31 @@ Button::Button(QObject *parent, const QVariantList &args) m_iconSize = QSize(-1, -1); } -void Button::smodPaintGlow(QPainter *painter, const QRect &repaintArea) +void Button::smodPaintGlow(QPainter *painter, const QRectF &repaintArea) { return; } //__________________________________________________________________ -Button *Button::create(DecorationButtonType type, KDecoration2::Decoration *decoration, QObject *parent) +Button *Button::create(DecorationButtonType type, KDecoration3::Decoration *decoration, QObject *parent) { if (auto d = qobject_cast(decoration)) { Button *b = new Button(type, d, parent); - const auto c = d->client(); + const auto c = d->window(); switch (type) { case DecorationButtonType::Close: //b->setVisible(c->isCloseable()); - //QObject::connect(c, &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible); + //QObject::connect(c, &KDecoration3::DecoratedWindow::closeableChanged, b, &Breeze::Button::setVisible); b->setVisible(true); break; case DecorationButtonType::Maximize: b->setVisible(c->isMaximizeable() || c->isMinimizeable()); b->setEnabled(c->isMaximizeable()); - QObject::connect(c, &KDecoration2::DecoratedClient::maximizeableChanged, b, + QObject::connect(c, &KDecoration3::DecoratedWindow::maximizeableChanged, b, [b](bool maximizeable) { auto d = qobject_cast(b->decoration()); - const auto c = d->client(); + const auto c = d->window(); if (!c) { @@ -100,18 +100,18 @@ Button *Button::create(DecorationButtonType type, KDecoration2::Decoration *deco b->setEnabled(maximizeable); }); //b->setVisible(c->isMaximizeable()); - //QObject::connect(c, &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible); + //QObject::connect(c, &KDecoration3::DecoratedWindow::maximizeableChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::Minimize: //b->setVisible(c->isMinimizeable()); - //QObject::connect(c, &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible); + //QObject::connect(c, &KDecoration3::DecoratedWindow::minimizeableChanged, b, &Breeze::Button::setVisible); b->setVisible(c->isMinimizeable() || c->isMaximizeable()); b->setEnabled(c->isMinimizeable()); - QObject::connect(c, &KDecoration2::DecoratedClient::minimizeableChanged, b, + QObject::connect(c, &KDecoration3::DecoratedWindow::minimizeableChanged, b, [b](bool minimizeable) { auto d = qobject_cast(b->decoration()); - const auto c = d->client(); + const auto c = d->window(); if (!c) { @@ -125,16 +125,16 @@ Button *Button::create(DecorationButtonType type, KDecoration2::Decoration *deco case DecorationButtonType::ContextHelp: b->setVisible(c->providesContextHelp()); - QObject::connect(c, &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible); + QObject::connect(c, &KDecoration3::DecoratedWindow::providesContextHelpChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::Shade: b->setVisible(c->isShadeable()); - QObject::connect(c, &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible); + QObject::connect(c, &KDecoration3::DecoratedWindow::shadeableChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::Menu: - QObject::connect(c, &KDecoration2::DecoratedClient::iconChanged, b, [b]() { + QObject::connect(c, &KDecoration3::DecoratedWindow::iconChanged, b, [b]() { b->update(); }); break; @@ -150,7 +150,7 @@ Button *Button::create(DecorationButtonType type, KDecoration2::Decoration *deco } //__________________________________________________________________ -void Button::paint(QPainter *painter, const QRect &repaintRegion) +void Button::paint(QPainter *painter, const QRectF &repaintRegion) { smodPaint(painter, repaintRegion); return; @@ -330,7 +330,7 @@ QColor Button::backgroundColor() const return QColor(); } - auto c = d->client(); + auto c = d->window(); QColor redColor(c->color(ColorGroup::Warning, ColorRole::Foreground)); if (isPressed()) { diff --git a/kwin/decoration/kdecoration/breezebutton.h b/kwin/decoration/kdecoration/breezebutton.h index 76dc41e7..b74ed705 100644 --- a/kwin/decoration/kdecoration/breezebutton.h +++ b/kwin/decoration/kdecoration/breezebutton.h @@ -8,7 +8,7 @@ #pragma once #include "breezedecoration.h" -#include +#include #include #include @@ -23,7 +23,7 @@ class QVariantAnimation; namespace Breeze { -class Button : public KDecoration2::DecorationButton +class Button : public KDecoration3::DecorationButton { Q_OBJECT Q_PROPERTY(qreal hoverProgress READ hoverProgress WRITE setHoverProgress); @@ -36,10 +36,10 @@ public: virtual ~Button() = default; //* button creation - static Button *create(KDecoration2::DecorationButtonType type, KDecoration2::Decoration *decoration, QObject *parent); + static Button *create(KDecoration3::DecorationButtonType type, KDecoration3::Decoration *decoration, QObject *parent); //* render - virtual void paint(QPainter *painter, const QRect &repaintRegion) override; + virtual void paint(QPainter *painter, const QRectF &repaintRegion) override; //* flag enum Flag { @@ -106,10 +106,10 @@ public: qreal hoverProgress() const; void setHoverProgress(qreal hoverProgress); - void smodPaintGlow(QPainter *painter, const QRect &repaintArea); + void smodPaintGlow(QPainter *painter, const QRectF &repaintArea); void updateGeometry(); signals: - void buttonHoverStatus(KDecoration2::DecorationButtonType button, bool hovered, QPoint pos); + void buttonHoverStatus(KDecoration3::DecorationButtonType button, bool hovered, QPoint pos); protected: void hoverEnterEvent(QHoverEvent *event) override; @@ -125,13 +125,13 @@ private Q_SLOTS: private: //* private constructor - explicit Button(KDecoration2::DecorationButtonType type, Decoration *decoration, QObject *parent = nullptr); + explicit Button(KDecoration3::DecorationButtonType type, Decoration *decoration, QObject *parent = nullptr); //* draw button icon void drawIcon(QPainter *) const; void startHoverAnimation(qreal endValue); - void smodPaint(QPainter *painter, const QRect &repaintRegion); + void smodPaint(QPainter *painter, const QRectF &repaintRegion); //*@name colors //@{ diff --git a/kwin/decoration/kdecoration/breezedecoration.cpp b/kwin/decoration/kdecoration/breezedecoration.cpp index 3d3735b9..fcb4beed 100644 --- a/kwin/decoration/kdecoration/breezedecoration.cpp +++ b/kwin/decoration/kdecoration/breezedecoration.cpp @@ -15,8 +15,8 @@ #include "breezeboxshadowrenderer.h" -#include -#include +#include +#include #include #include @@ -38,8 +38,8 @@ K_PLUGIN_FACTORY_WITH_JSON(BreezeDecoFactory, "smod.json", registerPlugincolor(ColorGroup::Inactive, ColorRole::TitleBar); } else if (m_animation->state() == QAbstractAnimation::Running) { @@ -97,7 +97,7 @@ QColor Decoration::titleBarColor() const //________________________________________________________________ QColor Decoration::fontColor() const { - const auto c = client(); + const auto c = window(); if (m_animation->state() == QAbstractAnimation::Running) { return KColorUtils::mix(c->color(ColorGroup::Inactive, ColorRole::Foreground), c->color(ColorGroup::Active, ColorRole::Foreground), m_opacity); } else { @@ -116,7 +116,7 @@ void Decoration::init() SMOD::registerResource(m_internalSettings->decorationTheme()); g_sizingmargins.loadSizingMargins(); - const auto c = client(); + const auto c = window(); // active state change animation // It is important start and end value are of the same type, hence 0.0 and not just 0 m_animation->setStartValue(0.0); @@ -169,46 +169,46 @@ void Decoration::init() updateTitleBar(); auto s = settings(); - connect(s.get(), &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration3::DecorationSettings::borderSizeChanged, this, &Decoration::recalculateBorders); // a change in font might cause the borders to change - connect(s.get(), &KDecoration2::DecorationSettings::fontChanged, this, &Decoration::recalculateBorders); - connect(s.get(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration3::DecorationSettings::fontChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration3::DecorationSettings::spacingChanged, this, &Decoration::recalculateBorders); // buttons - connect(s.get(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::updateButtonsGeometryDelayed); - connect(s.get(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &Decoration::updateButtonsGeometryDelayed); - connect(s.get(), &KDecoration2::DecorationSettings::decorationButtonsRightChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration3::DecorationSettings::spacingChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration3::DecorationSettings::decorationButtonsLeftChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration3::DecorationSettings::decorationButtonsRightChanged, this, &Decoration::updateButtonsGeometryDelayed); // full reconfiguration - connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::reconfigure); - connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, SettingsProvider::self(), &SettingsProvider::reconfigure, Qt::UniqueConnection); - connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration3::DecorationSettings::reconfigured, this, &Decoration::reconfigure); + connect(s.get(), &KDecoration3::DecorationSettings::reconfigured, SettingsProvider::self(), &SettingsProvider::reconfigure, Qt::UniqueConnection); + connect(s.get(), &KDecoration3::DecorationSettings::reconfigured, this, &Decoration::updateButtonsGeometryDelayed); - connect(c, &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::recalculateBorders); - connect(c, &KDecoration2::DecoratedClient::maximizedHorizontallyChanged, this, &Decoration::recalculateBorders); - connect(c, &KDecoration2::DecoratedClient::maximizedVerticallyChanged, this, &Decoration::recalculateBorders); - connect(c, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::recalculateBorders); - connect(c, &KDecoration2::DecoratedClient::captionChanged, this, [this]() { + connect(c, &KDecoration3::DecoratedWindow::adjacentScreenEdgesChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration3::DecoratedWindow::maximizedHorizontallyChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration3::DecoratedWindow::maximizedVerticallyChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration3::DecoratedWindow::shadedChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration3::DecoratedWindow::captionChanged, this, [this]() { // update the caption area update(titleBar()); update(); // Prevents rendering artifacts with the text glow }); - connect(c, &KDecoration2::DecoratedClient::activeChanged, this, &Decoration::updateAnimationState); - connect(c, &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateTitleBar); - connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateTitleBar); - //connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::setOpaque); + connect(c, &KDecoration3::DecoratedWindow::activeChanged, this, &Decoration::updateAnimationState); + connect(c, &KDecoration3::DecoratedWindow::widthChanged, this, &Decoration::updateTitleBar); + connect(c, &KDecoration3::DecoratedWindow::maximizedChanged, this, &Decoration::updateTitleBar); + //connect(c, &KDecoration3::DecoratedWindow::maximizedChanged, this, &Decoration::setOpaque); - connect(c, &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateButtonsGeometry); - connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateButtonsGeometry); - connect(c, &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::updateButtonsGeometry); - connect(c, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateButtonsGeometry); + connect(c, &KDecoration3::DecoratedWindow::widthChanged, this, &Decoration::updateButtonsGeometry); + connect(c, &KDecoration3::DecoratedWindow::maximizedChanged, this, &Decoration::updateButtonsGeometry); + connect(c, &KDecoration3::DecoratedWindow::adjacentScreenEdgesChanged, this, &Decoration::updateButtonsGeometry); + connect(c, &KDecoration3::DecoratedWindow::shadedChanged, this, &Decoration::updateButtonsGeometry); - connect(c, &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateBlur); - connect(c, &KDecoration2::DecoratedClient::heightChanged, this, &Decoration::updateBlur); - connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBlur); - connect(c, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBlur); + connect(c, &KDecoration3::DecoratedWindow::widthChanged, this, &Decoration::updateBlur); + connect(c, &KDecoration3::DecoratedWindow::heightChanged, this, &Decoration::updateBlur); + connect(c, &KDecoration3::DecoratedWindow::maximizedChanged, this, &Decoration::updateBlur); + connect(c, &KDecoration3::DecoratedWindow::shadedChanged, this, &Decoration::updateBlur); createButtons(); updateShadow(); @@ -222,7 +222,7 @@ void Decoration::updateTitleBar() { // The titlebar rect has margins around it so the window can be resized by dragging a decoration edge. auto s = settings(); - const auto c = client(); + const auto c = window(); const bool maximized = isMaximized(); const int width = maximized ? c->width() : c->width() - 2 * s->smallSpacing() * Metrics::TitleBar_SideMargin; const int height = maximized ? borderTop() : borderTop() - s->smallSpacing() * Metrics::TitleBar_TopMargin; @@ -235,7 +235,7 @@ void Decoration::updateTitleBar() void Decoration::updateAnimationState() { if (m_shadowAnimation->duration() > 0) { - const auto c = client(); + const auto c = window(); m_shadowAnimation->setDirection(c->isActive() ? QAbstractAnimation::Forward : QAbstractAnimation::Backward); m_shadowAnimation->setEasingCurve(c->isActive() ? QEasingCurve::OutCubic : QEasingCurve::InCubic); if (m_shadowAnimation->state() != QAbstractAnimation::Running) { @@ -247,7 +247,7 @@ void Decoration::updateAnimationState() } if (m_animation->duration() > 0) { - const auto c = client(); + const auto c = window(); m_animation->setDirection(c->isActive() ? QAbstractAnimation::Forward : QAbstractAnimation::Backward); if (m_animation->state() != QAbstractAnimation::Running) { m_animation->start(); @@ -303,7 +303,7 @@ void Decoration::reconfigure() //________________________________________________________________ void Decoration::recalculateBorders() { - const auto c = client(); + const auto c = window(); auto s = settings(); // left, right and bottom borders @@ -369,8 +369,8 @@ void Decoration::recalculateBorders() //________________________________________________________________ void Decoration::createButtons() { - m_leftButtons = new KDecoration2::DecorationButtonGroup(KDecoration2::DecorationButtonGroup::Position::Left, this, &Button::create); - m_rightButtons = new KDecoration2::DecorationButtonGroup(KDecoration2::DecorationButtonGroup::Position::Right, this, &Button::create); + m_leftButtons = new KDecoration3::DecorationButtonGroup(KDecoration3::DecorationButtonGroup::Position::Left, this, &Button::create); + m_rightButtons = new KDecoration3::DecorationButtonGroup(KDecoration3::DecorationButtonGroup::Position::Right, this, &Button::create); updateButtonsGeometry(); } @@ -401,7 +401,7 @@ void Decoration::updateButtonsGeometry() m_rightButtons->setSpacing(g_sizingmargins.commonSizing().caption_button_spacing); } - foreach (QPointer button, m_rightButtons->buttons()) { + foreach (QPointer button, m_rightButtons->buttons()) { static_cast