Commit ea0061cd authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Use explicit item visibility when rendering

Item::isVisible() is true if either the item has been marked hidden or
one of its ancestors.

In some cases, kwin may render invisible windows, for example for window
thumbnails.

This change makes rendering code use explicit visibility status when
rendering to ensure that it's still possible to render invisible windows.
parent 54bbfde2
......@@ -326,6 +326,11 @@ void Item::removeRepaints(Output *output)
m_repaints.remove(output);
}
bool Item::explicitVisible() const
{
return m_explicitVisible;
}
bool Item::isVisible() const
{
return m_effectiveVisible;
......@@ -333,15 +338,15 @@ bool Item::isVisible() const
void Item::setVisible(bool visible)
{
if (m_visible != visible) {
m_visible = visible;
if (m_explicitVisible != visible) {
m_explicitVisible = visible;
updateEffectiveVisibility();
}
}
bool Item::computeEffectiveVisibility() const
{
return m_visible && (!m_parentItem || m_parentItem->isVisible());
return m_explicitVisible && (!m_parentItem || m_parentItem->isVisible());
}
void Item::updateEffectiveVisibility()
......
......@@ -82,6 +82,7 @@ public:
*/
void stackAfter(Item *sibling);
bool explicitVisible() const;
bool isVisible() const;
void setVisible(bool visible);
......@@ -131,7 +132,7 @@ private:
QPoint m_position;
QSize m_size = QSize(0, 0);
int m_z = 0;
bool m_visible = true;
bool m_explicitVisible = true;
bool m_effectiveVisible = true;
QMap<Output *, QRegion> m_repaints;
mutable std::optional<WindowQuadList> m_quads;
......
......@@ -420,7 +420,7 @@ void OpenGLWindow::createRenderNode(Item *item, RenderContext *context)
if (childItem->z() >= 0) {
break;
}
if (childItem->isVisible()) {
if (childItem->explicitVisible()) {
createRenderNode(childItem, context);
}
}
......@@ -475,7 +475,7 @@ void OpenGLWindow::createRenderNode(Item *item, RenderContext *context)
if (childItem->z() < 0) {
continue;
}
if (childItem->isVisible()) {
if (childItem->explicitVisible()) {
createRenderNode(childItem, context);
}
}
......
......@@ -190,7 +190,7 @@ void SceneQPainterWindow::renderItem(QPainter *painter, Item *item) const
if (childItem->z() >= 0) {
break;
}
if (childItem->isVisible()) {
if (childItem->explicitVisible()) {
renderItem(painter, childItem);
}
}
......@@ -206,7 +206,7 @@ void SceneQPainterWindow::renderItem(QPainter *painter, Item *item) const
if (childItem->z() < 0) {
continue;
}
if (childItem->isVisible()) {
if (childItem->explicitVisible()) {
renderItem(painter, childItem);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment