diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index cac6345b66..435c4aee93 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -66,14 +66,10 @@ #include <errno.h> #include <xcb/xfixes.h> -#if QT_CONFIG(xkb) #define explicit dont_use_cxx_explicit #include <xcb/xkb.h> #undef explicit -#endif -#if QT_CONFIG(xcb_xinput) #include <xcb/xinput.h> -#endif QT_BEGIN_NAMESPACE @@ -88,12 +84,6 @@ Q_LOGGING_CATEGORY(lcQpaKeyboard, "qt.qpa.xkeyboard") Q_LOGGING_CATEGORY(lcQpaClipboard, "qt.qpa.clipboard") Q_LOGGING_CATEGORY(lcQpaXDnd, "qt.qpa.xdnd") -// this event type was added in libxcb 1.10, -// but we support also older version -#ifndef XCB_GE_GENERIC -#define XCB_GE_GENERIC 35 -#endif - QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName) : QXcbBasicConnection(displayName) , m_canGrabServer(canGrabServer) @@ -112,12 +102,10 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra initializeScreens(); -#if QT_CONFIG(xcb_xinput) if (hasXInput2()) { xi2SetupDevices(); xi2SelectStateEvents(); } -#endif m_wmSupport.reset(new QXcbWMSupport(this)); m_keyboard = new QXcbKeyboard(this); @@ -196,7 +184,7 @@ QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id) QXcbWindowEventListener *listener = m_mapper.value(id, 0); if (listener) return listener->toWindow(); - return 0; + return nullptr; } #define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \ @@ -467,7 +455,7 @@ void QXcbConnection::printXcbError(const char *message, xcb_generic_error_t *err static Qt::MouseButtons translateMouseButtons(int s) { - Qt::MouseButtons ret = 0; + Qt::MouseButtons ret; if (s & XCB_BUTTON_MASK_1) ret |= Qt::LeftButton; if (s & XCB_BUTTON_MASK_2) @@ -518,7 +506,6 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s) } } -#if QT_CONFIG(xkb) namespace { typedef union { /* All XKB events share these fields. */ @@ -534,7 +521,6 @@ namespace { xcb_xkb_state_notify_event_t state_notify; } _xkb_event; } -#endif void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) { @@ -611,16 +597,12 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); } case XCB_ENTER_NOTIFY: -#if QT_CONFIG(xcb_xinput) if (hasXInput2() && !xi2MouseEventsDisabled()) break; -#endif HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent); case XCB_LEAVE_NOTIFY: -#if QT_CONFIG(xcb_xinput) if (hasXInput2() && !xi2MouseEventsDisabled()) break; -#endif m_keyboard->updateXKBStateFromCore(reinterpret_cast<xcb_leave_notify_event_t *>(event)->state); HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent); case XCB_FOCUS_IN: @@ -682,13 +664,11 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) } break; } -#if QT_CONFIG(xcb_xinput) case XCB_GE_GENERIC: // Here the windowEventListener is invoked from xi2HandleEvent() if (hasXInput2() && isXIEvent(event)) xi2HandleEvent(reinterpret_cast<xcb_ge_event_t *>(event)); break; -#endif default: handled = false; // event type not recognized break; @@ -712,7 +692,6 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) auto change_event = reinterpret_cast<xcb_randr_screen_change_notify_event_t *>(event); if (auto virtualDesktop = virtualDesktopForRootWindow(change_event->root)) virtualDesktop->handleScreenChange(change_event); -#if QT_CONFIG(xkb) } else if (isXkbType(response_type)) { auto xkb_event = reinterpret_cast<_xkb_event *>(event); if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()) { @@ -735,7 +714,6 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) break; } } -#endif } else { handled = false; // event type still not recognized } @@ -825,7 +803,7 @@ xcb_window_t QXcbConnection::getQtSelectionOwner() XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class xcbScreen->root_visual, // visual 0, // value mask - 0); // value list + nullptr); // value list QXcbWindow::setWindowTitle(connection(), m_qtSelectionOwner, QLatin1String("Qt Selection Owner for ") + QCoreApplication::applicationName()); @@ -852,7 +830,7 @@ xcb_window_t QXcbConnection::clientLeader() 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->screen()->root_visual, - 0, 0); + 0, nullptr); QXcbWindow::setWindowTitle(connection(), m_clientLeader, @@ -912,7 +890,6 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event) const }); } -#if QT_CONFIG(xcb_xinput) // compress XI_* events if (responseType == XCB_GE_GENERIC) { if (!hasXInput2()) @@ -948,7 +925,6 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event) const return false; } -#endif if (responseType == XCB_CONFIGURE_NOTIFY) { // compress multiple configure notify events for the same window @@ -978,7 +954,6 @@ bool QXcbConnection::isUserInputEvent(xcb_generic_event_t *event) const if (isInputEvent) return true; -#if QT_CONFIG(xcb_xinput) if (connection()->hasXInput2()) { isInputEvent = isXIType(event, XCB_INPUT_BUTTON_PRESS) || isXIType(event, XCB_INPUT_BUTTON_RELEASE) || @@ -993,7 +968,6 @@ bool QXcbConnection::isUserInputEvent(xcb_generic_event_t *event) const } if (isInputEvent) return true; -#endif if (eventType == XCB_CLIENT_MESSAGE) { auto clientMessage = reinterpret_cast<const xcb_client_message_event_t *>(event); @@ -1057,7 +1031,7 @@ void QXcbConnection::sync() { // from xcb_aux_sync xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus(xcb_connection()); - free(xcb_get_input_focus_reply(xcb_connection(), cookie, 0)); + free(xcb_get_input_focus_reply(xcb_connection(), cookie, nullptr)); } QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const @@ -1075,14 +1049,14 @@ QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const Qt::MouseButtons QXcbConnection::queryMouseButtons() const { int stateMask = 0; - QXcbCursor::queryPointer(connection(), 0, 0, &stateMask); + QXcbCursor::queryPointer(connection(), nullptr, nullptr, &stateMask); return translateMouseButtons(stateMask); } Qt::KeyboardModifiers QXcbConnection::queryKeyboardModifiers() const { int stateMask = 0; - QXcbCursor::queryPointer(connection(), 0, 0, &stateMask); + QXcbCursor::queryPointer(connection(), nullptr, nullptr, &stateMask); return keyboard()->translateModifiers(stateMask); } @@ -1140,7 +1114,7 @@ void QXcbSyncWindowRequest::invalidate() { if (m_window) { m_window->clearSyncWindowRequest(); - m_window = 0; + m_window = nullptr; } } @@ -1160,7 +1134,7 @@ void QXcbConnectionGrabber::release() { if (m_connection) { m_connection->ungrabServer(); - m_connection = 0; + m_connection = nullptr; } } |