1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-10 21:18:19 +03:00

solution for Unity style layouts top view shadow

--when a vertical view that acts as a unity-style one
is activated, it sends a signal to top view to update
their visibility in order to stay on top
This commit is contained in:
Michail Vourlakos 2020-05-09 12:26:33 +03:00
parent 5113674f18
commit 1e144fc3e7
4 changed files with 39 additions and 13 deletions

View File

@ -177,6 +177,7 @@ signals:
void raiseViewsTemporaryChanged();
void availableScreenRectChangedFrom(Latte::View *origin);
void availableScreenRegionChangedFrom(Latte::View *origin);
void verticalUnityViewHasFocus();
private slots:
void alternativesVisibilityChanged(bool visible);

View File

@ -526,19 +526,6 @@ QRect Positioner::maximumNormalGeometry()
break;
}
//! this is needed in order to preserve that the top dock will be above
//! the others in case flag bypasswindowmanagerhint hasn't be set,
//! such a case is the AlwaysVisible mode
//! NO IDEA what this is trying to solve... It must be updated and checked
//! if this IS STILL NEEDED
if (m_view->location() == Plasma::Types::TopEdge
&& m_view->visibility()->mode() != Latte::Types::WindowsCanCover
&& m_view->visibility()->mode() != Latte::Types::WindowsAlwaysCover) {
KWindowSystem::setState(m_view->winId(), NET::KeepAbove);
} else {
// KWindowSystem::clearState(m_view->winId(), NET::KeepAbove);
}
return maxGeometry;
}

View File

@ -248,6 +248,7 @@ void View::init(Plasma::Containment *plasma_containment)
connect(this, &View::availableScreenRectChangedFrom, m_corona, &Latte::Corona::availableScreenRectChangedFrom);
connect(this, &View::availableScreenRegionChangedFrom, m_corona, &Latte::Corona::availableScreenRegionChangedFrom);
connect(m_corona, &Latte::Corona::availableScreenRectChangedFrom, this, &View::availableScreenRectChangedFromSlot);
connect(m_corona, &Latte::Corona::verticalUnityViewHasFocus, this, &View::topViewAlwaysOnTop);
connect(this, &View::byPassWMChanged, this, &View::saveConfig);
connect(this, &View::isPreferredForShortcutsChanged, this, &View::saveConfig);
@ -269,6 +270,8 @@ void View::init(Plasma::Containment *plasma_containment)
connect(m_contextMenu, &ViewPart::ContextMenu::menuChanged, this, &View::contextMenuIsShownChanged);
connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::verticalUnityViewHasFocus);
//! View sends this signal in order to avoid crashes from ViewPart::Indicator when the view is recreated
connect(m_corona->indicatorFactory(), &Latte::Indicator::Factory::indicatorChanged, this, [&](const QString &indicatorId) {
emit indicatorPluginChanged(indicatorId);
@ -330,6 +333,7 @@ void View::disconnectSensitiveSignals()
disconnect(this, &View::availableScreenRectChangedFrom, m_corona, &Latte::Corona::availableScreenRectChangedFrom);
disconnect(this, &View::availableScreenRegionChangedFrom, m_corona, &Latte::Corona::availableScreenRegionChangedFrom);
disconnect(m_corona, &Latte::Corona::availableScreenRectChangedFrom, this, &View::availableScreenRectChangedFromSlot);
disconnect(m_corona, &Latte::Corona::verticalUnityViewHasFocus, this, &View::topViewAlwaysOnTop);
setLayout(nullptr);
}
@ -1472,6 +1476,34 @@ bool View::isHighestPriorityView() {
return false;
}
//! BEGIN: WORKAROUND order to force top panels always on top and above left/right panels
void View::topViewAlwaysOnTop()
{
if (!m_visibility) {
return;
}
if (location() == Plasma::Types::TopEdge
&& m_visibility->mode() != Latte::Types::WindowsCanCover
&& m_visibility->mode() != Latte::Types::WindowsAlwaysCover) {
//! this is needed in order to preserve that the top dock will be above others.
//! Unity layout paradigm is a good example for this. The top panel shadow
//! should be always on top compared to left panel
m_visibility->setViewOnFrontLayer();
}
}
void View::verticalUnityViewHasFocus()
{
if (formFactor() == Plasma::Types::Vertical
&& (y() != screenGeometry().y())
&& ( (m_alignment == Latte::Types::Justify && m_maxLength == 1.0)
||(m_alignment == Latte::Types::Top && m_offset == 0.0) )) {
emit m_corona->verticalUnityViewHasFocus();
}
}
//! END: WORKAROUND
//!BEGIN overriding context menus behavior
void View::mousePressEvent(QMouseEvent *event)
{
@ -1481,6 +1513,8 @@ void View::mousePressEvent(QMouseEvent *event)
PlasmaQuick::ContainmentView::mousePressEvent(event);
updateTransientWindowsTracking();
}
verticalUnityViewHasFocus();
}
//!END overriding context menus behavior

View File

@ -338,6 +338,10 @@ private slots:
void addTransientWindow(QWindow *window);
void removeTransientWindow(const bool &visible);
//! workaround in order for top panels to be always on top
void topViewAlwaysOnTop();
void verticalUnityViewHasFocus();
void restoreConfig();
void saveConfig();