mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
support containsMouse behavior for WindowsCanCover
This commit is contained in:
parent
a0f9758350
commit
4cf929ea81
@ -88,13 +88,13 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
|
||||
m_timerHide.setSingleShot(true);
|
||||
|
||||
connect(&m_timerShow, &QTimer::timeout, this, [&]() {
|
||||
if (m_isHidden) {
|
||||
if (m_isHidden || m_isBelowLayer) {
|
||||
// qDebug() << "must be shown";
|
||||
emit mustBeShown();
|
||||
}
|
||||
});
|
||||
connect(&m_timerHide, &QTimer::timeout, this, [&]() {
|
||||
if (!m_blockHiding && !m_isHidden && !m_dragEnter) {
|
||||
if (!m_blockHiding && !m_isHidden && !m_isBelowLayer && !m_dragEnter) {
|
||||
// qDebug() << "must be hide";
|
||||
emit mustBeHide();
|
||||
}
|
||||
@ -120,19 +120,23 @@ Types::Visibility VisibilityManager::mode() const
|
||||
|
||||
void VisibilityManager::initViewFlags()
|
||||
{
|
||||
if (KWindowSystem::isPlatformX11()) {
|
||||
if ((m_mode == Types::WindowsCanCover || m_mode == Types::WindowsAlwaysCover) && (!m_latteView->inEditMode())) {
|
||||
m_wm->setViewExtraFlags(m_latteView, false, m_mode);
|
||||
setViewOnBackLayer();
|
||||
} else {
|
||||
setViewOnFrontLayer();
|
||||
}
|
||||
}
|
||||
|
||||
void VisibilityManager::setViewOnBackLayer()
|
||||
{
|
||||
m_wm->setViewExtraFlags(m_latteView, false, Types::WindowsAlwaysCover);
|
||||
setIsBelowLayer(true);
|
||||
}
|
||||
|
||||
void VisibilityManager::setViewOnFrontLayer()
|
||||
{
|
||||
m_wm->setViewExtraFlags(m_latteView, true);
|
||||
}
|
||||
} else {
|
||||
if ((m_mode == Types::WindowsCanCover || m_mode == Types::WindowsAlwaysCover) && (!m_latteView->inEditMode())) {
|
||||
m_wm->setViewExtraFlags(m_latteView, false, m_mode);
|
||||
} else {
|
||||
m_wm->setViewExtraFlags(m_latteView, true);
|
||||
}
|
||||
}
|
||||
setIsBelowLayer(false);
|
||||
}
|
||||
|
||||
void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
@ -249,6 +253,11 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
break;
|
||||
|
||||
case Types::WindowsCanCover:
|
||||
m_connections[base] = connect(this, &VisibilityManager::containsMouseChanged, this, [&]() {
|
||||
raiseView(m_containsMouse);
|
||||
});
|
||||
|
||||
raiseView(m_containsMouse);
|
||||
break;
|
||||
|
||||
case Types::WindowsAlwaysCover:
|
||||
@ -350,6 +359,26 @@ void VisibilityManager::setRaiseOnActivity(bool enable)
|
||||
emit raiseOnActivityChanged();
|
||||
}
|
||||
|
||||
bool VisibilityManager::isBelowLayer() const
|
||||
{
|
||||
return m_isBelowLayer;
|
||||
}
|
||||
|
||||
void VisibilityManager::setIsBelowLayer(bool below)
|
||||
{
|
||||
if (m_isBelowLayer == below) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_isBelowLayer = below;
|
||||
|
||||
if (m_mode == Latte::Types::WindowsCanCover) {
|
||||
updateGhostWindowState();
|
||||
}
|
||||
|
||||
emit isBelowLayerChanged();
|
||||
}
|
||||
|
||||
bool VisibilityManager::isHidden() const
|
||||
{
|
||||
return m_isHidden;
|
||||
@ -445,7 +474,11 @@ void VisibilityManager::updateGhostWindowState()
|
||||
&& m_latteView->layout()->isCurrent()));
|
||||
|
||||
if (inCurrentLayout) {
|
||||
if (m_mode == Latte::Types::WindowsCanCover) {
|
||||
m_wm->setEdgeStateFor(m_edgeGhostWindow, m_isBelowLayer);
|
||||
} else {
|
||||
m_wm->setEdgeStateFor(m_edgeGhostWindow, m_isHidden);
|
||||
}
|
||||
} else {
|
||||
m_wm->setEdgeStateFor(m_edgeGhostWindow, false);
|
||||
}
|
||||
@ -516,6 +549,7 @@ void VisibilityManager::updateHiddenState()
|
||||
|
||||
switch (m_mode) {
|
||||
case Types::AutoHide:
|
||||
case Types::WindowsCanCover:
|
||||
raiseView(m_containsMouse);
|
||||
break;
|
||||
|
||||
@ -724,15 +758,15 @@ void VisibilityManager::updateKWinEdgesSupport()
|
||||
if ((m_mode == Types::AutoHide
|
||||
|| m_mode == Types::DodgeActive
|
||||
|| m_mode == Types::DodgeAllWindows
|
||||
|| m_mode == Types::DodgeMaximized)
|
||||
|| m_mode == Types::DodgeMaximized
|
||||
|| m_mode == Types::WindowsCanCover)
|
||||
&& (!m_latteView->byPassWM()) ) {
|
||||
if (m_enableKWinEdgesFromUser) {
|
||||
createEdgeGhostWindow();
|
||||
} else if (!m_enableKWinEdgesFromUser) {
|
||||
deleteEdgeGhostWindow();
|
||||
}
|
||||
} else if (m_mode == Types::AlwaysVisible
|
||||
|| m_mode == Types::WindowsGoBelow) {
|
||||
} else {
|
||||
deleteEdgeGhostWindow();
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ class VisibilityManager : public QObject
|
||||
Q_PROPERTY(bool raiseOnDesktop READ raiseOnDesktop WRITE setRaiseOnDesktop NOTIFY raiseOnDesktopChanged)
|
||||
Q_PROPERTY(bool raiseOnActivity READ raiseOnActivity WRITE setRaiseOnActivity NOTIFY raiseOnActivityChanged)
|
||||
Q_PROPERTY(bool isHidden READ isHidden WRITE setIsHidden NOTIFY isHiddenChanged)
|
||||
Q_PROPERTY(bool isBelowLayer READ isBelowLayer NOTIFY isBelowLayerChanged)
|
||||
Q_PROPERTY(bool blockHiding READ blockHiding WRITE setBlockHiding NOTIFY blockHidingChanged)
|
||||
Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged)
|
||||
|
||||
@ -81,6 +82,8 @@ public:
|
||||
bool raiseOnActivity() const;
|
||||
void setRaiseOnActivity(bool enable);
|
||||
|
||||
bool isBelowLayer() const;
|
||||
|
||||
bool isHidden() const;
|
||||
void setIsHidden(bool isHidden);
|
||||
|
||||
@ -105,6 +108,9 @@ public slots:
|
||||
Q_INVOKABLE void hide();
|
||||
Q_INVOKABLE void show();
|
||||
|
||||
Q_INVOKABLE void setViewOnBackLayer();
|
||||
Q_INVOKABLE void setViewOnFrontLayer();
|
||||
|
||||
void initViewFlags();
|
||||
|
||||
signals:
|
||||
@ -117,6 +123,7 @@ signals:
|
||||
void modeChanged();
|
||||
void raiseOnDesktopChanged();
|
||||
void raiseOnActivityChanged();
|
||||
void isBelowLayerChanged();
|
||||
void isHiddenChanged();
|
||||
void blockHidingChanged();
|
||||
void containsMouseChanged();
|
||||
@ -131,6 +138,8 @@ private slots:
|
||||
void saveConfig();
|
||||
void restoreConfig();
|
||||
|
||||
void setIsBelowLayer(bool below);
|
||||
|
||||
//! KWin Edges Support functions
|
||||
void updateKWinEdgesSupport();
|
||||
|
||||
@ -165,6 +174,7 @@ private:
|
||||
QTimer m_timerHide;
|
||||
QTimer m_timerStartUp;
|
||||
|
||||
bool m_isBelowLayer{false};
|
||||
bool m_isHidden{false};
|
||||
bool m_dragEnter{false};
|
||||
bool m_blockHiding{false};
|
||||
|
@ -340,19 +340,30 @@ Item{
|
||||
}
|
||||
|
||||
function slotMustBeShown() {
|
||||
// console.log("show...");
|
||||
//! WindowsCanCover case
|
||||
if (latteView && latteView.visibility.mode === Latte.Types.WindowsCanCover) {
|
||||
latteView.visibility.setViewOnFrontLayer();
|
||||
return;
|
||||
}
|
||||
|
||||
//! Normal Dodge/AutoHide case
|
||||
if (!slidingAnimationAutoHiddenIn.running && !inTempHiding && !inForceHiding){
|
||||
slidingAnimationAutoHiddenIn.init();
|
||||
}
|
||||
}
|
||||
|
||||
function slotMustBeHide() {
|
||||
if (latteView && latteView.visibility.mode === Latte.Types.WindowsCanCover) {
|
||||
latteView.visibility.setViewOnBackLayer();
|
||||
return;
|
||||
}
|
||||
|
||||
//! prevent sliding-in on startup if the dodge modes have sent a hide signal
|
||||
if (inStartupTimer.running && root.inStartup) {
|
||||
root.inStartup = false;
|
||||
}
|
||||
|
||||
// console.log("hide....");
|
||||
//! Normal Dodge/AutoHide case
|
||||
if((!slidingAnimationAutoHiddenOut.running && !latteView.visibility.blockHiding
|
||||
&& !latteView.visibility.containsMouse) || inForceHiding) {
|
||||
slidingAnimationAutoHiddenOut.init();
|
||||
|
@ -482,7 +482,6 @@ PlasmaComponents.Page {
|
||||
|
||||
enabled: !(latteView.visibility.mode === Latte.Types.AlwaysVisible
|
||||
|| latteView.visibility.mode === Latte.Types.WindowsGoBelow
|
||||
|| latteView.visibility.mode === Latte.Types.WindowsCanCover
|
||||
|| latteView.visibility.mode === Latte.Types.WindowsAlwaysCover)
|
||||
|
||||
LatteComponents.Header {
|
||||
|
Loading…
Reference in New Issue
Block a user