improve real floating views screen edge activation

-- when the user hovers the screen edge there is a chance that
screenedgeghostwindow has become underneath the view. In such
case when the real floating window slides in the screenghostwindow
becomes unhovered faulty and it is destroyed afterwards. It is
much better if the screenedgeghostwindow in such case remains shown
until the mouse is not contained neither in the view or the screen
ghost window
-- expose screen edge ghost window thickness
pull/11/head
Michail Vourlakos 5 years ago
parent e0e6f5f6b3
commit b129a8d880

@ -174,6 +174,11 @@ int ScreenEdgeGhostWindow::location()
return (int)m_latteView->location();
}
int ScreenEdgeGhostWindow::thickness() const
{
return m_thickness;
}
Latte::View *ScreenEdgeGhostWindow::parentView()
{
return m_latteView;
@ -191,10 +196,11 @@ void ScreenEdgeGhostWindow::updateGeometry()
}
QRect newGeometry;
int thickness{2};
if (KWindowSystem::compositingActive()) {
thickness = 6;
m_thickness = 6;
} else {
m_thickness = 2;
}
int length{30};
@ -213,7 +219,7 @@ void ScreenEdgeGhostWindow::updateGeometry()
if (m_latteView->location() == Plasma::Types::BottomEdge) {
int xF = qMax(m_latteView->screenGeometry().left(), m_latteView->absoluteGeometry().left() - lengthDifference);
newGeometry.setX(xF);
newGeometry.setY(m_latteView->screenGeometry().bottom() - thickness);
newGeometry.setY(m_latteView->screenGeometry().bottom() - m_thickness);
} else if (m_latteView->location() == Plasma::Types::TopEdge) {
int xF = qMax(m_latteView->screenGeometry().left(), m_latteView->absoluteGeometry().left() - lengthDifference);
newGeometry.setX(xF);
@ -224,15 +230,15 @@ void ScreenEdgeGhostWindow::updateGeometry()
newGeometry.setY(yF);
} else if (m_latteView->location() == Plasma::Types::RightEdge) {
int yF = qMax(m_latteView->screenGeometry().top(), m_latteView->absoluteGeometry().top() - lengthDifference);
newGeometry.setX(m_latteView->screenGeometry().right() - thickness);
newGeometry.setX(m_latteView->screenGeometry().right() - m_thickness);
newGeometry.setY(yF);
}
if (m_latteView->formFactor() == Plasma::Types::Horizontal) {
newGeometry.setWidth(length);
newGeometry.setHeight(thickness + 1);
newGeometry.setHeight(m_thickness + 1);
} else {
newGeometry.setWidth(thickness + 1);
newGeometry.setWidth(m_thickness + 1);
newGeometry.setHeight(length);
}

@ -71,6 +71,7 @@ public:
bool containsMouse() const;
int location();
int thickness() const;
void hideWithMask();
void showWithMask();
@ -100,6 +101,9 @@ private:
bool m_delayedContainsMouse{false};
bool m_containsMouse{false};
bool m_inDelete{false};
int m_thickness{2};
QRect m_calculatedGeometry;
QTimer m_delayedMouseTimer;

@ -477,13 +477,15 @@ void VisibilityManager::updateGhostWindowState()
if (m_mode == Latte::Types::WindowsCanCover) {
m_wm->setActiveEdge(m_edgeGhostWindow, m_isBelowLayer && !m_containsMouse);
} else {
bool viewIsFloatingAndMouseOnEdge =
bool viewIsFloatingAndContainsMouse =
m_latteView->behaveAsPlasmaPanel()
&& m_latteView->screenEdgeMarginEnabled()
&& m_latteView->screenEdgeMargin()>0
&& m_edgeGhostWindow->containsMouse();
&& (m_edgeGhostWindow->containsMouse() || m_containsMouse);
m_wm->setActiveEdge(m_edgeGhostWindow, (m_isHidden && !m_containsMouse) || viewIsFloatingAndMouseOnEdge);
bool activated = (m_isHidden && !m_containsMouse) || viewIsFloatingAndContainsMouse;
m_wm->setActiveEdge(m_edgeGhostWindow, activated);
}
} else {
m_wm->setActiveEdge(m_edgeGhostWindow, false);

Loading…
Cancel
Save