1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-30 14:50:12 +03:00

optimize screenGeometry calls from Tasks plasmoid

--plasmoid.screenGeometry is costly under Latte environment
because it supports multple layouts in multiple activities.
By using the View::screenGeometry the calls are minimized
almost totally.
This commit is contained in:
Michail Vourlakos 2019-05-08 20:55:29 +03:00
parent f43d1b56c7
commit 7ae63e7dd1
2 changed files with 9 additions and 9 deletions

View File

@ -246,6 +246,9 @@ Item {
property alias tasksCount: tasksModel.count
property alias hoveredIndex: icList.hoveredIndex
readonly property bool viewLayoutIsCurrent: latteView && currentLayout && latteView.universalLayoutManager
&& currentLayout.name === latteView.universalLayoutManager.currentLayoutName
readonly property rect screenGeometry: latteView ? latteView.screenGeometry : plasmoid.screenGeometry
property QtObject currentLayout : latteView && latteView.managedLayout ? latteView.managedLayout : null
property var badgesForActivate: latteView ? latteView.badgesForActivate : []
@ -722,7 +725,7 @@ Item {
id: tasksModel
virtualDesktop: virtualDesktopInfo.currentDesktop
screenGeometry: plasmoid.screenGeometry
screenGeometry: root.screenGeometry
// comment in order to support LTS Plasma 5.8
// screen: plasmoid.screen
activity: activityInfo.currentActivity

View File

@ -1198,10 +1198,7 @@ MouseArea{
function slotPublishGeometries() {
//! this way we make sure that layouts that are in different activities that the current layout
//! don't publish their geometries
if ( canPublishGeometries
&& (!latteView
|| (latteView && currentLayout && latteView.universalLayoutManager &&
currentLayout.name === latteView.universalLayoutManager.currentLayoutName))) {
if ( canPublishGeometries && (!latteView || root.viewLayoutIsCurrent)) {
var globalChoords = backend.globalRect(wrapper.visualIconItem);
var limits = backend.globalRect(scrollableList);
@ -1246,13 +1243,13 @@ MouseArea{
globalChoords.y = adjY;
if (root.position === PlasmaCore.Types.BottomPositioned) {
globalChoords.y = plasmoid.screenGeometry.y+plasmoid.screenGeometry.height-1;
globalChoords.y = root.screenGeometry.y+root.screenGeometry.height-1;
} else if (root.position === PlasmaCore.Types.TopPositioned) {
globalChoords.y = plasmoid.screenGeometry.y+1;
globalChoords.y = root.screenGeometry.y+1;
} else if (root.position === PlasmaCore.Types.LeftPositioned) {
globalChoords.x = plasmoid.screenGeometry.x+1;
globalChoords.x = root.screenGeometry.x+1;
} else if (root.position === PlasmaCore.Types.RightPositioned) {
globalChoords.x = plasmoid.screenGeometry.x+plasmoid.screenGeometry.width - 1;
globalChoords.x = root.screenGeometry.x+root.screenGeometry.width - 1;
}
tasksModel.requestPublishDelegateGeometry(taskItem.modelIndex(), globalChoords, taskItem);