From 0f6b941ca54f9714627b8d5a94be163dc02126c1 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 30 Jul 2018 18:31:50 +0200 Subject: xcb: cleanup QXcbConnection::handleXcbEvent() - the usage of 'handled' variable was a mess. - remove "generic" from API names. The naming was probably influenced too much from underlying C API (xcb_generic_event_t): - handleGenericEvent() -> handleNativeEvent() to be consistent with QWindow::nativeEvent(). - dropped unnecessary 'long *result' from signature. It is useful only on MS Windows. - genericEventFilterType() -> nativeEventType(), it *is* an event type, not a filter type. - XCB_CLIENT_MESSAGE was not passed to QWindow::nativeEvent(), which is done via HANDLE_PLATFORM_WINDOW_EVENT. - minor: added some 'auto's where it makes sense and improved some variable names. Change-Id: Id1c9896054e2dbd9a79bacd88394149c8cf2cdea Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbnativeinterface.cpp') diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 26b9fcc15a..3d2197796f 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -92,8 +92,7 @@ static int resourceType(const QByteArray &key) return int(result - names); } -QXcbNativeInterface::QXcbNativeInterface() : - m_genericEventFilterType(QByteArrayLiteral("xcb_generic_event_t")) +QXcbNativeInterface::QXcbNativeInterface() { } -- cgit v1.2.3 From 0e63111416e3407c4fa3eac33ae69028216cf1b7 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 3 Aug 2018 15:00:39 +0200 Subject: xcb: avoid unnecessary InternAtom requests QXcbConnection::internAtom() creates the atom if it does not exist. The lifetime of an atom is not tied to the interning client. Atoms remain defined until server reset (lost connection, restart). So create the atom once via QXcbConnection::initializeAllAtoms(), and later fetch the atom value from local array, instead of repeating InternAtom requests. Change-Id: I3cae21895febad6e5daf8c32e72612202baaad64 Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/xcb/qxcbnativeinterface.cpp') diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 3d2197796f..98bedea48a 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -408,7 +408,7 @@ void *QXcbNativeInterface::atspiBus() QXcbIntegration *integration = static_cast(QGuiApplicationPrivate::platformIntegration()); QXcbConnection *defaultConnection = integration->defaultConnection(); if (defaultConnection) { - xcb_atom_t atspiBusAtom = defaultConnection->internAtom("AT_SPI_BUS"); + auto atspiBusAtom = defaultConnection->atom(QXcbAtom::AT_SPI_BUS); auto reply = Q_XCB_REPLY(xcb_get_property, defaultConnection->xcb_connection(), false, defaultConnection->rootWindow(), atspiBusAtom, XCB_ATOM_STRING, 0, 128); -- cgit v1.2.3