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