From d67214302f269242ae3d8d2b962fd91ec42c979e Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Sat, 22 Sep 2018 13:14:23 +0200 Subject: xcb: qxcbconnection_basic A basic base class that creates a connection and initializes extensions. The goal was to reduce the size of qxcbconnection.h/cpp. Made QXcbAtom into a class that handles atom initialization and exposes the relevant APIs. Before this patch, all of that logic was inside of qxcbconnection.h/cpp. Change-Id: Ia893c3b31e2343dfbe62fe2aa6bfd0017abf46ea Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index c29eb29b7e..c8c806749f 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -106,7 +106,7 @@ public: void put(xcb_drawable_t dst, const QRegion ®ion, const QPoint &offset); void preparePaint(const QRegion ®ion); - static bool createSystemVShmSegment(QXcbConnection *c, size_t segmentSize = 1, + static bool createSystemVShmSegment(xcb_connection_t *c, size_t segmentSize = 1, xcb_shm_segment_info_t *shm_info = nullptr); private: @@ -406,12 +406,12 @@ void QXcbBackingStoreImage::createShmSegment(size_t segmentSize) } else #endif { - if (createSystemVShmSegment(connection(), segmentSize, &m_shm_info)) + if (createSystemVShmSegment(xcb_connection(), segmentSize, &m_shm_info)) m_segmentSize = segmentSize; } } -bool QXcbBackingStoreImage::createSystemVShmSegment(QXcbConnection *c, size_t segmentSize, +bool QXcbBackingStoreImage::createSystemVShmSegment(xcb_connection_t *c, size_t segmentSize, xcb_shm_segment_info_t *shmInfo) { const int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0600); @@ -429,17 +429,17 @@ bool QXcbBackingStoreImage::createSystemVShmSegment(QXcbConnection *c, size_t se if (shmctl(id, IPC_RMID, 0) == -1) qCWarning(lcQpaXcb, "Error while marking the shared memory segment to be destroyed"); - const auto seg = xcb_generate_id(c->xcb_connection()); - auto cookie = xcb_shm_attach_checked(c->xcb_connection(), seg, id, false); - auto *error = xcb_request_check(c->xcb_connection(), cookie); + const auto seg = xcb_generate_id(c); + auto cookie = xcb_shm_attach_checked(c, seg, id, false); + auto *error = xcb_request_check(c, cookie); if (error) { - c->printXcbError("xcb_shm_attach() failed with error", error); + qCWarning(lcQpaXcb(), "xcb_shm_attach() failed"); free(error); if (shmdt(addr) == -1) qCWarning(lcQpaXcb, "shmdt() failed (%d: %s) for %p", errno, strerror(errno), addr); return false; } else if (!shmInfo) { // this was a test run, free the allocated test segment - xcb_shm_detach(c->xcb_connection(), seg); + xcb_shm_detach(c, seg); auto shmaddr = static_cast(addr); if (shmdt(shmaddr) == -1) qCWarning(lcQpaXcb, "shmdt() failed (%d: %s) for %p", errno, strerror(errno), shmaddr); @@ -766,7 +766,7 @@ void QXcbBackingStoreImage::preparePaint(const QRegion ®ion) m_pendingFlush |= region; } -bool QXcbBackingStore::createSystemVShmSegment(QXcbConnection *c, size_t segmentSize, void *shmInfo) +bool QXcbBackingStore::createSystemVShmSegment(xcb_connection_t *c, size_t segmentSize, void *shmInfo) { auto info = reinterpret_cast(shmInfo); return QXcbBackingStoreImage::createSystemVShmSegment(c, segmentSize, info); -- cgit v1.2.3