2018-11-30 21:33:46 +02:00
/*
* Copyright 2018 Michail Vourlakos < mvourlakos @ gmail . com >
*
* This file is part of Latte - Dock
*
* Latte - Dock is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation ; either version 2 of
* the License , or ( at your option ) any later version .
*
* Latte - Dock is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# include "effects.h"
2018-12-02 02:05:52 +02:00
// local
2020-05-12 03:10:17 +03:00
# include <config-latte.h>
2020-04-24 14:52:16 +03:00
# include <coretypes.h>
2018-11-30 21:33:46 +02:00
# include "panelshadows_p.h"
2018-12-06 12:15:58 +02:00
# include "view.h"
2020-07-19 15:04:46 +03:00
# include "../lattecorona.h"
# include "../wm/abstractwindowinterface.h"
2018-11-30 21:33:46 +02:00
2018-12-02 02:05:52 +02:00
// Qt
2018-11-30 21:33:46 +02:00
# include <QRegion>
2018-12-02 02:05:52 +02:00
// KDE
2018-11-30 21:33:46 +02:00
# include <KWindowEffects>
# include <KWindowSystem>
2020-04-22 14:09:42 +03:00
2018-11-30 21:33:46 +02:00
namespace Latte {
2018-12-06 11:37:14 +02:00
namespace ViewPart {
2018-11-30 21:33:46 +02:00
2018-12-06 12:15:58 +02:00
Effects : : Effects ( Latte : : View * parent )
2018-11-30 21:33:46 +02:00
: QObject ( parent ) ,
m_view ( parent )
{
2020-07-19 15:04:46 +03:00
m_corona = qobject_cast < Latte : : Corona * > ( m_view - > corona ( ) ) ;
2018-11-30 21:33:46 +02:00
init ( ) ;
}
Effects : : ~ Effects ( )
{
}
void Effects : : init ( )
{
2018-12-01 09:29:20 +02:00
connect ( this , & Effects : : backgroundOpacityChanged , this , & Effects : : updateEffects ) ;
2018-11-30 21:33:46 +02:00
connect ( this , & Effects : : drawEffectsChanged , this , & Effects : : updateEffects ) ;
2020-03-05 22:11:06 +02:00
connect ( this , & Effects : : enabledBordersChanged , this , & Effects : : updateEffects ) ;
2018-12-01 00:26:56 +02:00
connect ( this , & Effects : : rectChanged , this , & Effects : : updateEffects ) ;
2018-11-30 21:33:46 +02:00
2020-05-16 19:17:35 +03:00
connect ( this , & Effects : : subtractedMaskRegionsChanged , this , & Effects : : updateMask ) ;
connect ( this , & Effects : : unitedMaskRegionsChanged , this , & Effects : : updateMask ) ;
2018-11-30 21:33:46 +02:00
connect ( this , & Effects : : drawShadowsChanged , this , [ & ] ( ) {
if ( m_view - > behaveAsPlasmaPanel ( ) ) {
updateEnabledBorders ( ) ;
}
} ) ;
2020-07-20 19:20:33 +03:00
connect ( this , & Effects : : backgroundAllCornersChanged , this , & Effects : : updateEnabledBorders ) ;
2018-12-06 12:15:58 +02:00
connect ( m_view , & Latte : : View : : alignmentChanged , this , & Effects : : updateEnabledBorders ) ;
2020-07-17 17:03:14 +03:00
connect ( m_view , & Latte : : View : : maxLengthChanged , this , & Effects : : updateEnabledBorders ) ;
2020-07-20 15:16:03 +03:00
connect ( m_view , & Latte : : View : : offsetChanged , this , & Effects : : updateEnabledBorders ) ;
2020-05-12 14:45:31 +03:00
connect ( m_view , & Latte : : View : : screenEdgeMarginEnabledChanged , this , & Effects : : updateEnabledBorders ) ;
2018-12-06 12:15:58 +02:00
connect ( m_view , & Latte : : View : : behaveAsPlasmaPanelChanged , this , & Effects : : updateEffects ) ;
2020-05-12 14:45:31 +03:00
connect ( this , & Effects : : drawShadowsChanged , this , & Effects : : updateShadows ) ;
2018-12-06 12:15:58 +02:00
connect ( m_view , & Latte : : View : : behaveAsPlasmaPanelChanged , this , & Effects : : updateShadows ) ;
2019-03-08 23:43:08 +02:00
connect ( m_view , & Latte : : View : : configWindowGeometryChanged , this , & Effects : : updateMask ) ;
2020-05-12 14:45:31 +03:00
2019-06-16 15:31:37 +03:00
connect ( & m_theme , & Plasma : : Theme : : themeChanged , this , [ & ] ( ) {
2019-06-16 17:44:02 +03:00
auto background = m_background ;
m_background = new Plasma : : FrameSvg ( this ) ;
if ( background ) {
background - > deleteLater ( ) ;
}
if ( m_background - > imagePath ( ) ! = " widgets/panel-background " ) {
m_background - > setImagePath ( QStringLiteral ( " widgets/panel-background " ) ) ;
}
2019-06-16 15:31:37 +03:00
updateBackgroundContrastValues ( ) ;
updateEffects ( ) ;
} ) ;
2018-11-30 21:33:46 +02:00
}
2018-12-01 09:42:09 +02:00
bool Effects : : animationsBlocked ( ) const
{
return m_animationsBlocked ;
}
void Effects : : setAnimationsBlocked ( bool blocked )
{
if ( m_animationsBlocked = = blocked ) {
return ;
}
m_animationsBlocked = blocked ;
emit animationsBlockedChanged ( ) ;
}
2020-07-20 19:20:33 +03:00
bool Effects : : backgroundAllCorners ( ) const
{
return m_backgroundAllCorners ;
}
void Effects : : setBackgroundAllCorners ( bool allcorners )
{
if ( m_backgroundAllCorners = = allcorners ) {
return ;
}
m_backgroundAllCorners = allcorners ;
emit backgroundAllCornersChanged ( ) ;
}
2018-11-30 21:33:46 +02:00
bool Effects : : drawShadows ( ) const
{
return m_drawShadows ;
}
void Effects : : setDrawShadows ( bool draw )
{
if ( m_drawShadows = = draw ) {
return ;
}
m_drawShadows = draw ;
emit drawShadowsChanged ( ) ;
}
bool Effects : : drawEffects ( ) const
{
return m_drawEffects ;
}
void Effects : : setDrawEffects ( bool draw )
{
if ( m_drawEffects = = draw ) {
return ;
}
m_drawEffects = draw ;
emit drawEffectsChanged ( ) ;
}
2020-03-02 18:44:40 +02:00
void Effects : : setForceBottomBorder ( bool draw )
2018-11-30 21:33:46 +02:00
{
2020-03-02 18:44:40 +02:00
if ( m_forceBottomBorder = = draw ) {
return ;
}
m_forceBottomBorder = draw ;
updateEnabledBorders ( ) ;
2018-11-30 21:33:46 +02:00
}
2020-03-02 18:44:40 +02:00
void Effects : : setForceTopBorder ( bool draw )
2018-11-30 21:33:46 +02:00
{
2020-03-02 18:44:40 +02:00
if ( m_forceTopBorder = = draw ) {
2018-11-30 21:33:46 +02:00
return ;
}
2020-03-02 18:44:40 +02:00
m_forceTopBorder = draw ;
updateEnabledBorders ( ) ;
2018-11-30 21:33:46 +02:00
}
2020-05-10 16:49:43 +03:00
float Effects : : backgroundOpacity ( ) const
2018-12-01 09:29:20 +02:00
{
return m_backgroundOpacity ;
}
2020-05-10 16:49:43 +03:00
void Effects : : setBackgroundOpacity ( float opacity )
2018-12-01 09:29:20 +02:00
{
if ( m_backgroundOpacity = = opacity ) {
return ;
}
m_backgroundOpacity = opacity ;
2019-06-16 15:31:37 +03:00
updateBackgroundContrastValues ( ) ;
2018-12-01 09:29:20 +02:00
emit backgroundOpacityChanged ( ) ;
}
2019-03-09 12:23:51 +02:00
int Effects : : editShadow ( ) const
{
return m_editShadow ;
}
void Effects : : setEditShadow ( int shadow )
{
if ( m_editShadow = = shadow ) {
return ;
}
m_editShadow = shadow ;
emit editShadowChanged ( ) ;
}
2018-12-01 00:52:05 +02:00
int Effects : : innerShadow ( ) const
{
return m_innerShadow ;
}
void Effects : : setInnerShadow ( int shadow )
{
if ( m_innerShadow = = shadow )
return ;
m_innerShadow = shadow ;
emit innerShadowChanged ( ) ;
}
2018-12-01 00:26:56 +02:00
QRect Effects : : rect ( ) const
2018-11-30 21:33:46 +02:00
{
2018-12-01 00:26:56 +02:00
return m_rect ;
2018-11-30 21:33:46 +02:00
}
2018-12-01 00:26:56 +02:00
void Effects : : setRect ( QRect area )
2018-11-30 21:33:46 +02:00
{
2020-01-30 22:01:34 +02:00
if ( m_rect = = area ) {
return ;
2018-11-30 21:33:46 +02:00
}
2020-01-30 22:01:34 +02:00
m_rect = area ;
2018-12-01 00:26:56 +02:00
emit rectChanged ( ) ;
2018-11-30 21:33:46 +02:00
}
2018-12-01 00:26:56 +02:00
QRect Effects : : mask ( ) const
2018-11-30 21:33:46 +02:00
{
2018-12-01 00:26:56 +02:00
return m_mask ;
2018-11-30 21:33:46 +02:00
}
2018-12-01 00:26:56 +02:00
void Effects : : setMask ( QRect area )
2018-11-30 21:33:46 +02:00
{
2019-06-15 15:43:12 +03:00
if ( m_mask = = area )
2018-11-30 21:33:46 +02:00
return ;
2018-12-01 00:26:56 +02:00
m_mask = area ;
2019-03-08 23:43:08 +02:00
updateMask ( ) ;
2018-11-30 21:33:46 +02:00
2019-03-08 23:43:08 +02:00
// qDebug() << "dock mask set:" << m_mask;
emit maskChanged ( ) ;
}
2020-07-19 15:04:46 +03:00
QRect Effects : : inputMask ( ) const
{
return m_inputMask ;
}
void Effects : : setInputMask ( QRect area )
{
if ( m_inputMask = = area ) {
return ;
}
m_inputMask = area ;
m_corona - > wm ( ) - > setInputMask ( m_view , area ) ;
emit inputMaskChanged ( ) ;
}
2019-04-16 23:51:06 +03:00
void Effects : : forceMaskRedraw ( )
{
if ( m_background ) {
delete m_background ;
}
m_background = new Plasma : : FrameSvg ( this ) ;
m_background - > setImagePath ( QStringLiteral ( " widgets/panel-background " ) ) ;
m_background - > setEnabledBorders ( m_enabledBorders ) ;
updateMask ( ) ;
}
2020-05-16 19:17:35 +03:00
void Effects : : setSubtractedMaskRegion ( const QString & regionid , const QRegion & region )
{
2020-05-16 21:37:50 +03:00
if ( m_subtractedMaskRegions . contains ( regionid ) & & m_subtractedMaskRegions [ regionid ] = = region ) {
2020-05-16 19:17:35 +03:00
return ;
}
m_subtractedMaskRegions [ regionid ] = region ;
emit subtractedMaskRegionsChanged ( ) ;
}
void Effects : : removeSubtractedMaskRegion ( const QString & regionid )
{
if ( ! m_subtractedMaskRegions . contains ( regionid ) ) {
return ;
}
m_subtractedMaskRegions . remove ( regionid ) ;
emit subtractedMaskRegionsChanged ( ) ;
}
void Effects : : setUnitedMaskRegion ( const QString & regionid , const QRegion & region )
{
2020-05-16 21:37:50 +03:00
if ( m_unitedMaskRegions . contains ( regionid ) & & m_unitedMaskRegions [ regionid ] = = region ) {
2020-05-16 19:17:35 +03:00
return ;
}
m_unitedMaskRegions [ regionid ] = region ;
emit unitedMaskRegionsChanged ( ) ;
}
void Effects : : removeUnitedMaskRegion ( const QString & regionid )
{
if ( ! m_unitedMaskRegions . contains ( regionid ) ) {
return ;
}
m_unitedMaskRegions . remove ( regionid ) ;
emit unitedMaskRegionsChanged ( ) ;
}
QRegion Effects : : maskCombinedRegion ( )
{
QRegion region = m_mask ;
for ( auto subregion : m_subtractedMaskRegions ) {
region = region . subtracted ( subregion ) ;
}
for ( auto subregion : m_unitedMaskRegions ) {
region = region . united ( subregion ) ;
}
return region ;
}
2019-03-08 23:43:08 +02:00
void Effects : : updateMask ( )
{
2018-11-30 21:33:46 +02:00
if ( KWindowSystem : : compositingActive ( ) ) {
if ( m_view - > behaveAsPlasmaPanel ( ) ) {
m_view - > setMask ( QRect ( ) ) ;
} else {
2020-05-16 19:17:35 +03:00
m_view - > setMask ( maskCombinedRegion ( ) ) ;
2018-11-30 21:33:46 +02:00
}
} else {
//! this is used when compositing is disabled and provides
//! the correct way for the mask to be painted in order for
//! rounded corners to be shown correctly
//! the enabledBorders check was added because there was cases
2019-01-01 11:19:44 +02:00
//! that the mask region wasn't calculated correctly after location changes
2019-04-16 23:51:06 +03:00
if ( ! m_background ) {
if ( m_background & & m_background - > enabledBorders ( ) ! = m_enabledBorders ) {
delete m_background ;
}
2018-11-30 21:33:46 +02:00
m_background = new Plasma : : FrameSvg ( this ) ;
}
2019-04-16 23:51:06 +03:00
if ( m_background - > imagePath ( ) ! = " widgets/panel-background " ) {
m_background - > setImagePath ( QStringLiteral ( " widgets/panel-background " ) ) ;
2018-11-30 21:33:46 +02:00
}
m_background - > setEnabledBorders ( m_enabledBorders ) ;
2019-03-08 23:43:08 +02:00
m_background - > resizeFrame ( m_mask . size ( ) ) ;
2018-11-30 21:33:46 +02:00
QRegion fixedMask = m_background - > mask ( ) ;
2018-12-01 00:26:56 +02:00
fixedMask . translate ( m_mask . x ( ) , m_mask . y ( ) ) ;
2018-11-30 21:33:46 +02:00
//! fix for KF5.32 that return empty QRegion's for the mask
if ( fixedMask . isEmpty ( ) ) {
2018-12-01 00:26:56 +02:00
fixedMask = QRegion ( m_mask ) ;
2018-11-30 21:33:46 +02:00
}
m_view - > setMask ( fixedMask ) ;
}
}
2018-12-01 10:18:56 +02:00
void Effects : : clearShadows ( )
{
PanelShadows : : self ( ) - > removeWindow ( m_view ) ;
}
void Effects : : updateShadows ( )
{
if ( m_view - > behaveAsPlasmaPanel ( ) & & drawShadows ( ) ) {
PanelShadows : : self ( ) - > addWindow ( m_view , enabledBorders ( ) ) ;
} else {
PanelShadows : : self ( ) - > removeWindow ( m_view ) ;
}
}
2018-11-30 21:33:46 +02:00
void Effects : : updateEffects ( )
{
//! Don't apply any effect before the wayland surface is created under wayland
//! https://bugs.kde.org/show_bug.cgi?id=392890
if ( KWindowSystem : : isPlatformWayland ( ) & & ! m_view - > surface ( ) ) {
return ;
}
2020-02-08 10:52:45 +02:00
bool clearEffects { true } ;
2020-03-01 18:18:45 +02:00
if ( m_drawEffects ) {
if ( ! m_view - > behaveAsPlasmaPanel ( ) ) {
if ( ! m_rect . isNull ( ) & & ! m_rect . isEmpty ( ) ) {
//! this is used when compositing is disabled and provides
//! the correct way for the mask to be painted in order for
//! rounded corners to be shown correctly
if ( ! m_background ) {
m_background = new Plasma : : FrameSvg ( this ) ;
}
if ( m_background - > imagePath ( ) ! = " widgets/panel-background " ) {
m_background - > setImagePath ( QStringLiteral ( " widgets/panel-background " ) ) ;
}
m_background - > setEnabledBorders ( m_enabledBorders ) ;
m_background - > resizeFrame ( m_rect . size ( ) ) ;
2020-03-05 22:11:06 +02:00
QRegion backMask = m_background - > mask ( ) ;
//! There are cases that mask is NULL even though it should not
2020-07-29 00:02:50 +03:00
//! Example: SidebarOnDemand from v0.10 that BEHAVEASPLASMAPANEL in EditMode
2020-03-05 22:11:06 +02:00
//! switching multiple times between inConfigureAppletsMode and LiveEditMode
//! is such a case
2020-05-11 20:59:05 +03:00
QRegion fixedMask ;
2020-05-12 03:10:17 +03:00
int fX = m_rect . x ( ) ; int fY = m_rect . y ( ) ;
# if KF5_VERSION_MINOR >= 65
//! Latte is now using GtkFrameExtents so Effects geometries must be adjusted
//! windows that use GtkFrameExtents and apply Effects on them they take GtkFrameExtents
//! as granted
if ( KWindowSystem : : isPlatformX11 ( ) ) {
2020-07-20 19:20:33 +03:00
if ( m_view - > location ( ) = = Plasma : : Types : : BottomEdge ) {
fY = qMax ( 0 , fY - m_view - > headThicknessGap ( ) ) ;
} else if ( m_view - > location ( ) = = Plasma : : Types : : RightEdge ) {
fX = qMax ( 0 , fX - m_view - > headThicknessGap ( ) ) ;
}
2020-05-12 03:10:17 +03:00
}
# endif
2020-05-11 20:59:05 +03:00
if ( ! backMask . isNull ( ) ) {
fixedMask = backMask ;
2020-05-12 03:10:17 +03:00
fixedMask . translate ( fX , fY ) ;
2020-05-11 20:59:05 +03:00
} else {
2020-05-12 03:10:17 +03:00
fixedMask = QRect ( fX , fY , m_rect . width ( ) , m_rect . height ( ) ) ;
2020-05-11 20:59:05 +03:00
}
2020-03-01 18:18:45 +02:00
if ( ! fixedMask . isEmpty ( ) ) {
clearEffects = false ;
KWindowEffects : : enableBlurBehind ( m_view - > winId ( ) , true , fixedMask ) ;
KWindowEffects : : enableBackgroundContrast ( m_view - > winId ( ) ,
m_theme . backgroundContrastEnabled ( ) ,
m_backEffectContrast ,
m_backEffectIntesity ,
m_backEffectSaturation ,
fixedMask ) ;
}
}
} else {
//! BEHAVEASPLASMAPANEL case
2020-02-08 10:52:45 +02:00
clearEffects = false ;
2020-03-01 18:18:45 +02:00
KWindowEffects : : enableBlurBehind ( m_view - > winId ( ) , true ) ;
2020-02-08 10:52:45 +02:00
KWindowEffects : : enableBackgroundContrast ( m_view - > winId ( ) ,
m_theme . backgroundContrastEnabled ( ) ,
m_backEffectContrast ,
m_backEffectIntesity ,
2020-03-01 18:18:45 +02:00
m_backEffectSaturation ) ;
2018-11-30 21:33:46 +02:00
}
2020-02-08 10:52:45 +02:00
}
2018-11-30 21:33:46 +02:00
2020-02-08 10:52:45 +02:00
if ( clearEffects ) {
2018-11-30 21:33:46 +02:00
KWindowEffects : : enableBlurBehind ( m_view - > winId ( ) , false ) ;
KWindowEffects : : enableBackgroundContrast ( m_view - > winId ( ) , false ) ;
}
}
//!BEGIN draw panel shadows outside the dock window
Plasma : : FrameSvg : : EnabledBorders Effects : : enabledBorders ( ) const
{
return m_enabledBorders ;
}
2019-06-16 15:31:37 +03:00
qreal Effects : : currentMidValue ( const qreal & max , const qreal & factor , const qreal & min ) const
{
if ( max = = min | | factor = = 0 ) {
return min ;
}
qreal space = 0 ;
qreal distance = 0 ;
if ( max < min ) {
space = min - max ;
distance = factor * space ;
return 1 - distance ;
} else {
space = max - min ;
distance = factor * space ;
return 1 + distance ;
}
}
void Effects : : updateBackgroundContrastValues ( )
{
if ( ! m_theme . backgroundContrastEnabled ( ) ) {
m_backEffectContrast = 1 ;
m_backEffectIntesity = 1 ;
m_backEffectSaturation = 1 ;
return ;
}
2020-05-10 16:49:43 +03:00
m_backEffectContrast = currentMidValue ( m_theme . backgroundContrast ( ) , m_backgroundOpacity , 1 ) ;
m_backEffectIntesity = currentMidValue ( m_theme . backgroundIntensity ( ) , m_backgroundOpacity , 1 ) ;
m_backEffectSaturation = currentMidValue ( m_theme . backgroundSaturation ( ) , m_backgroundOpacity , 1 ) ;
2019-06-16 15:31:37 +03:00
}
2018-11-30 21:33:46 +02:00
void Effects : : updateEnabledBorders ( )
{
if ( ! m_view - > screen ( ) ) {
return ;
}
Plasma : : FrameSvg : : EnabledBorders borders = Plasma : : FrameSvg : : AllBorders ;
2020-07-20 19:20:33 +03:00
if ( ! m_view - > screenEdgeMarginEnabled ( ) & & ! m_backgroundAllCorners ) {
2019-12-24 12:35:28 +02:00
switch ( m_view - > location ( ) ) {
case Plasma : : Types : : TopEdge :
borders & = ~ Plasma : : FrameSvg : : TopBorder ;
break ;
2018-11-30 21:33:46 +02:00
2019-12-24 12:35:28 +02:00
case Plasma : : Types : : LeftEdge :
borders & = ~ Plasma : : FrameSvg : : LeftBorder ;
break ;
2018-11-30 21:33:46 +02:00
2019-12-24 12:35:28 +02:00
case Plasma : : Types : : RightEdge :
borders & = ~ Plasma : : FrameSvg : : RightBorder ;
break ;
2018-11-30 21:33:46 +02:00
2019-12-24 12:35:28 +02:00
case Plasma : : Types : : BottomEdge :
borders & = ~ Plasma : : FrameSvg : : BottomBorder ;
break ;
2018-11-30 21:33:46 +02:00
2019-12-24 12:35:28 +02:00
default :
break ;
}
2018-11-30 21:33:46 +02:00
}
2020-07-20 19:20:33 +03:00
if ( ! m_backgroundAllCorners ) {
if ( ( m_view - > location ( ) = = Plasma : : Types : : LeftEdge | | m_view - > location ( ) = = Plasma : : Types : : RightEdge ) ) {
if ( m_view - > maxLength ( ) = = 1 & & m_view - > alignment ( ) = = Latte : : Types : : Justify ) {
if ( ! m_forceTopBorder ) {
borders & = ~ Plasma : : FrameSvg : : TopBorder ;
}
if ( ! m_forceBottomBorder ) {
borders & = ~ Plasma : : FrameSvg : : BottomBorder ;
}
}
if ( m_view - > alignment ( ) = = Latte : : Types : : Top & & ! m_forceTopBorder & & m_view - > offset ( ) = = 0 ) {
2020-03-02 18:44:40 +02:00
borders & = ~ Plasma : : FrameSvg : : TopBorder ;
}
2020-07-20 19:20:33 +03:00
if ( m_view - > alignment ( ) = = Latte : : Types : : Bottom & & ! m_forceBottomBorder & & m_view - > offset ( ) = = 0 ) {
2020-03-02 18:44:40 +02:00
borders & = ~ Plasma : : FrameSvg : : BottomBorder ;
}
2018-11-30 21:33:46 +02:00
}
2020-07-20 19:20:33 +03:00
if ( m_view - > location ( ) = = Plasma : : Types : : TopEdge | | m_view - > location ( ) = = Plasma : : Types : : BottomEdge ) {
if ( m_view - > maxLength ( ) = = 1 & & m_view - > alignment ( ) = = Latte : : Types : : Justify ) {
borders & = ~ Plasma : : FrameSvg : : LeftBorder ;
borders & = ~ Plasma : : FrameSvg : : RightBorder ;
}
2018-11-30 21:33:46 +02:00
2020-07-20 19:20:33 +03:00
if ( m_view - > alignment ( ) = = Latte : : Types : : Left & & m_view - > offset ( ) = = 0 ) {
borders & = ~ Plasma : : FrameSvg : : LeftBorder ;
}
2018-11-30 21:33:46 +02:00
2020-07-20 19:20:33 +03:00
if ( m_view - > alignment ( ) = = Latte : : Types : : Right & & m_view - > offset ( ) = = 0 ) {
borders & = ~ Plasma : : FrameSvg : : RightBorder ;
}
2018-11-30 21:33:46 +02:00
}
}
if ( m_enabledBorders ! = borders ) {
m_enabledBorders = borders ;
emit enabledBordersChanged ( ) ;
}
if ( ! m_view - > behaveAsPlasmaPanel ( ) | | ! m_drawShadows ) {
PanelShadows : : self ( ) - > removeWindow ( m_view ) ;
} else {
PanelShadows : : self ( ) - > setEnabledBorders ( m_view , borders ) ;
}
}
//!END draw panel shadows outside the dock window
}
}