Port SizeGrip::embed to use xcb

XLib code was throwing compile errors, so just ported it over to xcb
directly.
This commit is contained in:
Martin Gräßlin 2013-07-30 07:45:28 +02:00
parent 2c7e3edcaa
commit eefdc2cedf

View file

@ -87,33 +87,36 @@ namespace Oxygen
//_____________________________________________ //_____________________________________________
void SizeGrip::embed( void ) void SizeGrip::embed( void )
{ {
xcb_window_t window_id = client().windowId();
WId window_id = client().windowId();
if( client().isPreview() ) { if( client().isPreview() ) {
setParent( client().widget() ); setParent( client().widget() );
} else if( window_id ) { } else if( window_id ) {
WId current = window_id; xcb_window_t current = window_id;
auto *c = QX11Info::connection();
while( true ) while( true )
{ {
WId root, parent = 0; auto cookie = xcb_query_tree_unchecked(c, current);
WId *children = 0L; QScopedPointer<xcb_query_tree_reply_t, QScopedPointerPodDeleter> tree(xcb_query_tree_reply(c, cookie, nullptr));
uint child_count = 0; if (tree.isNull()) {
XQueryTree(QX11Info::display(), current, &root, &parent, &children, &child_count); break;
if( parent && parent != root && parent != current ) current = parent; }
else break; if (tree->parent && tree->parent != tree->root && tree->parent != current) {
current = tree->parent;
} else {
break;
}
} }
// reparent // reparent
XReparentWindow( QX11Info::display(), winId(), current, 0, 0 ); xcb_reparent_window(c, winId(), current, 0, 0);
} else { } else {
hide(); hide();
} }
} }
//_____________________________________________ //_____________________________________________