drop WinTracker::availableScreenGeometry calcs

--Views WindowsTracker in using screen geometry only to
identify which windows are in the same view screen has nothing
to do with availablescreengeometry. This is why it is
dropped and replaced by View::screenGeometry() value
pull/23/head
Michail Vourlakos 4 years ago
parent bb713e1092
commit 19defa08cd

@ -102,18 +102,18 @@ void TrackedViewInfo::setIsTouchingBusyVerticalView(bool touching)
m_isTouchingBusyVerticalView = touching; m_isTouchingBusyVerticalView = touching;
} }
QRect TrackedViewInfo::availableScreenGeometry() const QRect TrackedViewInfo::screenGeometry() const
{ {
return m_availableScreenGeometry; return m_screenGeometry;
} }
void TrackedViewInfo::setAvailableScreenGeometry(QRect geometry) void TrackedViewInfo::setScreenGeometry(QRect geometry)
{ {
if (m_availableScreenGeometry == geometry) { if (m_screenGeometry == geometry) {
return; return;
} }
m_availableScreenGeometry = geometry; m_screenGeometry = geometry;
} }
SchemeColors *TrackedViewInfo::touchingWindowScheme() const SchemeColors *TrackedViewInfo::touchingWindowScheme() const
@ -138,7 +138,7 @@ Latte::View *TrackedViewInfo::view() const
bool TrackedViewInfo::isTracking(const WindowInfoWrap &winfo) const bool TrackedViewInfo::isTracking(const WindowInfoWrap &winfo) const
{ {
return TrackedGeneralInfo::isTracking(winfo) return TrackedGeneralInfo::isTracking(winfo)
&& m_availableScreenGeometry.contains(winfo.geometry().center()); && m_screenGeometry.contains(winfo.geometry().center());
} }
} }

@ -51,8 +51,8 @@ public:
bool isTouchingBusyVerticalView() const; bool isTouchingBusyVerticalView() const;
void setIsTouchingBusyVerticalView(bool touching); void setIsTouchingBusyVerticalView(bool touching);
QRect availableScreenGeometry() const; QRect screenGeometry() const;
void setAvailableScreenGeometry(QRect geometry); void setScreenGeometry(QRect geometry);
SchemeColors *touchingWindowScheme() const; SchemeColors *touchingWindowScheme() const;
void setTouchingWindowScheme(SchemeColors *scheme); void setTouchingWindowScheme(SchemeColors *scheme);
@ -68,7 +68,7 @@ private:
bool m_existsWindowTouchingEdge{false}; bool m_existsWindowTouchingEdge{false};
bool m_isTouchingBusyVerticalView{false}; bool m_isTouchingBusyVerticalView{false};
QRect m_availableScreenGeometry; QRect m_screenGeometry;
SchemeColors *m_touchingWindowScheme{nullptr}; SchemeColors *m_touchingWindowScheme{nullptr};

