1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 09:33:51 +03:00

position vertical docks/panels more accurately

--send more availableRect/Region changed signals
for more cases and as such all views update
their positioning properly.
--for example when a horizontal view updates its
offset or max length independent of its visibility mode
the neighbour vertical views need to update
and validate their position.
This commit is contained in:
Michail Vourlakos 2021-12-11 19:29:01 +02:00
parent dd5e0778a7
commit e04900ecf2

View File

@ -291,6 +291,24 @@ void View::init(Plasma::Containment *plasma_containment)
connect(this, &View::activitiesChanged, this, &View::applyActivitiesToWindows);
connect(m_positioner, &ViewPart::Positioner::winIdChanged, this, &View::applyActivitiesToWindows);
connect(this, &View::maxLengthChanged, this, [&]() {
if (m_inDelete) {
return;
}
emit availableScreenRectChangedFrom(this);
emit availableScreenRegionChangedFrom(this);
});
connect(this, &View::offsetChanged, this, [&]() {
if (m_inDelete ) {
return;
}
emit availableScreenRectChangedFrom(this);
emit availableScreenRegionChangedFrom(this);
});
connect(this, &View::localGeometryChanged, this, [&]() {
updateAbsoluteGeometry();
});
@ -407,6 +425,9 @@ void View::availableScreenRectChangedFromSlot(View *origin)
}
if (formFactor() == Plasma::Types::Vertical
&& origin->formFactor() == Plasma::Types::Horizontal //! accept only horizontal views
&& !(origin->location() == Plasma::Types::TopEdge && m_positioner->isStickedOnTopEdge()) //! ignore signals in such case
&& !(origin->location() == Plasma::Types::BottomEdge && m_positioner->isStickedOnBottomEdge()) //! ignore signals in such case
&& origin->layout()
&& m_layout
&& origin->layout()->lastUsedActivity() == m_layout->lastUsedActivity()) {
@ -660,8 +681,8 @@ void View::updateAbsoluteGeometry(bool bypassChecks)
emit absoluteGeometryChanged(m_absoluteGeometry);
}
//! this is needed in order to update correctly the screenGeometries
if (visibility() && corona() && visibility()->mode() == Types::AlwaysVisible) {
if ((m_absoluteGeometry != absGeometry) || bypassChecks) {
//! inform others such as neighbour vertical views that new geometries are applied
//! main use of BYPASSCKECKS is from Positioner when the view changes screens
emit availableScreenRectChangedFrom(this);
emit availableScreenRegionChangedFrom(this);