mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-25 19:21:41 +03:00
update applets windows tracking for AppletsRecords
This commit is contained in:
parent
e4a609f250
commit
92a6319dac
@ -786,7 +786,7 @@ Window{
|
||||
}
|
||||
|
||||
Text{
|
||||
text: root.appletsNeedWindowsTracking
|
||||
text: appletsRecords.windowsTrackingCount
|
||||
}
|
||||
|
||||
Text{
|
||||
|
@ -336,7 +336,7 @@ Item{
|
||||
&& !(latteView.visibility.mode === LatteCore.Types.AlwaysVisible /* Visibility */
|
||||
|| latteView.visibility.mode === LatteCore.Types.WindowsGoBelow
|
||||
|| latteView.visibility.mode === LatteCore.Types.AutoHide))
|
||||
|| root.appletsNeedWindowsTracking > 0 /*Applets Neew Windows Tracking */
|
||||
|| appletsRecords.windowsTrackingCount > 0 /*Applets Need Windows Tracking */
|
||||
|| root.dragActiveWindowEnabled /*Dragging Active Window(Empty Areas)*/
|
||||
|| ((root.backgroundOnlyOnMaximized /*Dynamic Background */
|
||||
|| plasmoid.configuration.solidBackgroundForMaximized
|
||||
|
@ -22,6 +22,7 @@ import QtQuick 2.0
|
||||
Item {
|
||||
id: records
|
||||
|
||||
property int windowsTrackingCount: 0 //! number of applets requesting windows tracking
|
||||
property real maxInnerZoomFactor: 1.0 //! maximum inner zoom factor based on all applets
|
||||
|
||||
property var applets: []
|
||||
@ -44,10 +45,14 @@ Item {
|
||||
if (ind>=0) {
|
||||
//! remove
|
||||
applets.splice(ind, 1);
|
||||
updateInnerZoomFactor();
|
||||
updateValues();
|
||||
}
|
||||
}
|
||||
|
||||
function addDefaultRecord(applet) {
|
||||
applets.push({id: applet, innerZoomFactor: 1.0, windowsTrackingEnabled: false});
|
||||
}
|
||||
|
||||
function setInnerZoomFactor(applet, inner) {
|
||||
var len = applets.length;
|
||||
var ind = indexOf(applet);
|
||||
@ -60,11 +65,35 @@ Item {
|
||||
}
|
||||
} else {
|
||||
//! add
|
||||
applets.push({id: applet, innerZoomFactor: inner});
|
||||
addDefaultRecord(applet);
|
||||
applets[len].innerZoomFactor = inner;
|
||||
updateInnerZoomFactor();
|
||||
}
|
||||
}
|
||||
|
||||
function setWindowsTrackingEnabled(applet, value) {
|
||||
var len = applets.length;
|
||||
var ind = indexOf(applet);
|
||||
|
||||
if (ind>=0) {
|
||||
//! update
|
||||
if(applets[ind].windowsTrackingEnabled !== value) {
|
||||
applets[ind].windowsTrackingEnabled = value;
|
||||
updateWindowsTrackingCount();
|
||||
}
|
||||
} else {
|
||||
//! add
|
||||
addDefaultRecord(applet);
|
||||
applets[len].windowsTrackingEnabled = value;
|
||||
updateWindowsTrackingCount();
|
||||
}
|
||||
}
|
||||
|
||||
function updateValues() {
|
||||
updateInnerZoomFactor();
|
||||
updateWindowsTrackingCount();
|
||||
}
|
||||
|
||||
function updateInnerZoomFactor() {
|
||||
var len = applets.length;
|
||||
var max = 1;
|
||||
@ -77,4 +106,17 @@ Item {
|
||||
|
||||
maxInnerZoomFactor = max;
|
||||
}
|
||||
|
||||
function updateWindowsTrackingCount() {
|
||||
var len = applets.length;
|
||||
var cnt = 0;
|
||||
|
||||
for (var i=0; i<len; ++i) {
|
||||
if (applets[i].windowsTrackingEnabled) {
|
||||
cnt = cnt + 1;
|
||||
}
|
||||
}
|
||||
|
||||
windowsTrackingCount = cnt;
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +55,6 @@ Item{
|
||||
readonly property Item requires: AbilityDefinition.AppletRequirements{}
|
||||
//! END OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS
|
||||
|
||||
property bool windowsTrackingEnabledSent: false
|
||||
|
||||
//! BEGIN OF FUNCTIONS
|
||||
function appletIconItemIsShown() {
|
||||
return appletIconItem && appletIconItem.visible;
|
||||
@ -85,13 +83,7 @@ Item{
|
||||
}
|
||||
|
||||
onWindowsTrackingEnabledChanged: {
|
||||
if (requires.windowsTrackingEnabled && !mainCommunicator.windowsTrackingEnabledSent) {
|
||||
mainCommunicator.windowsTrackingEnabledSent = true;
|
||||
root.slotAppletsNeedWindowsTracking(1);
|
||||
} else if (!requires.windowsTrackingEnabled && mainCommunicator.windowsTrackingEnabledSent) {
|
||||
mainCommunicator.windowsTrackingEnabledSent = false;
|
||||
root.slotAppletsNeedWindowsTracking(-1);
|
||||
}
|
||||
appletItem.appletsRecords.setWindowsTrackingEnabled(appletItem, requires.windowsTrackingEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,13 +99,6 @@ Item{
|
||||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
if (requires.windowsTrackingEnabled && windowsTrackingEnabledSent) {
|
||||
windowsTrackingEnabledSent = false;
|
||||
root.slotAppletsNeedWindowsTracking(-1);
|
||||
}
|
||||
}
|
||||
|
||||
//! END OF CONNECTIONS
|
||||
|
||||
//! BEGIN OF LOADERS
|
||||
|
@ -252,8 +252,6 @@ Item {
|
||||
property alias hoveredIndex: layoutsContainer.hoveredIndex
|
||||
property alias directRenderDelayerIsRunning: directRenderDelayerForEnteringTimer.running
|
||||
|
||||
property int appletsNeedWindowsTracking: 0
|
||||
|
||||
readonly property int minAppletLengthInConfigure: 64
|
||||
readonly property int maxJustifySplitterSize: 96
|
||||
|
||||
@ -460,10 +458,12 @@ Item {
|
||||
property Item latteApplet
|
||||
|
||||
readonly property alias animations: _animations
|
||||
readonly property alias appletsRecords: _appletsRecords
|
||||
readonly property alias autosize: _autosize
|
||||
readonly property alias container: _container
|
||||
readonly property alias indicatorsManager: indicators
|
||||
readonly property alias parabolicManager: _parabolicManager
|
||||
|
||||
readonly property alias maskManager: visibilityManager
|
||||
readonly property alias layoutsContainerItem: layoutsContainer
|
||||
|
||||
@ -1231,14 +1231,6 @@ Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
function slotAppletsNeedWindowsTracking(step) {
|
||||
if (step === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
appletsNeedWindowsTracking = Math.max(appletsNeedWindowsTracking + step, 0);
|
||||
}
|
||||
|
||||
function slotPreviewsShown(){
|
||||
if (latteView) {
|
||||
latteView.extendedInterface.deactivateApplets();
|
||||
|
Loading…
Reference in New Issue
Block a user