Ensure that the WindowThumbnail is not trying to render a thumbnail of itself
Recursive window thumbnails would look awesome on the screen, but reality is that X/OpenGL or $DEITY doesn't like it at all and decided to just freeze the view. So let's delay all the redirecting till the WindowThumbnail has been added to its QQuickWindow and if the window id is the one of the own window we just render the icon instead.
This commit is contained in:
parent
452d39a98e
commit
52e96b41df
@ -71,6 +71,14 @@ WindowThumbnail::WindowThumbnail(QQuickItem* parent)
|
||||
#endif
|
||||
{
|
||||
setFlag(ItemHasContents);
|
||||
connect(this, &QQuickItem::windowChanged, [this](QQuickWindow *window) {
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
// restart the redirection, it might not have been active yet
|
||||
stopRedirecting();
|
||||
startRedirecting();
|
||||
});
|
||||
if (QGuiApplication *gui = dynamic_cast<QGuiApplication*>(QCoreApplication::instance())) {
|
||||
m_xcb = (gui->platformName() == QStringLiteral("xcb"));
|
||||
if (m_xcb) {
|
||||
@ -111,6 +119,10 @@ void WindowThumbnail::setWinId(uint32_t winId)
|
||||
// invalid Id, don't updated
|
||||
return;
|
||||
}
|
||||
if (window() && winId == window()->winId()) {
|
||||
// don't redirect to yourself
|
||||
return;
|
||||
}
|
||||
stopRedirecting();
|
||||
m_winId = winId;
|
||||
startRedirecting();
|
||||
@ -125,7 +137,7 @@ QSGNode *WindowThumbnail::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
|
||||
node = new WindowTextureNode();
|
||||
node->setFiltering(QSGTexture::Linear);
|
||||
}
|
||||
if (!m_xcb || m_winId == 0) {
|
||||
if (!m_xcb || m_winId == 0 || (window() && window()->winId() == m_winId)) {
|
||||
iconToTexture(node);
|
||||
} else {
|
||||
windowToTexture(node);
|
||||
@ -347,7 +359,7 @@ void WindowThumbnail::stopRedirecting()
|
||||
|
||||
void WindowThumbnail::startRedirecting()
|
||||
{
|
||||
if (!m_xcb) {
|
||||
if (!m_xcb || !window() || window()->winId() == m_winId) {
|
||||
return;
|
||||
}
|
||||
#if HAVE_XCB_COMPOSITE
|
||||
|
Loading…
Reference in New Issue
Block a user