Add thumbnailAvailable property to PlasmaCore.WindowThumbnail
This property tells us whether a thumbnail is actually being rendered or it has fallen back to the window icon REVIEW: 120946 BUG: 336524
This commit is contained in:
parent
481e796e67
commit
ce1ba8a687
@ -65,6 +65,7 @@ WindowThumbnail::WindowThumbnail(QQuickItem *parent)
|
|||||||
, m_xcb(false)
|
, m_xcb(false)
|
||||||
, m_winId(0)
|
, m_winId(0)
|
||||||
, m_paintedSize(QSizeF())
|
, m_paintedSize(QSizeF())
|
||||||
|
, m_thumbnailAvailable(false)
|
||||||
, m_damaged(false)
|
, m_damaged(false)
|
||||||
, m_depth(0)
|
, m_depth(0)
|
||||||
#if HAVE_XCB_COMPOSITE
|
#if HAVE_XCB_COMPOSITE
|
||||||
@ -151,6 +152,11 @@ qreal WindowThumbnail::paintedHeight() const
|
|||||||
return m_paintedSize.height();
|
return m_paintedSize.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WindowThumbnail::thumbnailAvailable() const
|
||||||
|
{
|
||||||
|
return m_thumbnailAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
QSGNode *WindowThumbnail::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
|
QSGNode *WindowThumbnail::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
|
||||||
{
|
{
|
||||||
Q_UNUSED(updatePaintNodeData)
|
Q_UNUSED(updatePaintNodeData)
|
||||||
@ -350,6 +356,7 @@ void WindowThumbnail::windowToTexture(WindowTextureNode *textureNode)
|
|||||||
if (m_pixmap == XCB_PIXMAP_NONE) {
|
if (m_pixmap == XCB_PIXMAP_NONE) {
|
||||||
// create above failed
|
// create above failed
|
||||||
iconToTexture(textureNode);
|
iconToTexture(textureNode);
|
||||||
|
setThumbnailAvailable(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool fallbackToIcon = true;
|
bool fallbackToIcon = true;
|
||||||
@ -366,6 +373,7 @@ void WindowThumbnail::windowToTexture(WindowTextureNode *textureNode)
|
|||||||
// just for safety to not crash
|
// just for safety to not crash
|
||||||
iconToTexture(textureNode);
|
iconToTexture(textureNode);
|
||||||
}
|
}
|
||||||
|
setThumbnailAvailable(!fallbackToIcon);
|
||||||
textureNode->markDirty(QSGNode::DirtyForceUpdate);
|
textureNode->markDirty(QSGNode::DirtyForceUpdate);
|
||||||
#else
|
#else
|
||||||
iconToTexture(textureNode);
|
iconToTexture(textureNode);
|
||||||
@ -615,4 +623,12 @@ void WindowThumbnail::discardPixmap()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowThumbnail::setThumbnailAvailable(bool thumbnailAvailable)
|
||||||
|
{
|
||||||
|
if (m_thumbnailAvailable != thumbnailAvailable) {
|
||||||
|
m_thumbnailAvailable = thumbnailAvailable;
|
||||||
|
emit thumbnailAvailableChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -78,6 +78,7 @@ class WindowThumbnail : public QQuickItem, public QAbstractNativeEventFilter
|
|||||||
Q_PROPERTY(uint winId READ winId WRITE setWinId NOTIFY winIdChanged)
|
Q_PROPERTY(uint winId READ winId WRITE setWinId NOTIFY winIdChanged)
|
||||||
Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged)
|
Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged)
|
||||||
Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged)
|
Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged)
|
||||||
|
Q_PROPERTY(bool thumbnailAvailable READ thumbnailAvailable NOTIFY thumbnailAvailableChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WindowThumbnail(QQuickItem *parent = 0);
|
WindowThumbnail(QQuickItem *parent = 0);
|
||||||
@ -90,10 +91,12 @@ public:
|
|||||||
|
|
||||||
qreal paintedWidth() const;
|
qreal paintedWidth() const;
|
||||||
qreal paintedHeight() const;
|
qreal paintedHeight() const;
|
||||||
|
bool thumbnailAvailable() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void winIdChanged();
|
void winIdChanged();
|
||||||
void paintedSizeChanged();
|
void paintedSizeChanged();
|
||||||
|
void thumbnailAvailableChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void iconToTexture(WindowTextureNode *textureNode);
|
void iconToTexture(WindowTextureNode *textureNode);
|
||||||
@ -102,9 +105,12 @@ private:
|
|||||||
void stopRedirecting();
|
void stopRedirecting();
|
||||||
void resetDamaged();
|
void resetDamaged();
|
||||||
void discardPixmap();
|
void discardPixmap();
|
||||||
|
void setThumbnailAvailable(bool thumbnailAvailable);
|
||||||
|
|
||||||
bool m_xcb;
|
bool m_xcb;
|
||||||
uint32_t m_winId;
|
uint32_t m_winId;
|
||||||
QSizeF m_paintedSize;
|
QSizeF m_paintedSize;
|
||||||
|
bool m_thumbnailAvailable;
|
||||||
bool m_damaged;
|
bool m_damaged;
|
||||||
int m_depth;
|
int m_depth;
|
||||||
#if HAVE_XCB_COMPOSITE
|
#if HAVE_XCB_COMPOSITE
|
||||||
|
Loading…
Reference in New Issue
Block a user