@ -62,8 +62,6 @@ Windows::~Windows()
void Windows::init() void Windows::init()
{ {
connect(m_wm->corona(), &Plasma::Corona::availableScreenRectChanged, this, &Windows::updateAvailableScreenGeometries);
connect(m_wm, &AbstractWindowInterface::windowChanged, this, [&](WindowId wid) { connect(m_wm, &AbstractWindowInterface::windowChanged, this, [&](WindowId wid) {
m_windows[wid] = m_wm->requestInfo(wid); m_windows[wid] = m_wm->requestInfo(wid);
updateAllHints(); updateAllHints();
@ -106,19 +104,8 @@ void Windows::init()
emit activeWindowChanged(wid); emit activeWindowChanged(wid);
}); });
connect(m_wm, &AbstractWindowInterface::currentDesktopChanged, this, [&] { connect(m_wm, &AbstractWindowInterface::currentDesktopChanged, this, &Windows::updateAllHints);
updateAllHints(); connect(m_wm, &AbstractWindowInterface::currentActivityChanged, this, &Windows::updateAllHints);
});
connect(m_wm, &AbstractWindowInterface::currentActivityChanged, this, [&] {
if (m_wm->corona()->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts) {
//! this is needed in MultipleLayouts because there is a chance that multiple
//! layouts are providing different available screen geometries in different Activities
updateAvailableScreenGeometries();
}
updateAllHints();
});
} }
void Windows::initLayoutHints(Latte::Layout::GenericLayout *layout) void Windows::initLayoutHints(Latte::Layout::GenericLayout *layout)
@ -165,7 +152,7 @@ void Windows::addView(Latte::View *view)
m_views[view] = new TrackedViewInfo(this, view); m_views[view] = new TrackedViewInfo(this, view);
updateAvailableScreenGeometries(); updateScreenGeometries();
//! Consider Layouts //! Consider Layouts
addRelevantLayout(view); addRelevantLayout(view);
@ -174,6 +161,8 @@ void Windows::addView(Latte::View *view)
addRelevantLayout(view); addRelevantLayout(view);
}); });
connect(view, &Latte::View::screenGeometryChanged, this, &Windows::updateScreenGeometries);
connect(view, &Latte::View::isTouchingBottomViewAndIsBusyChanged, this, &Windows::updateExtraViewHints); connect(view, &Latte::View::isTouchingBottomViewAndIsBusyChanged, this, &Windows::updateExtraViewHints);
connect(view, &Latte::View::isTouchingTopViewAndIsBusyChanged, this, &Windows::updateExtraViewHints); connect(view, &Latte::View::isTouchingTopViewAndIsBusyChanged, this, &Windows::updateExtraViewHints);
@ -695,7 +684,7 @@ bool Windows::isActive(const WindowInfoWrap &winfo)
bool Windows::isActiveInViewScreen(Latte::View *view, const WindowInfoWrap &winfo) bool Windows::isActiveInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
{ {
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized() return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized()
&& m_views[view]->availableScreenGeometry().contains(winfo.geometry().center())); && m_views[view]->screenGeometry().contains(winfo.geometry().center()));
} }
bool Windows::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &winfo) bool Windows::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
@ -705,7 +694,7 @@ bool Windows::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &w
return (winfo.isValid() && !winfo.isMinimized() return (winfo.isValid() && !winfo.isMinimized()
&& !winfo.isShaded() && !winfo.isShaded()
&& winfo.isMaximized() && winfo.isMaximized()
&& m_views[view]->availableScreenGeometry().contains(winfo.geometry().center())); && m_views[view]->screenGeometry().contains(winfo.geometry().center()));
} }
bool Windows::isTouchingView(Latte::View *view, const WindowSystem::WindowInfoWrap &winfo) bool Windows::isTouchingView(Latte::View *view, const WindowSystem::WindowInfoWrap &winfo)
@ -784,17 +773,13 @@ void Windows::cleanupFaultyWindows()
} }
void Windows::updateAvailableScreenGeometries() void Windows::updateScreenGeometries()
{ {
for (const auto view : m_views.keys()) { for (const auto view : m_views.keys()) {
if (m_views[view]->enabled()) { if (m_views[view]->screenGeometry() != view->screenGeometry()) {
int currentscrid = view->positioner()->currentScreenId(); m_views[view]->setScreenGeometry(view->screenGeometry());
QString activityid = view->layout() ? view->layout()->lastUsedActivity() : QString();
QRect tempAvailableScreenGeometry = m_wm->corona()->availableScreenRectWithCriteria(currentscrid, activityid, m_ignoreModes, {});
if (tempAvailableScreenGeometry != m_views[view]->availableScreenGeometry()) { if (m_views[view]->enabled()) {
m_views[view]->setAvailableScreenGeometry(tempAvailableScreenGeometry);
updateHints(view); updateHints(view);
} }
} }

@ -112,7 +112,7 @@ signals:
void applicationDataChanged(const WindowId &wid); void applicationDataChanged(const WindowId &wid);
private slots: private slots:
void updateAvailableScreenGeometries(); void updateScreenGeometries();
void addRelevantLayout(Latte::View *view); void addRelevantLayout(Latte::View *view);

Loading…
Cancel
Save