desktop/view: use aliveAndVisible for most things (#12631)
This commit is contained in:
parent
2ca7ad7efc
commit
5dd224805d
10 changed files with 35 additions and 28 deletions
|
|
@ -18,7 +18,7 @@ std::vector<SP<IView>> View::getViewsForWorkspace(PHLWORKSPACE ws) {
|
|||
std::vector<SP<IView>> views;
|
||||
|
||||
for (const auto& w : g_pCompositor->m_windows) {
|
||||
if (!w->visible() || w->m_workspace != ws)
|
||||
if (!w->aliveAndVisible() || w->m_workspace != ws)
|
||||
continue;
|
||||
|
||||
views.emplace_back(w);
|
||||
|
|
@ -38,7 +38,7 @@ std::vector<SP<IView>> View::getViewsForWorkspace(PHLWORKSPACE ws) {
|
|||
w->m_popupHead->breadthfirst(
|
||||
[&views](SP<CPopup> s, void* data) {
|
||||
auto surf = s->wlSurface();
|
||||
if (!surf || !s->visible())
|
||||
if (!surf || !s->aliveAndVisible())
|
||||
return;
|
||||
|
||||
views.emplace_back(surf->view());
|
||||
|
|
@ -48,7 +48,7 @@ std::vector<SP<IView>> View::getViewsForWorkspace(PHLWORKSPACE ws) {
|
|||
}
|
||||
|
||||
for (const auto& l : g_pCompositor->m_layers) {
|
||||
if (!l->visible() || l->m_monitor != ws->m_monitor)
|
||||
if (!l->aliveAndVisible() || l->m_monitor != ws->m_monitor)
|
||||
continue;
|
||||
|
||||
views.emplace_back(l);
|
||||
|
|
@ -56,7 +56,7 @@ std::vector<SP<IView>> View::getViewsForWorkspace(PHLWORKSPACE ws) {
|
|||
l->m_popupHead->breadthfirst(
|
||||
[&views](SP<CPopup> p, void* data) {
|
||||
auto surf = p->wlSurface();
|
||||
if (!surf || !p->visible())
|
||||
if (!surf || !p->aliveAndVisible())
|
||||
return;
|
||||
|
||||
views.emplace_back(surf->view());
|
||||
|
|
@ -65,7 +65,7 @@ std::vector<SP<IView>> View::getViewsForWorkspace(PHLWORKSPACE ws) {
|
|||
}
|
||||
|
||||
for (const auto& v : g_pCompositor->m_otherViews) {
|
||||
if (!v->visible() || !v->desktopComponent())
|
||||
if (!v->aliveAndVisible() || !v->desktopComponent())
|
||||
continue;
|
||||
|
||||
if (v->type() == VIEW_TYPE_LOCK_SCREEN) {
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ namespace Desktop::View {
|
|||
inline bool validMapped(PHLLS l) {
|
||||
if (!valid(l))
|
||||
return false;
|
||||
return l->visible();
|
||||
return l->aliveAndVisible();
|
||||
}
|
||||
|
||||
inline bool validMapped(PHLLSREF l) {
|
||||
if (!valid(l))
|
||||
return false;
|
||||
return l->visible();
|
||||
return l->aliveAndVisible();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "View.hpp"
|
||||
#include "../../protocols/core/Compositor.hpp"
|
||||
|
||||
using namespace Desktop;
|
||||
using namespace Desktop::View;
|
||||
|
|
@ -14,3 +15,14 @@ IView::IView(SP<Desktop::View::CWLSurface> pWlSurface) : m_wlSurface(pWlSurface)
|
|||
SP<CWLSurfaceResource> IView::resource() const {
|
||||
return m_wlSurface ? m_wlSurface->resource() : nullptr;
|
||||
}
|
||||
|
||||
bool IView::aliveAndVisible() const {
|
||||
auto res = resource();
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
if (!res->m_mapped)
|
||||
return false;
|
||||
|
||||
return visible();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace Desktop::View {
|
|||
|
||||
virtual SP<Desktop::View::CWLSurface> wlSurface() const;
|
||||
virtual SP<CWLSurfaceResource> resource() const;
|
||||
virtual bool aliveAndVisible() const;
|
||||
virtual eViewType type() const = 0;
|
||||
virtual bool visible() const = 0;
|
||||
virtual bool desktopComponent() const = 0;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ SP<CWLSurfaceResource> CWLSurface::resource() const {
|
|||
}
|
||||
|
||||
bool CWLSurface::small() const {
|
||||
if (!m_view || !m_view->visible() || m_view->type() != VIEW_TYPE_WINDOW || !exists())
|
||||
if (!m_view || !m_view->aliveAndVisible() || m_view->type() != VIEW_TYPE_WINDOW || !exists())
|
||||
return false;
|
||||
|
||||
if (!m_resource->m_current.texture)
|
||||
|
|
@ -51,7 +51,7 @@ bool CWLSurface::small() const {
|
|||
}
|
||||
|
||||
Vector2D CWLSurface::correctSmallVec() const {
|
||||
if (!m_view || !m_view->visible() || m_view->type() != VIEW_TYPE_WINDOW || !exists() || !small() || !m_fillIgnoreSmall)
|
||||
if (!m_view || !m_view->aliveAndVisible() || m_view->type() != VIEW_TYPE_WINDOW || !exists() || !small() || !m_fillIgnoreSmall)
|
||||
return {};
|
||||
|
||||
const auto SIZE = getViewporterCorrectedSize();
|
||||
|
|
@ -171,12 +171,6 @@ SP<CPointerConstraint> CWLSurface::constraint() const {
|
|||
return m_constraint.lock();
|
||||
}
|
||||
|
||||
bool CWLSurface::visible() {
|
||||
if (m_view)
|
||||
return m_view->visible();
|
||||
return true; // non-desktop, we don't know much.
|
||||
}
|
||||
|
||||
SP<Desktop::View::CWLSurface> CWLSurface::fromResource(SP<CWLSurfaceResource> pSurface) {
|
||||
if (!pSurface)
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ namespace Desktop::View {
|
|||
Vector2D correctSmallVecBuf() const; // returns a corrective vector for small() surfaces, in BL coords
|
||||
Vector2D getViewporterCorrectedSize() const;
|
||||
CRegion computeDamage() const; // logical coordinates. May be wrong if the surface is unassigned
|
||||
bool visible();
|
||||
bool keyboardFocusable() const;
|
||||
|
||||
SP<IView> view() const;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ eViewType CWindow::type() const {
|
|||
}
|
||||
|
||||
bool CWindow::visible() const {
|
||||
return m_isMapped && !m_hidden && m_wlSurface && m_wlSurface->resource();
|
||||
return !m_hidden && ((m_isMapped && m_wlSurface && m_wlSurface->resource()) || (m_fadingOut && m_alpha->value() != 0.F));
|
||||
}
|
||||
|
||||
std::optional<CBox> CWindow::logicalBox() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue