1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 01:33:50 +03:00

provide isSidebar flag for view::visibility

This commit is contained in:
Michail Vourlakos 2021-05-21 17:08:19 +03:00
parent f2dda7347c
commit a001eab39c
3 changed files with 24 additions and 4 deletions

View File

@ -75,6 +75,7 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
connect(this, &VisibilityManager::enableKWinEdgesChanged, this, &VisibilityManager::updateKWinEdgesSupport);
connect(this, &VisibilityManager::modeChanged, this, &VisibilityManager::updateKWinEdgesSupport);
connect(this, &VisibilityManager::modeChanged, this, &VisibilityManager::updateSidebarState);
connect(this, &VisibilityManager::isFloatingGapWindowEnabledChanged, this, &VisibilityManager::onIsFloatingGapWindowEnabledChanged);
@ -379,6 +380,20 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
emit modeChanged();
}
void VisibilityManager::updateSidebarState()
{
bool cursidebarstate = ((m_mode == Types::SidebarOnDemand)
|| (m_mode == Types::SidebarAutoHide));
if (m_isSidebar == cursidebarstate) {
return;
}
m_isSidebar == cursidebarstate;
emit isSidebarChanged();
}
void VisibilityManager::updateStrutsBasedOnLayoutsAndActivities(bool forceUpdate)
{
bool inMultipleLayoutsAndCurrent = (m_corona->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts

View File

@ -61,6 +61,7 @@ class VisibilityManager : public QObject
Q_PROPERTY(bool isHidden READ isHidden WRITE setIsHidden NOTIFY isHiddenChanged)
Q_PROPERTY(bool isShownFully READ isShownFully WRITE setIsShownFully NOTIFY isShownFullyChanged)
Q_PROPERTY(bool isBelowLayer READ isBelowLayer NOTIFY isBelowLayerChanged)
Q_PROPERTY(bool isSidebar READ isSidebar NOTIFY isSidebarChanged)
Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged)
//! Floating Gap Window to identify mouse between the screenEdge and the view when it does not accept any other
@ -115,6 +116,7 @@ public:
int timerHide() const;
void setTimerHide(int msec);
bool isSidebar() const;
bool hasBlockHidingEvent(const QString &type);
//! KWin Edges Support functions
@ -140,8 +142,6 @@ public slots:
Q_INVOKABLE void addBlockHidingEvent(const QString &type);
Q_INVOKABLE void removeBlockHidingEvent(const QString &type);
Q_INVOKABLE bool isSidebar() const;
void initViewFlags();
signals:
@ -158,6 +158,7 @@ signals:
void isBelowLayerChanged();
void isFloatingGapWindowEnabledChanged();
void isHiddenChanged();
void isSidebarChanged();
void isShownFullyChanged();
void hidingIsBlockedChanged();
void containsMouseChanged();
@ -184,6 +185,8 @@ private slots:
//! KWin Edges Support functions
void updateKWinEdgesSupport();
void updateSidebarState();
private:
void setContainsMouse(bool contains);
@ -233,6 +236,7 @@ private:
bool m_isBelowLayer{false};
bool m_isHidden{false};
bool m_isFloatingGapWindowEnabled{false};
bool m_isSidebar{false};
bool m_isShownFully{false};
bool m_dragEnter{false};
bool m_containsMouse{false};

View File

@ -59,8 +59,9 @@ Item{
property int slidingOutToPos: {
if (root.behaveAsPlasmaPanel) {
var edgeMargin = screenEdgeMarginEnabled ? plasmoid.configuration.screenEdgeMargin : 0
var thickmarg = latteView.visibility.isSidebar ? 0 : 1;
root.isHorizontal ? root.height + edgeMargin - 1 : root.width + edgeMargin - 1;
return root.isHorizontal ? root.height + edgeMargin - thickmarg : root.width + edgeMargin - thickmarg;
} else {
var topOrLeftEdge = ((plasmoid.location===PlasmaCore.Types.LeftEdge)||(plasmoid.location===PlasmaCore.Types.TopEdge));
return (topOrLeftEdge ? -metrics.mask.thickness.normal : metrics.mask.thickness.normal);
@ -377,7 +378,7 @@ Item{
inputGeometry.width = Math.min(inputGeometry.width, latteView.width);
inputGeometry.height = Math.min(inputGeometry.height, latteView.height);
if (latteView.visibility.isSidebar() && latteView.visibility.isHidden) {
if (latteView.visibility.isSidebar && latteView.visibility.isHidden) {
//! this way we make sure than no input is accepted anywhere
inputGeometry = Qt.rect(-1, -1, 1, 1);
}