xcb: Reflect geometry of foreign window on creation
Change-Id: I305b256696a32454f64c12c5a8901b65506fc520 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 4e2e3a6b4fe0ff5e1930707808f02e3be9343312) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f6720887e6
commit
18678e3fc7
@ -472,6 +472,18 @@ QXcbWindow::~QXcbWindow()
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QXcbForeignWindow::QXcbForeignWindow(QWindow *window, WId nativeHandle)
|
||||||
|
: QXcbWindow(window)
|
||||||
|
{
|
||||||
|
m_window = nativeHandle;
|
||||||
|
|
||||||
|
// Reflect the foreign window's geometry as our own
|
||||||
|
if (auto geometry = Q_XCB_REPLY(xcb_get_geometry, xcb_connection(), m_window)) {
|
||||||
|
QRect nativeGeometry(geometry->x, geometry->y, geometry->width, geometry->height);
|
||||||
|
QPlatformWindow::setGeometry(nativeGeometry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QXcbForeignWindow::~QXcbForeignWindow()
|
QXcbForeignWindow::~QXcbForeignWindow()
|
||||||
{
|
{
|
||||||
// Clear window so that destroy() does not affect it
|
// Clear window so that destroy() does not affect it
|
||||||
|
@ -258,8 +258,7 @@ protected:
|
|||||||
class QXcbForeignWindow : public QXcbWindow
|
class QXcbForeignWindow : public QXcbWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QXcbForeignWindow(QWindow *window, WId nativeHandle)
|
QXcbForeignWindow(QWindow *window, WId nativeHandle);
|
||||||
: QXcbWindow(window) { m_window = nativeHandle; }
|
|
||||||
~QXcbForeignWindow();
|
~QXcbForeignWindow();
|
||||||
bool isForeignWindow() const override { return true; }
|
bool isForeignWindow() const override { return true; }
|
||||||
|
|
||||||
|
@ -67,8 +67,6 @@ void tst_ForeignWindow::initialState()
|
|||||||
|
|
||||||
// For extra bonus points, the foreign window should actually
|
// For extra bonus points, the foreign window should actually
|
||||||
// reflect the state of the native window.
|
// reflect the state of the native window.
|
||||||
if (!QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive))
|
|
||||||
QEXPECT_FAIL("", "QXcbWindow does not pick up foreign window geometry", Continue);
|
|
||||||
QCOMPARE(foreignWindow->geometry(), initialGeometry);
|
QCOMPARE(foreignWindow->geometry(), initialGeometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user