Warning, /plasma/latte-dock/containment/package/contents/ui/BindingsExternal.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003 SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005
0006 import QtQuick 2.1
0007
0008 import org.kde.plasma.core 2.0 as PlasmaCore
0009 import org.kde.plasma.plasmoid 2.0
0010
0011 import org.kde.latte.core 0.2 as LatteCore
0012 import org.kde.latte.private.containment 0.1 as LatteContainment
0013
0014 Item {
0015 property bool updateIsEnabled: autosize.inCalculatedIconSize
0016 && !visibilityManager.inSlidingIn
0017 && !visibilityManager.inSlidingOut
0018 && !visibilityManager.inRelocationHiding
0019
0020 //! Latte::View Main Bindings
0021 Binding{
0022 target: latteView
0023 property:"maxThickness"
0024 //! prevents updating window geometry during closing window in wayland and such fixes a crash
0025 when: latteView && !visibilityManager.inRelocationHiding && !visibilityManager.inClientSideScreenEdgeSliding //&& !inStartup
0026 value: root.behaveAsPlasmaPanel ? visibilityManager.thicknessAsPanel : metrics.maxThicknessForView
0027 }
0028
0029 Binding{
0030 target: latteView
0031 property:"normalThickness"
0032 when: latteView && updateIsEnabled
0033 value: root.behaveAsPlasmaPanel ? visibilityManager.thicknessAsPanel : metrics.mask.screenEdge + metrics.mask.thickness.maxNormalForItemsWithoutScreenEdge
0034 }
0035
0036 Binding{
0037 target: latteView
0038 property:"maxNormalThickness"
0039 when: latteView && updateIsEnabled
0040 value: metrics.mask.thickness.maxNormal
0041 }
0042
0043 Binding {
0044 target: latteView
0045 property: "headThicknessGap"
0046 when: latteView && updateIsEnabled && !visibilityManager.inClientSideScreenEdgeSliding
0047 value: {
0048 if (root.behaveAsPlasmaPanel || root.viewType === LatteCore.Types.PanelView || (latteView && latteView.byPassWM)) {
0049 return 0;
0050 }
0051
0052 return metrics.maxThicknessForView - metrics.mask.thickness.maxNormalForItems;
0053 }
0054 }
0055
0056 Binding{
0057 target: latteView
0058 property: "type"
0059 when: latteView
0060 value: root.viewType
0061 }
0062
0063 Binding{
0064 target: latteView
0065 property: "behaveAsPlasmaPanel"
0066 when: latteView
0067 value: root.behaveAsPlasmaPanel
0068 }
0069
0070 Binding{
0071 target: latteView
0072 property: "fontPixelSize"
0073 when: theme
0074 value: theme.defaultFont.pixelSize
0075 }
0076
0077 Binding{
0078 target: latteView
0079 property: "maxLength"
0080 when: latteView
0081 value: root.maxLengthPerCentage/100
0082 }
0083
0084 Binding{
0085 target: latteView
0086 property: "offset"
0087 when: latteView
0088 value: plasmoid.configuration.offset/100
0089 }
0090
0091 Binding{
0092 target: latteView
0093 property: "screenEdgeMargin"
0094 when: latteView
0095 value: Math.max(0, plasmoid.configuration.screenEdgeMargin)
0096 }
0097
0098 Binding{
0099 target: latteView
0100 property: "screenEdgeMarginEnabled"
0101 when: latteView
0102 value: root.screenEdgeMarginEnabled && !root.hideThickScreenGap
0103 }
0104
0105 Binding{
0106 target: latteView
0107 property: "alignment"
0108 when: latteView
0109 value: myView.alignment
0110 }
0111
0112 Binding{
0113 target: latteView
0114 property: "isTouchingTopViewAndIsBusy"
0115 when: root.viewIsAvailable
0116 value: {
0117 if (!root.viewIsAvailable) {
0118 return false;
0119 }
0120
0121 var isTouchingTopScreenEdge = (latteView.y === latteView.screenGeometry.y);
0122 var isStickedOnTopBorder = (plasmoid.configuration.alignment === LatteCore.Types.Justify && plasmoid.configuration.maxLength===100)
0123 || (plasmoid.configuration.alignment === LatteCore.Types.Top && plasmoid.configuration.offset===0);
0124
0125 return root.isVertical && !latteView.visibility.isHidden && !isTouchingTopScreenEdge && isStickedOnTopBorder && background.isShown;
0126 }
0127 }
0128
0129 Binding{
0130 target: latteView
0131 property: "isTouchingBottomViewAndIsBusy"
0132 when: latteView
0133 value: {
0134 if (!root.viewIsAvailable) {
0135 return false;
0136 }
0137
0138 var latteBottom = latteView.y + latteView.height;
0139 var screenBottom = latteView.screenGeometry.y + latteView.screenGeometry.height;
0140 var isTouchingBottomScreenEdge = (latteBottom === screenBottom);
0141
0142 var isStickedOnBottomBorder = (plasmoid.configuration.alignment === LatteCore.Types.Justify && plasmoid.configuration.maxLength===100)
0143 || (plasmoid.configuration.alignment === LatteCore.Types.Bottom && plasmoid.configuration.offset===0);
0144
0145 return root.isVertical && !latteView.visibility.isHidden && !isTouchingBottomScreenEdge && isStickedOnBottomBorder && background.isShown;
0146 }
0147 }
0148
0149 Binding{
0150 target: latteView
0151 property: "colorizer"
0152 when: latteView
0153 value: colorizerManager
0154 }
0155
0156 Binding{
0157 target: latteView
0158 property: "metrics"
0159 when: latteView
0160 value: metrics
0161 }
0162
0163 //! View::Effects bindings
0164 Binding{
0165 target: latteView && latteView.effects ? latteView.effects : null
0166 property: "backgroundAllCorners"
0167 when: latteView && latteView.effects
0168 value: plasmoid.configuration.backgroundAllCorners
0169 && (!root.screenEdgeMarginEnabled /*no-floating*/
0170 || (root.screenEdgeMarginEnabled /*floating with justify alignment and 100% maxlength*/
0171 && plasmoid.configuration.maxLength===100
0172 && myView.alignment===LatteCore.Types.Justify
0173 && !root.hideLengthScreenGaps))
0174 }
0175
0176 Binding{
0177 target: latteView && latteView.effects ? latteView.effects : null
0178 property: "backgroundRadius"
0179 when: latteView && latteView.effects
0180 value: background.customRadius
0181 }
0182
0183 Binding{
0184 target: latteView && latteView.effects ? latteView.effects : null
0185 property: "backgroundRadiusEnabled"
0186 when: latteView && latteView.effects
0187 value: background.customRadiusIsEnabled
0188 }
0189
0190 Binding{
0191 target: latteView && latteView.effects ? latteView.effects : null
0192 property: "backgroundOpacity"
0193 when: latteView && latteView.effects
0194 value: plasmoid.configuration.panelTransparency===-1 /*Default option*/ ? -1 : background.currentOpacity
0195 }
0196
0197 Binding{
0198 target: latteView && latteView.effects ? latteView.effects : null
0199 property: "drawEffects"
0200 when: latteView && latteView.effects && !root.inStartup
0201 value: LatteCore.WindowSystem.compositingActive
0202 && (((root.blurEnabled && root.useThemePanel) || (root.blurEnabled && root.forceSolidPanel))
0203 && (!root.inStartup || visibilityManager.inRelocationHiding))
0204 }
0205
0206 Binding{
0207 target: latteView && latteView.effects ? latteView.effects : null
0208 property: "drawShadows"
0209 when: latteView && latteView.effects
0210 value: root.drawShadowsExternal && (!root.inStartup || visibilityManager.inRelocationHiding) && !(latteView && latteView.visibility.isHidden)
0211 }
0212
0213 Binding{
0214 target: latteView && latteView.effects ? latteView.effects : null
0215 property:"editShadow"
0216 when: latteView && latteView.effects
0217 value: root.editShadow
0218 }
0219
0220 Binding{
0221 target: latteView && latteView.effects ? latteView.effects : null
0222 property:"innerShadow"
0223 when: latteView && latteView.effects
0224 value: background.shadows.headThickness
0225 }
0226
0227 Binding{
0228 target: latteView && latteView.effects ? latteView.effects : null
0229 property: "panelBackgroundSvg"
0230 when: latteView && latteView.effects
0231 value: background.panelBackgroundSvg
0232 }
0233
0234 Binding{
0235 target: latteView && latteView.effects ? latteView.effects : null
0236 property:"appletsLayoutGeometry"
0237 when: latteView && latteView.effects && visibilityManager.inNormalState
0238 value: {
0239 if (root.behaveAsPlasmaPanel
0240 || !LatteCore.WindowSystem.compositingActive
0241 || (!parabolic.isEnabled && root.userShowPanelBackground && plasmoid.configuration.panelSize===100)) {
0242 var paddingtail = background.tailRoundness + background.tailRoundnessMargin;
0243 var paddinghead = background.headRoundness + background.headRoundnessMargin;
0244
0245 if (root.isHorizontal) {
0246 return Qt.rect(latteView.localGeometry.x + paddingtail,
0247 latteView.localGeometry.y,
0248 latteView.localGeometry.width - paddingtail - paddinghead,
0249 latteView.localGeometry.height);
0250 } else {
0251 return Qt.rect(latteView.localGeometry.x,
0252 latteView.localGeometry.y + paddingtail,
0253 latteView.localGeometry.width,
0254 latteView.localGeometry.height - paddingtail - paddinghead);
0255 }
0256 }
0257
0258 return Qt.rect(-1, -1, 0, 0);
0259 }
0260 }
0261
0262 //! View::Positioner bindings
0263 Binding{
0264 target: latteView && latteView.positioner ? latteView.positioner : null
0265 property: "isStickedOnTopEdge"
0266 when: latteView && latteView.positioner
0267 value: plasmoid.configuration.isStickedOnTopEdge
0268 }
0269
0270 Binding{
0271 target: latteView && latteView.positioner ? latteView.positioner : null
0272 property: "isStickedOnBottomEdge"
0273 when: latteView && latteView.positioner
0274 value: plasmoid.configuration.isStickedOnBottomEdge
0275 }
0276
0277 //! View::VisibilityManager
0278 Binding{
0279 target: latteView && latteView.visibility ? latteView.visibility : null
0280 property: "isShownFully"
0281 when: latteView && latteView.visibility
0282 value: myView.isShownFully
0283 }
0284
0285 Binding{
0286 target: latteView && latteView.visibility ? latteView.visibility : null
0287 property: "strutsThickness"
0288 when: latteView && latteView.visibility
0289 value: {
0290 var isCapableToHideScreenGap = root.screenEdgeMarginEnabled && plasmoid.configuration.hideFloatingGapForMaximized
0291 var mirrorGapFactor = root.mirrorScreenGap ? 2 : 1;
0292
0293 //! Hide Thickness Screen Gap scenario provides two different struts thicknesses.
0294 //! [1] The first struts thickness is when there is no maximized window and is such case
0295 //! the view is behaving as in normal AlwaysVisible visibility mode. This is very useful
0296 //! when users tile windows. [bug #432122]
0297 //! [2] The second struts thickness is when there is a maximized window present and in such case
0298 //! the view is hiding all of its screen edges. It is used mostly when the view is wanted
0299 //! to act as a window titlebar.
0300 var thicknessForIsCapableToHideScreenGap = (root.hideThickScreenGap ? 0 : mirrorGapFactor * metrics.mask.screenEdge);
0301
0302 if (root.behaveAsPlasmaPanel) {
0303 return isCapableToHideScreenGap ?
0304 (visibilityManager.thicknessAsPanel + thicknessForIsCapableToHideScreenGap) :
0305 (mirrorGapFactor*metrics.mask.screenEdge) + visibilityManager.thicknessAsPanel;
0306 }
0307
0308 var edgeThickness = isCapableToHideScreenGap ? thicknessForIsCapableToHideScreenGap : metrics.mask.screenEdge * mirrorGapFactor;
0309 return edgeThickness + metrics.mask.thickness.maxNormalForItemsWithoutScreenEdge;
0310 }
0311 }
0312
0313 Binding {
0314 target: latteView && latteView.visibility ? latteView.visibility : null
0315 property: "isFloatingGapWindowEnabled"
0316 when: latteView && latteView.visibility
0317 value: root.hasFloatingGapInputEventsDisabled
0318 && (latteView.visibility.mode === LatteCore.Types.AutoHide
0319 || latteView.visibility.mode === LatteCore.Types.DodgeActive
0320 || latteView.visibility.mode === LatteCore.Types.DodgeAllWindows
0321 || latteView.visibility.mode === LatteCore.Types.DodgeMaximized
0322 || latteView.visibility.mode === LatteCore.Types.SidebarAutoHide)
0323 }
0324
0325 //! View::WindowsTracker bindings
0326 Binding{
0327 target: latteView && latteView.windowsTracker ? latteView.windowsTracker : null
0328 property: "enabled"
0329 //! During startup phase windows tracking is not enabled and does not
0330 //! influence startup sequence at all. At the same time no windows tracking
0331 //! takes place during startup and as such startup time is reduced
0332 when: latteView && latteView.windowsTracker && latteView.visibility && !root.inStartup
0333 value: (latteView && latteView.visibility
0334 && !(latteView.visibility.mode === LatteCore.Types.AlwaysVisible /* Visibility */
0335 || latteView.visibility.mode === LatteCore.Types.WindowsGoBelow
0336 || latteView.visibility.mode === LatteCore.Types.AutoHide))
0337 || indexer.clientsTrackingWindowsCount > 0 /*Applets Need Windows Tracking */
0338 || root.dragActiveWindowEnabled /*Dragging Active Window(Empty Areas)*/
0339 || ((root.backgroundOnlyOnMaximized /*Dynamic Background */
0340 || plasmoid.configuration.solidBackgroundForMaximized
0341 || root.disablePanelShadowMaximized
0342 || root.windowColors !== LatteContainment.Types.NoneWindowColors))
0343 || (root.screenEdgeMarginsEnabled /*Dynamic Screen Edge Margin*/
0344 && plasmoid.configuration.hideFloatingGapForMaximized)
0345 }
0346
0347 //! View::ExtendedInterface bindings
0348 Binding{
0349 target: latteView && latteView.extendedInterface ? latteView.extendedInterface : null
0350 property: "plasmoid"
0351 when: latteView && latteView.extendedInterface
0352 value: plasmoid
0353 }
0354
0355 Binding{
0356 target: latteView && latteView.extendedInterface ? latteView.extendedInterface : null
0357 property: "layoutManager"
0358 when: latteView && latteView.extendedInterface
0359 value: fastLayoutManager
0360 }
0361 }