diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp index 3f4528ea..fbf8035f 100644 --- a/kstyle/breezehelper.cpp +++ b/kstyle/breezehelper.cpp @@ -1263,8 +1263,8 @@ namespace Breeze if( isX11() ) { // direct call to X - xcb_get_selection_owner_cookie_t cookie( xcb_get_selection_owner( QX11Info::connection(), _compositingManagerAtom ) ); - ScopedPointer reply( xcb_get_selection_owner_reply( QX11Info::connection(), cookie, nullptr ) ); + xcb_get_selection_owner_cookie_t cookie( xcb_get_selection_owner( Helper::connection(), _compositingManagerAtom ) ); + ScopedPointer reply( xcb_get_selection_owner_reply( Helper::connection(), cookie, nullptr ) ); return reply && reply->owner; } @@ -1281,14 +1281,17 @@ namespace Breeze #if HAVE_X11 + //____________________________________________________________________ + xcb_connection_t* Helper::connection( void ) + { return QX11Info::connection(); } + //____________________________________________________________________ xcb_atom_t Helper::createAtom( const QString& name ) const { - if( isX11() ) { - xcb_connection_t* connection( QX11Info::connection() ); + xcb_connection_t* connection( Helper::connection() ); xcb_intern_atom_cookie_t cookie( xcb_intern_atom( connection, false, name.size(), qPrintable( name ) ) ); ScopedPointer reply( xcb_intern_atom_reply( connection, cookie, nullptr) ); return reply ? reply->atom:0; diff --git a/kstyle/breezehelper.h b/kstyle/breezehelper.h index f272d3b5..138bde3d 100644 --- a/kstyle/breezehelper.h +++ b/kstyle/breezehelper.h @@ -217,6 +217,9 @@ namespace Breeze #if HAVE_X11 + //! get xcb connection + static xcb_connection_t* connection( void ); + //! create xcb atom xcb_atom_t createAtom( const QString& ) const; diff --git a/kstyle/breezeshadowhelper.cpp b/kstyle/breezeshadowhelper.cpp index ad8002dd..8a7f59e1 100644 --- a/kstyle/breezeshadowhelper.cpp +++ b/kstyle/breezeshadowhelper.cpp @@ -122,7 +122,7 @@ namespace Breeze #if HAVE_X11 if( _helper.isX11() ) - { foreach( const uint32_t& value, _pixmaps ) xcb_free_pixmap( QX11Info::connection(), value ); } + { foreach( const uint32_t& value, _pixmaps ) xcb_free_pixmap( Helper::connection(), value ); } #endif } @@ -132,7 +132,7 @@ namespace Breeze { #if HAVE_X11 if( _helper.isX11() ) - { foreach( const uint32_t& value, _pixmaps ) xcb_free_pixmap( QX11Info::connection(), value ); } + { foreach( const uint32_t& value, _pixmaps ) xcb_free_pixmap( Helper::connection(), value ); } #endif _pixmaps.clear(); @@ -304,7 +304,7 @@ namespace Breeze if( !netSupportedAtom ) return false; // store connection locally - xcb_connection_t* connection( QX11Info::connection() ); + xcb_connection_t* connection( Helper::connection() ); // get property const uint32_t maxLength = std::string().max_size(); @@ -438,19 +438,19 @@ namespace Breeze const int height( source.height() ); // create X11 pixmap - xcb_pixmap_t pixmap = xcb_generate_id( QX11Info::connection() ); - xcb_create_pixmap( QX11Info::connection(), 32, pixmap, QX11Info::appRootWindow(), width, height ); + xcb_pixmap_t pixmap = xcb_generate_id( Helper::connection() ); + xcb_create_pixmap( Helper::connection(), 32, pixmap, QX11Info::appRootWindow(), width, height ); // create gc if( !_gc ) { - _gc = xcb_generate_id( QX11Info::connection() ); - xcb_create_gc( QX11Info::connection(), _gc, pixmap, 0, 0x0 ); + _gc = xcb_generate_id( Helper::connection() ); + xcb_create_gc( Helper::connection(), _gc, pixmap, 0, 0x0 ); } // create image from QPixmap and assign to pixmap QImage image( source.toImage() ); - xcb_put_image( QX11Info::connection(), XCB_IMAGE_FORMAT_Z_PIXMAP, pixmap, _gc, image.width(), image.height(), 0, 0, 0, 32, image.byteCount(), image.constBits()); + xcb_put_image( Helper::connection(), XCB_IMAGE_FORMAT_Z_PIXMAP, pixmap, _gc, image.width(), image.height(), 0, 0, 0, 32, image.byteCount(), image.constBits()); return pixmap; @@ -532,8 +532,8 @@ namespace Breeze } - xcb_change_property( QX11Info::connection(), XCB_PROP_MODE_REPLACE, widget->winId(), _atom, XCB_ATOM_CARDINAL, 32, data.size(), data.constData() ); - xcb_flush( QX11Info::connection() ); + xcb_change_property( Helper::connection(), XCB_PROP_MODE_REPLACE, widget->winId(), _atom, XCB_ATOM_CARDINAL, 32, data.size(), data.constData() ); + xcb_flush( Helper::connection() ); return true; @@ -552,7 +552,7 @@ namespace Breeze if( !_supported ) return; if( !_helper.isX11() ) return; if( !( widget && widget->testAttribute(Qt::WA_WState_Created) ) ) return; - xcb_delete_property( QX11Info::connection(), widget->winId(), _atom); + xcb_delete_property( Helper::connection(), widget->winId(), _atom); #else Q_UNUSED( widget ) #endif diff --git a/kstyle/breezewindowmanager.cpp b/kstyle/breezewindowmanager.cpp index 1ecadbb3..68cca91d 100644 --- a/kstyle/breezewindowmanager.cpp +++ b/kstyle/breezewindowmanager.cpp @@ -92,7 +92,7 @@ namespace Breeze if( _isX11 ) { // create move-resize atom - xcb_connection_t* connection( QX11Info::connection() ); + xcb_connection_t* connection( Helper::connection() ); const QString atomName( QStringLiteral( "_NET_WM_MOVERESIZE" ) ); xcb_intern_atom_cookie_t cookie( xcb_intern_atom( connection, false, atomName.size(), qPrintable( atomName ) ) ); Helper::ScopedPointer reply( xcb_intern_atom_reply( connection, cookie, nullptr) ); @@ -633,7 +633,7 @@ namespace Breeze #if HAVE_X11 // connection - xcb_connection_t* connection( QX11Info::connection() ); + xcb_connection_t* connection( Helper::connection() ); // window const WId window( widget->window()->winId() );