From eefdc2cedffd7ec1e44b95df7829657db5dafb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 30 Jul 2013 07:45:28 +0200 Subject: [PATCH] Port SizeGrip::embed to use xcb XLib code was throwing compile errors, so just ported it over to xcb directly. --- clients/oxygen/oxygensizegrip.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/clients/oxygen/oxygensizegrip.cpp b/clients/oxygen/oxygensizegrip.cpp index eb29b30692..8de09aba8b 100644 --- a/clients/oxygen/oxygensizegrip.cpp +++ b/clients/oxygen/oxygensizegrip.cpp @@ -87,33 +87,36 @@ namespace Oxygen //_____________________________________________ void SizeGrip::embed( void ) { - - WId window_id = client().windowId(); + xcb_window_t window_id = client().windowId(); if( client().isPreview() ) { setParent( client().widget() ); } else if( window_id ) { - WId current = window_id; + xcb_window_t current = window_id; + auto *c = QX11Info::connection(); while( true ) { - WId root, parent = 0; - WId *children = 0L; - uint child_count = 0; - XQueryTree(QX11Info::display(), current, &root, &parent, &children, &child_count); - if( parent && parent != root && parent != current ) current = parent; - else break; + auto cookie = xcb_query_tree_unchecked(c, current); + QScopedPointer tree(xcb_query_tree_reply(c, cookie, nullptr)); + if (tree.isNull()) { + break; + } + if (tree->parent && tree->parent != tree->root && tree->parent != current) { + current = tree->parent; + } else { + break; + } } // reparent - XReparentWindow( QX11Info::display(), winId(), current, 0, 0 ); + xcb_reparent_window(c, winId(), current, 0, 0); } else { hide(); } - } //_____________________________________________