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

track how many applets need windowsTracking

This commit is contained in:
Michail Vourlakos 2019-06-02 14:36:53 +03:00
parent 62b8aa6987
commit 3c97bd222e
6 changed files with 62 additions and 3 deletions

View File

@ -742,6 +742,21 @@ Window{
text: layoutsContainer.endLayout.sizeWithNoFillApplets+" px."
}
Text{
text: " ----------- "
}
Text{
text: " ----------- "
}
Text{
text: "Applets need Windows Tracking"+space
}
Text{
text: root.appletsNeedWindowsTracking
}
}
}

View File

@ -235,10 +235,11 @@ Item{
property: "enabled"
when: latteView && latteView.windowsTracker && latteView.visibility
value: (latteView && latteView.visibility
&& !(latteView.visibility.mode === Latte.Types.AlwaysVisible
&& !(latteView.visibility.mode === Latte.Types.AlwaysVisible /* Visibility */
|| latteView.visibility.mode === Latte.Types.WindowsGoBelow
|| latteView.visibility.mode === Latte.Types.AutoHide))
|| ((root.backgroundOnlyOnMaximized
|| root.appletsNeedWindowsTracking > 0 /*Applets Neew Windows Tracking */
|| ((root.backgroundOnlyOnMaximized /*Dynamic Background */
|| plasmoid.configuration.solidBackgroundForMaximized
|| root.disablePanelShadowMaximized
|| root.windowColors !== Latte.Types.NoneWindowColors))

View File

@ -66,6 +66,8 @@ Item{
mainCommunicator.activeIndicatorEnabled = value;
} else if (parameter === "parabolicEffectLocked") {
mainCommunicator.parabolicEffectLocked = value;
} else if (parameter === "needWindowsTracking") {
mainCommunicator.needWindowsTracking = value;
}
}
@ -78,6 +80,8 @@ Item{
return mainCommunicator.activeIndicatorEnabled;
} else if (parameter === "parabolicEffectLocked") {
return mainCommunicator.parabolicEffectLocked;
} else if (parameter === "needWindowsTracking") {
return mainCommunicator.needWindowsTracking;
}
return null;

View File

@ -53,12 +53,15 @@ Item{
property bool latteSideColoringEnabled: true
property bool latteIconOverlayEnabled: true
property bool activeIndicatorEnabled: true
property bool needWindowsTracking: false
property bool parabolicEffectLocked: false
//! END OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS
//! BEGIN OF PROPERTY CHANGES
//! END OF PROPERTY CHANGES
property bool needWindowsTrackingSent: false
//! BEGIN OF FUNCTIONS
function appletIconItemIsShown() {
return appletIconItem && appletIconItem.visible;
@ -79,6 +82,16 @@ Item{
}
//! END OF FUNCTIONS
onNeedWindowsTrackingChanged: {
if (needWindowsTracking && !needWindowsTrackingSent) {
needWindowsTrackingSent = true;
root.slotAppletsNeedWindowsTracking(1);
} else if (!needWindowTracking && needWindowsTrackingSent) {
needWindowsTrackingSent = false;
root.slotAppletsNeedWindowsTracking(-1);
}
}
//! BEGIN OF CONNECTIONS
Connections{
target: appletItem
@ -90,6 +103,14 @@ Item{
}
}
}
Component.onDestruction: {
if (needWindowsTracking && needWindowsTrackingSent) {
needWindowsTrackingSent = false;
root.slotAppletsNeedWindowsTracking(-1);
}
}
//! END OF CONNECTIONS
//! BEGIN OF LOADERS

View File

@ -80,7 +80,15 @@ Item{
// @since: 0.9
readonly property int iconSize: root.iconSize
readonly property QtObject windowsTracker: latteView ? latteView.windowsTracker : null
// NAME: windowsTracker
// USAGE: read-only
// EXPLANATION: windows tracking based on the view this applet is present
// USE CASE: it can be used from applets that want windows tracking in order
// to update their appearance or their behavior accordingly
// @since: 0.9
readonly property QtObject windowsTracker: mainCommunicator.needsWindowTracking && latteView && latteView.windowsTracker ?
latteView.windowsTracker : null
property Item actions: Actions{}

View File

@ -204,6 +204,8 @@ Item {
property int animationTime: durationTime*2.8*units.longDuration
property int appletsNeedWindowsTracking: 0
property int automaticIconSizeBasedSize: -1 //it is not set, this is the defautl
//what is the highest icon size based on what icon size is used, screen calculated or user specified
@ -1259,6 +1261,14 @@ Item {
visibilityManager.updateMaskArea();
}
function slotAppletsNeedWindowsTracking(step) {
if (step === 0) {
return;
}
appletsNeedWindowsTracking = Math.max(appletsNeedWindowsTracking + step, 0);
}
//this is used when dragging a task in order to not hide the dock
//and also by the menu appearing from tasks for the same reason
function slotActionsBlockHiding(step) {