mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-08 13:18:09 +03:00
fixes for Sidebars hiding/showing behavior
This commit is contained in:
parent
c02b5ab6b7
commit
16b83772e3
@ -345,11 +345,13 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
case Types::SidebarOnDemand:
|
||||
m_connections[base] = connect(m_latteView, &Latte::View::inEditModeChanged, this, [&]() {
|
||||
if (!m_latteView->inEditMode()) {
|
||||
toggleHiddenState();
|
||||
m_isRequestedShownSidebarOnDemand = false;
|
||||
updateHiddenState();
|
||||
}
|
||||
});
|
||||
|
||||
toggleHiddenState();
|
||||
m_isRequestedShownSidebarOnDemand = false;
|
||||
updateHiddenState();
|
||||
break;
|
||||
|
||||
case Types::SidebarAutoHide:
|
||||
@ -677,10 +679,79 @@ void VisibilityManager::show()
|
||||
}
|
||||
}
|
||||
|
||||
void VisibilityManager::toggleHiddenState()
|
||||
{
|
||||
if (!m_latteView->inEditMode()) {
|
||||
if (isSidebar()) {
|
||||
// if (m_blockHidingEvents.contains(Q_FUNC_INFO)) {
|
||||
// removeBlockHidingEvent(Q_FUNC_INFO);
|
||||
// }
|
||||
|
||||
if (m_mode == Latte::Types::SidebarOnDemand) {
|
||||
m_isRequestedShownSidebarOnDemand = !m_isRequestedShownSidebarOnDemand;
|
||||
updateHiddenState();
|
||||
} else if (m_mode == Latte::Types::SidebarAutoHide) {
|
||||
if (m_isHidden) {
|
||||
emit mustBeShown();
|
||||
startTimerHide(SIDEBARAUTOHIDEMINIMUMSHOW + m_timerHideInterval);
|
||||
} else {
|
||||
emit mustBeHide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* if (!m_isHidden && !m_blockHidingEvents.contains(Q_FUNC_INFO)) {
|
||||
addBlockHidingEvent(Q_FUNC_INFO);
|
||||
} else if (m_isHidden) {
|
||||
removeBlockHidingEvent(Q_FUNC_INFO);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VisibilityManager::updateHiddenState()
|
||||
{
|
||||
if (m_dragEnter)
|
||||
return;
|
||||
|
||||
switch (m_mode) {
|
||||
case Types::AutoHide:
|
||||
case Types::WindowsCanCover:
|
||||
raiseView(m_containsMouse);
|
||||
break;
|
||||
|
||||
case Types::DodgeActive:
|
||||
dodgeActive();
|
||||
break;
|
||||
|
||||
case Types::DodgeMaximized:
|
||||
dodgeMaximized();
|
||||
break;
|
||||
|
||||
case Types::DodgeAllWindows:
|
||||
dodgeAllWindows();
|
||||
break;
|
||||
|
||||
case Types::SidebarOnDemand:
|
||||
raiseView(m_isRequestedShownSidebarOnDemand);
|
||||
break;
|
||||
|
||||
case Types::SidebarAutoHide:
|
||||
raiseView(m_latteView->inEditMode() || (m_containsMouse && !m_isHidden));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void VisibilityManager::raiseView(bool raise)
|
||||
{
|
||||
if (m_mode == Latte::Types::SidebarOnDemand) {
|
||||
if (raise && m_isHidden) {
|
||||
emit mustBeShown();
|
||||
} else if (!raise && !m_isHidden && !m_dragEnter && !hidingIsBlocked()) {
|
||||
emit mustBeHide();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -726,65 +797,6 @@ bool VisibilityManager::isValidMode() const
|
||||
return (m_mode != Types::None && m_mode != Types::NormalWindow);
|
||||
}
|
||||
|
||||
void VisibilityManager::toggleHiddenState()
|
||||
{
|
||||
if (!m_latteView->inEditMode()) {
|
||||
if (isSidebar()) {
|
||||
if (m_blockHidingEvents.contains(Q_FUNC_INFO)) {
|
||||
removeBlockHidingEvent(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
if (m_isHidden) {
|
||||
emit mustBeShown();
|
||||
|
||||
if(m_mode == Latte::Types::SidebarAutoHide) {
|
||||
startTimerHide(SIDEBARAUTOHIDEMINIMUMSHOW + m_timerHideInterval);
|
||||
}
|
||||
} else {
|
||||
emit mustBeHide();
|
||||
}
|
||||
} else {
|
||||
/* if (!m_isHidden && !m_blockHidingEvents.contains(Q_FUNC_INFO)) {
|
||||
addBlockHidingEvent(Q_FUNC_INFO);
|
||||
} else if (m_isHidden) {
|
||||
removeBlockHidingEvent(Q_FUNC_INFO);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VisibilityManager::updateHiddenState()
|
||||
{
|
||||
if (m_dragEnter)
|
||||
return;
|
||||
|
||||
switch (m_mode) {
|
||||
case Types::AutoHide:
|
||||
case Types::WindowsCanCover:
|
||||
raiseView(m_containsMouse);
|
||||
break;
|
||||
|
||||
case Types::DodgeActive:
|
||||
dodgeActive();
|
||||
break;
|
||||
|
||||
case Types::DodgeMaximized:
|
||||
dodgeMaximized();
|
||||
break;
|
||||
|
||||
case Types::DodgeAllWindows:
|
||||
dodgeAllWindows();
|
||||
break;
|
||||
|
||||
case Types::SidebarAutoHide:
|
||||
raiseView(m_latteView->inEditMode() || (m_containsMouse && !m_isHidden));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void VisibilityManager::applyActivitiesToHiddenWindows(const QStringList &activities)
|
||||
{
|
||||
if (m_edgeGhostWindow) {
|
||||
|
@ -233,6 +233,9 @@ private:
|
||||
bool m_raiseOnActivityChange{false};
|
||||
bool m_hideNow{false};
|
||||
|
||||
//! valid on demand sidebar hidden state in order to be checked after slide-ins/outs
|
||||
bool m_isRequestedShownSidebarOnDemand{false};
|
||||
|
||||
int m_frameExtentsHeadThicknessGap{0};
|
||||
int m_timerHideInterval{700};
|
||||
Plasma::Types::Location m_frameExtentsLocation{Plasma::Types::BottomEdge};
|
||||
|
@ -578,7 +578,7 @@ Item{
|
||||
//! Normal Dodge/AutoHide case
|
||||
if (!slidingAnimationAutoHiddenOut.running
|
||||
&& !latteView.visibility.blockHiding
|
||||
&& (!latteView.visibility.containsMouse)) {
|
||||
&& !latteView.visibility.containsMouse) {
|
||||
slidingAnimationAutoHiddenOut.init();
|
||||
}
|
||||
}
|
||||
|
@ -40,10 +40,18 @@ LatteComponents.ComboBoxButton{
|
||||
comboBoxPopupTextHorizontalAlignment: Text.AlignHCenter
|
||||
|
||||
property int mode: LatteCore.Types.WindowsGoBelow
|
||||
readonly property int currentModeIndex: Math.min(Math.max(0, mode-firstVisibilityMode), lastVisibilityMode-firstVisibilityMode)
|
||||
readonly property int currentModeIndex: {
|
||||
for (var i=0; i<modes.length; ++i) {
|
||||
if (modes[i].pluginId === mode) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
readonly property int firstVisibilityMode: modes[0].pluginId
|
||||
readonly property int lastVisibilityMode: firstVisibilityMode + modes.length - 1
|
||||
readonly property int lastVisibilityMode: modes[modes.length - 1].pluginId
|
||||
|
||||
property variant modes: []
|
||||
|
||||
@ -76,8 +84,11 @@ LatteComponents.ComboBoxButton{
|
||||
Connections {
|
||||
target: latteView.visibility
|
||||
onModeChanged: {
|
||||
if (latteView.visibility.mode >= custom.firstVisibilityMode && latteView.visibility.mode<=custom.lastVisibilityMode) {
|
||||
custom.viewRelevantVisibilityModeChanged();
|
||||
for (var i=0; i<custom.modes.length; ++i) {
|
||||
if (custom.modes[i].pluginId === latteView.visibility.mode) {
|
||||
custom.viewRelevantVisibilityModeChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user