From 1d7e9393569aad1f0b8bd1e45b4d519503e8468d Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 4 Feb 2021 18:18:45 +0200 Subject: [PATCH] isGraphicsSystemAccelerated at Environment Ability --- .../package/contents/ui/applet/AppletItem.qml | 1 + .../package/contents/ui/applet/ItemWrapper.qml | 4 ++-- .../package/contents/ui/applet/ShortcutBadge.qml | 3 ++- .../contents/ui/applet/colorizer/Applet.qml | 4 +++- .../ui/applet/communicator/LatteBridge.qml | 1 + .../package/contents/ui/colorizer/Manager.qml | 2 +- .../package/contents/ui/editmode/ConfigOverlay.qml | 2 +- containment/package/contents/ui/main.qml | 14 ++++++++------ .../abilities/client/AppletAbilities.qml | 6 ++++++ declarativeimports/abilities/items/BasicItem.qml | 10 +++------- .../abilities/items/basicitem/ParabolicItem.qml | 4 +++- .../abilities/items/basicitem/ShortcutBadge.qml | 3 ++- plasmoid/package/contents/ui/main.qml | 7 ------- plasmoid/package/contents/ui/task/TaskIcon.qml | 11 +++++++---- .../animations/RemoveWindowFromGroupAnimation.qml | 3 ++- 15 files changed, 42 insertions(+), 33 deletions(-) diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 33c10ce2b..934f1dd30 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -305,6 +305,7 @@ Item { property Item animations: null property Item debug: null + property Item environment: null property Item indexer: null property Item indicators: null property Item launchers: null diff --git a/containment/package/contents/ui/applet/ItemWrapper.qml b/containment/package/contents/ui/applet/ItemWrapper.qml index 44b07db59..f451ffb04 100644 --- a/containment/package/contents/ui/applet/ItemWrapper.qml +++ b/containment/package/contents/ui/applet/ItemWrapper.qml @@ -73,7 +73,7 @@ Item{ return communicator.parabolicEffectIsSupported ? appletPreferredThickness : scaledThickness + appletItem.metrics.margin.screenEdge; } - opacity: appletColorizer.mustBeShown && graphicsSystem.isAccelerated ? 0 : 1 + opacity: appletColorizer.mustBeShown && appletItem.environment.isGraphicsSystemAccelerated ? 0 : 1 property bool disableLengthScale: false property bool disableThicknessScale: false @@ -365,7 +365,7 @@ Item{ anchors.fill: _wrapperContainer active: appletItem.applet - && graphicsSystem.isAccelerated + && appletItem.environment.isGraphicsSystemAccelerated && !appletColorizer.mustBeShown && (appletItem.myView.itemShadow.isEnabled && !appletItem.communicator.indexerIsSupported) diff --git a/containment/package/contents/ui/applet/ShortcutBadge.qml b/containment/package/contents/ui/applet/ShortcutBadge.qml index 8968fe99b..84973001f 100644 --- a/containment/package/contents/ui/applet/ShortcutBadge.qml +++ b/containment/package/contents/ui/applet/ShortcutBadge.qml @@ -80,7 +80,8 @@ Loader{ sourceComponent: Item{ Loader{ anchors.fill: appletNumber - active: appletItem.myView.itemShadow.isEnabled && graphicsSystem.isAccelerated + active: appletItem.myView.itemShadow.isEnabled + && appletItem.environment.isGraphicsSystemAccelerated sourceComponent: DropShadow{ color: appletItem.myView.itemShadow.shadowColor diff --git a/containment/package/contents/ui/applet/colorizer/Applet.qml b/containment/package/contents/ui/applet/colorizer/Applet.qml index d0b6deab8..145822a95 100644 --- a/containment/package/contents/ui/applet/colorizer/Applet.qml +++ b/containment/package/contents/ui/applet/colorizer/Applet.qml @@ -36,7 +36,9 @@ Item { id: colorizedAppletShadow anchors.fill: colorizer - active: graphicsSystem.isAccelerated && plasmoid.configuration.appletShadowsEnabled && (appletColorizer.opacity>0) + active: appletItem.environment.isGraphicsSystemAccelerated + && plasmoid.configuration.appletShadowsEnabled + && (appletColorizer.opacity>0) sourceComponent: DropShadow{ anchors.fill: parent diff --git a/containment/package/contents/ui/applet/communicator/LatteBridge.qml b/containment/package/contents/ui/applet/communicator/LatteBridge.qml index f70ec284a..7a01f2b80 100644 --- a/containment/package/contents/ui/applet/communicator/LatteBridge.qml +++ b/containment/package/contents/ui/applet/communicator/LatteBridge.qml @@ -143,6 +143,7 @@ Item{ readonly property Item actions: Actions{} readonly property Item applet: mainCommunicator.requires readonly property alias containment: _containment.publicApi + readonly property Item environment: appletItem.environment.publicApi readonly property Item debug: appletItem.debug.publicApi readonly property Item indicators: appletItem.indicators.publicApi readonly property Item metrics: appletItem.metrics.publicApi diff --git a/containment/package/contents/ui/colorizer/Manager.qml b/containment/package/contents/ui/colorizer/Manager.qml index 3ad96142f..b945da39d 100644 --- a/containment/package/contents/ui/colorizer/Manager.qml +++ b/containment/package/contents/ui/colorizer/Manager.qml @@ -72,7 +72,7 @@ Loader{ && latteView.windowsTracker.currentScreen.touchingWindowScheme) property QtObject applyTheme: { - if (!graphicsSystem.isAccelerated) { + if (!root.environment.isGraphicsSystemAccelerated) { return theme; } diff --git a/containment/package/contents/ui/editmode/ConfigOverlay.qml b/containment/package/contents/ui/editmode/ConfigOverlay.qml index 625aa9ee4..faa01d1a9 100644 --- a/containment/package/contents/ui/editmode/ConfigOverlay.qml +++ b/containment/package/contents/ui/editmode/ConfigOverlay.qml @@ -408,7 +408,7 @@ MouseArea { height: width anchors.centerIn: parent opacity: 0.9 - layer.enabled: graphicsSystem.isAccelerated + layer.enabled: root.environment.isGraphicsSystemAccelerated layer.effect: DropShadow { radius: root.myView.itemShadow.size fast: true diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 22756927b..41ded0dcd 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -28,6 +28,8 @@ import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 import org.kde.plasma.plasmoid 2.0 +import org.kde.latte.abilities.host 0.1 as AbilityHost + import org.kde.latte.core 0.2 as LatteCore import org.kde.latte.components 1.0 as LatteComponents import org.kde.latte.private.app 0.1 as LatteApp @@ -326,6 +328,7 @@ Item { readonly property alias autosize: _autosize readonly property alias background: _background readonly property alias debug: _debug + readonly property alias environment: _environment readonly property alias indexer: _indexer readonly property alias indicators: _indicators readonly property alias layouter: _layouter @@ -930,6 +933,7 @@ Item { Applet.AppletItem{ animations: _animations debug: _debug + environment: _environment indexer: _indexer indicators: _indicators launchers: _launchers @@ -944,12 +948,6 @@ Item { } } - Item { - id: graphicsSystem - readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software) - && (GraphicsInfo.api !== GraphicsInfo.Unknown) - } - Upgrader { id: upgrader } @@ -1136,6 +1134,10 @@ Item { id: _debug } + AbilityHost.Environment{ + id: _environment + } + Ability.Indexer { id: _indexer layouts: layoutsContainer diff --git a/declarativeimports/abilities/client/AppletAbilities.qml b/declarativeimports/abilities/client/AppletAbilities.qml index 48f99b605..b78696bbf 100644 --- a/declarativeimports/abilities/client/AppletAbilities.qml +++ b/declarativeimports/abilities/client/AppletAbilities.qml @@ -64,6 +64,7 @@ Item { readonly property alias animations: _animations readonly property alias containment: _containment readonly property alias debug: _debug + readonly property alias environment: _environment readonly property alias indexer: _indexer readonly property alias indicators: _indicators readonly property alias metrics: _metrics @@ -89,6 +90,11 @@ Item { bridge: _abilityContainer.bridge } + AbilityClient.Environment { + id: _environment + bridge: _abilityContainer.bridge + } + AbilityClient.Indexer { id: _indexer bridge: _abilityContainer.bridge diff --git a/declarativeimports/abilities/items/BasicItem.qml b/declarativeimports/abilities/items/BasicItem.qml index ef36ad510..686b9e562 100644 --- a/declarativeimports/abilities/items/BasicItem.qml +++ b/declarativeimports/abilities/items/BasicItem.qml @@ -198,12 +198,6 @@ Item{ NumberAnimation { duration: abilityItem.abilities.animations.speedFactor.current * abilityItem.abilities.animations.duration.large } } - Item { - id: graphicsSystem - readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software) - && (GraphicsInfo.api !== GraphicsInfo.Unknown) - } - Loader{ anchors.fill: parent active: abilityItem.abilities.debug.graphicsEnabled @@ -261,7 +255,9 @@ Item{ Loader{ id: separatorShadow anchors.fill: separatorItem - active: abilityItem.abilities.myView.itemShadow.isEnabled && isSeparator && graphicsSystem.isAccelerated + active: abilityItem.abilities.myView.itemShadow.isEnabled + && isSeparator + && abilityItem.abilities.environment.isGraphicsSystemAccelerated opacity: separatorItem.forceHiddenState ? 0 : 0.4 Behavior on opacity { diff --git a/declarativeimports/abilities/items/basicitem/ParabolicItem.qml b/declarativeimports/abilities/items/basicitem/ParabolicItem.qml index 713c773d2..ef6a5ed82 100644 --- a/declarativeimports/abilities/items/basicitem/ParabolicItem.qml +++ b/declarativeimports/abilities/items/basicitem/ParabolicItem.qml @@ -135,7 +135,9 @@ Item{ //! Shadows Loader{ anchors.fill: _contentItemContainer - active: abilityItem.abilities.myView.itemShadow.isEnabled && !abilityItem.isSeparator && graphicsSystem.isAccelerated + active: abilityItem.abilities.myView.itemShadow.isEnabled + && !abilityItem.isSeparator + && abilityItem.abilities.environment.isGraphicsSystemAccelerated sourceComponent: DropShadow{ anchors.fill: parent diff --git a/declarativeimports/abilities/items/basicitem/ShortcutBadge.qml b/declarativeimports/abilities/items/basicitem/ShortcutBadge.qml index 596fac890..67d5f7513 100644 --- a/declarativeimports/abilities/items/basicitem/ShortcutBadge.qml +++ b/declarativeimports/abilities/items/basicitem/ShortcutBadge.qml @@ -65,7 +65,8 @@ Loader{ sourceComponent: Item{ Loader{ anchors.fill: taskNumber - active: abilityItem.abilities.myView.itemShadow.isEnabled && graphicsSystem.isAccelerated + active: abilityItem.abilities.myView.itemShadow.isEnabled + && abilityItem.abilities.environment.isGraphicsSystemAccelerated sourceComponent: DropShadow{ color: abilityItem.abilities.myView.itemShadow.shadowColor diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 776526461..4910de63f 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -280,13 +280,6 @@ Item { id: colorScopePalette } - //! - Item { - id: graphicsSystem - readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software) - && (GraphicsInfo.api !== GraphicsInfo.Unknown) - } - ///UPDATE function updateListViewParent() { if (scrollingEnabled) { diff --git a/plasmoid/package/contents/ui/task/TaskIcon.qml b/plasmoid/package/contents/ui/task/TaskIcon.qml index 24eb57302..904d11b92 100644 --- a/plasmoid/package/contents/ui/task/TaskIcon.qml +++ b/plasmoid/package/contents/ui/task/TaskIcon.qml @@ -135,7 +135,7 @@ Item { Loader{ id: badgesLoader anchors.fill: taskIconContainer - active: (activateProgress > 0) && graphicsSystem.isAccelerated + active: (activateProgress > 0) && taskItem.abilities.environment.isGraphicsSystemAccelerated asynchronous: true opacity: stateColorizer.opacity > 0 ? 0 : 1 @@ -316,7 +316,8 @@ Item { opacity: badgesLoader.activateProgress visible: badgesLoader.showInfo || badgesLoader.showProgress - layer.enabled: taskItem.abilities.myView.itemShadow.isEnabled && graphicsSystem.isAccelerated + layer.enabled: taskItem.abilities.myView.itemShadow.isEnabled + && taskItem.abilities.environment.isGraphicsSystemAccelerated layer.effect: DropShadow { color: taskItem.abilities.myView.itemShadow.shadowColor fast: true @@ -333,7 +334,8 @@ Item { opacity: badgesLoader.activateProgress visible: badgesLoader.showAudio - layer.enabled: taskItem.abilities.myView.itemShadow.isEnabled && graphicsSystem.isAccelerated + layer.enabled: taskItem.abilities.myView.itemShadow.isEnabled + && taskItem.abilities.environment.isGraphicsSystemAccelerated layer.effect: DropShadow { color: taskItem.abilities.myView.itemShadow.shadowColor fast: true @@ -357,7 +359,8 @@ Item { //! when the latte view is removed Loader { anchors.fill: parent - active: badgeVisualsLoader.active && graphicsSystem.isAccelerated + active: badgeVisualsLoader.active + && taskItem.abilities.environment.isGraphicsSystemAccelerated sourceComponent: Colorize{ source: badgeVisualsLoader.item diff --git a/plasmoid/package/contents/ui/task/animations/RemoveWindowFromGroupAnimation.qml b/plasmoid/package/contents/ui/task/animations/RemoveWindowFromGroupAnimation.qml index 9e94d9bd3..9968034b5 100644 --- a/plasmoid/package/contents/ui/task/animations/RemoveWindowFromGroupAnimation.qml +++ b/plasmoid/package/contents/ui/task/animations/RemoveWindowFromGroupAnimation.qml @@ -70,7 +70,8 @@ Item{ Loader{ id: tempTaskShadow anchors.fill: tempRemoveIcon - active: taskItem.abilities.myView.itemShadow.isEnabled && graphicsSystem.isAccelerated + active: taskItem.abilities.myView.itemShadow.isEnabled + && taskItem.abilities.environment.isGraphicsSystemAccelerated sourceComponent: DropShadow{ anchors.fill: parent