Made QWidget::setWindowOpacity work with the XCB platform plugin.

Ported the rather trivial implementation from Qt 4.

Task-number: QTBUG-28477
Change-Id: I44e14a3c150af43c6b9b880242b655fe06084fd7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Samuel Rødal 2012-12-12 09:15:14 +01:00 committed by The Qt Project
parent 49ba35b990
commit 0549a4b6f5
2 changed files with 19 additions and 0 deletions

View File

@ -1786,6 +1786,23 @@ static inline xcb_rectangle_t qRectToXCBRectangle(const QRect &r)
return result;
}
void QXcbWindow::setOpacity(qreal level)
{
if (!m_window)
return;
quint32 value = qRound64(qBound(qreal(0), level, qreal(1)) * 0xffffffff);
Q_XCB_CALL(xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
m_window,
atom(QXcbAtom::_NET_WM_WINDOW_OPACITY),
XCB_ATOM_CARDINAL,
32,
1,
(uchar *)&value));
}
void QXcbWindow::setMask(const QRegion &region)
{
if (!connection()->hasXShape())

View File

@ -109,6 +109,8 @@ public:
bool startSystemResize(const QPoint &pos, Qt::Corner corner);
void setOpacity(qreal level);
#if !defined(QT_NO_SHAPE)
void setMask(const QRegion &region);
#endif // !QT_NO_SHAPE