diff options
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoasystemtrayicon.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | 9 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.cpp | 12 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 26 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 8 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_basic.cpp | 21 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_basic.h | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.cpp | 25 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.h | 20 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 26 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/xcb-static/xcb-static.pro | 80 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/xcb.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/xcb_qpa_lib.pro | 30 |
15 files changed, 41 insertions, 230 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h index 6779bda491..738c40aba6 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h @@ -65,7 +65,7 @@ public: void updateMenu(QPlatformMenu *menu) override; QRect geometry() const override; void showMessage(const QString &title, const QString &msg, - const QIcon& icon, MessageIcon iconType, int secs) override; + const QIcon& icon, MessageIcon iconType, int msecs) override; bool isSystemTrayAvailable() const override; bool supportsMessages() const override; diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index a5b42ac4e3..559188aa5f 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -265,7 +265,7 @@ bool QCocoaSystemTrayIcon::supportsMessages() const } void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &message, - const QIcon& icon, MessageIcon, int) + const QIcon& icon, MessageIcon, int msecs) { if (!m_sys) return; @@ -283,6 +283,10 @@ void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &mess NSUserNotificationCenter *center = NSUserNotificationCenter.defaultUserNotificationCenter; center.delegate = m_sys->item; [center deliverNotification:notification]; + if (msecs) { + NSTimeInterval timeout = msecs / 1000.0; + [center performSelector:@selector(removeDeliveredNotification:) withObject:notification afterDelay:timeout]; + } [notification release]; } QT_END_NAMESPACE @@ -435,8 +439,7 @@ QT_END_NAMESPACE } - (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification { - Q_UNUSED(center); - Q_UNUSED(notification); + [center removeDeliveredNotification:notification]; emit systray->messageClicked(); } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 8bf88300e9..f2d31d5783 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -196,6 +196,7 @@ bool QWindowsOpengl32DLL::init(bool softwareRendering) wglShareLists = reinterpret_cast<BOOL (WINAPI *)(HGLRC, HGLRC)>(resolve("wglShareLists")); wglSwapBuffers = reinterpret_cast<BOOL (WINAPI *)(HDC)>(resolve("wglSwapBuffers")); wglSetPixelFormat = reinterpret_cast<BOOL (WINAPI *)(HDC, int, const PIXELFORMATDESCRIPTOR *)>(resolve("wglSetPixelFormat")); + wglDescribePixelFormat = reinterpret_cast<int (WINAPI *)(HDC, int, UINT, PIXELFORMATDESCRIPTOR *)>(resolve("wglDescribePixelFormat")); glGetError = reinterpret_cast<GLenum (APIENTRY *)()>(resolve("glGetError")); glGetIntegerv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint *)>(resolve("glGetIntegerv")); @@ -214,6 +215,11 @@ BOOL QWindowsOpengl32DLL::setPixelFormat(HDC dc, int pf, const PIXELFORMATDESCRI return moduleIsNotOpengl32() ? wglSetPixelFormat(dc, pf, pfd) : SetPixelFormat(dc, pf, pfd); } +int QWindowsOpengl32DLL::describePixelFormat(HDC dc, int pf, UINT size, PIXELFORMATDESCRIPTOR *pfd) +{ + return moduleIsNotOpengl32() ? wglDescribePixelFormat(dc, pf, size, pfd) : DescribePixelFormat(dc, pf, size, pfd); +} + QWindowsOpenGLContext *QOpenGLStaticContext::createContext(QOpenGLContext *context) { return new QWindowsGLContext(this, context); @@ -322,11 +328,11 @@ static inline bool static void describeFormats(HDC hdc) { - const int pfiMax = DescribePixelFormat(hdc, 0, 0, nullptr); + const int pfiMax = QOpenGLStaticContext::opengl32.describePixelFormat(hdc, 0, 0, nullptr); for (int i = 0; i < pfiMax; i++) { PIXELFORMATDESCRIPTOR pfd; initPixelFormatDescriptor(&pfd); - DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd); + QOpenGLStaticContext::opengl32.describePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd); qCDebug(lcQpaGl) << '#' << i << '/' << pfiMax << ':' << pfd; } } @@ -617,7 +623,7 @@ static int choosePixelFormat(HDC hdc, // Verify if format is acceptable. Note that the returned // formats have been observed to not contain PFD_SUPPORT_OPENGL, ignore. initPixelFormatDescriptor(obtainedPfd); - DescribePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd); + QOpenGLStaticContext::opengl32.describePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd); if (!isAcceptableFormat(additional, *obtainedPfd, true)) { qCDebug(lcQpaGl) << __FUNCTION__ << " obtained px #" << pixelFormat << " not acceptable=" << *obtainedPfd; diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index 8b0c33f7d5..e5f6fefd5a 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -107,6 +107,7 @@ struct QWindowsOpengl32DLL // Wrappers. Always use these instead of SwapBuffers/wglSwapBuffers/etc. BOOL swapBuffers(HDC dc); BOOL setPixelFormat(HDC dc, int pf, const PIXELFORMATDESCRIPTOR *pfd); + int describePixelFormat(HDC dc, int pf, UINT size, PIXELFORMATDESCRIPTOR *pfd); // WGL HGLRC (WINAPI * wglCreateContext)(HDC dc); @@ -130,6 +131,7 @@ private: // For Mesa llvmpipe shipped with a name other than opengl32.dll BOOL (WINAPI * wglSwapBuffers)(HDC dc); BOOL (WINAPI * wglSetPixelFormat)(HDC dc, int pf, const PIXELFORMATDESCRIPTOR *pfd); + int (WINAPI * wglDescribePixelFormat)(HDC dc, int pf, UINT size, PIXELFORMATDESCRIPTOR *pfd); }; class QOpenGLStaticContext : public QWindowsStaticOpenGLContext diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index cac6345b66..e51c3d0502 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); @@ -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 } @@ -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); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 7cf25d41a6..a894944096 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -104,10 +104,8 @@ public: virtual void handleFocusInEvent(const xcb_focus_in_event_t *) {} virtual void handleFocusOutEvent(const xcb_focus_out_event_t *) {} virtual void handlePropertyNotifyEvent(const xcb_property_notify_event_t *) {} -#if QT_CONFIG(xcb_xinput) virtual void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource = Qt::MouseEventNotSynthesized) {} virtual void handleXIEnterLeave(xcb_ge_event_t *) {} -#endif virtual QXcbWindow *toWindow() { return nullptr; } }; @@ -225,7 +223,6 @@ public: bool isUserInputEvent(xcb_generic_event_t *event) const; -#if QT_CONFIG(xcb_xinput) void xi2SelectStateEvents(); void xi2SelectDeviceEvents(xcb_window_t window); void xi2SelectDeviceEventsCompatibility(xcb_window_t window); @@ -236,7 +233,6 @@ public: bool startSystemMoveResizeForTouchBegin(xcb_window_t window, const QPoint &point, int corner); void abortSystemMoveResizeForTouch(); bool isTouchScreen(int id); -#endif bool canGrab() const { return m_canGrabServer; } @@ -267,7 +263,6 @@ private: inline bool timeGreaterThan(xcb_timestamp_t a, xcb_timestamp_t b) const { return static_cast<int32_t>(a - b) > 0 || b == XCB_CURRENT_TIME; } -#if QT_CONFIG(xcb_xinput) void xi2SetupDevice(void *info, bool removeExisting = true); void xi2SetupDevices(); struct TouchDeviceData { @@ -341,7 +336,6 @@ private: uint32_t pointid; int corner; } m_startSystemMoveResizeInfo; -#endif // QT_CONFIG(xcb_xinput) const bool m_canGrabServer; const xcb_visualid_t m_defaultVisualId; @@ -389,12 +383,10 @@ private: QTimer m_focusInTimer; }; -#if QT_CONFIG(xcb_xinput) #if QT_CONFIG(tabletevent) Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE); #endif -#endif class QXcbConnectionGrabber { diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp index 9a028e5a7e..1ba4b4a1b9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp @@ -45,14 +45,10 @@ #include <xcb/xfixes.h> #include <xcb/xinerama.h> #include <xcb/render.h> -#if QT_CONFIG(xcb_xinput) #include <xcb/xinput.h> -#endif -#if QT_CONFIG(xkb) #define explicit dont_use_cxx_explicit #include <xcb/xkb.h> #undef explicit -#endif #if QT_CONFIG(xcb_xlib) #define register /* C++17 deprecated register */ @@ -138,14 +134,7 @@ QXcbBasicConnection::QXcbBasicConnection(const char *displayName) xcb_extension_t *extensions[] = { &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id, - &xcb_render_id, -#if QT_CONFIG(xkb) - &xcb_xkb_id, -#endif -#if QT_CONFIG(xcb_xinput) - &xcb_input_id, -#endif - 0 + &xcb_render_id, &xcb_xkb_id, &xcb_input_id, 0 }; for (xcb_extension_t **ext_it = extensions; *ext_it; ++ext_it) @@ -160,10 +149,8 @@ QXcbBasicConnection::QXcbBasicConnection(const char *displayName) initializeXinerama(); initializeXFixes(); initializeXRender(); -#if QT_CONFIG(xcb_xinput) if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2")) initializeXInput2(); -#endif initializeXShape(); initializeXKB(); } @@ -213,7 +200,6 @@ bool QXcbBasicConnection::hasBigRequest() const return m_maximumRequestLength > m_setup->maximum_request_length; } -#if QT_CONFIG(xcb_xinput) // Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed: // - "pad0" became "extension" // - "pad1" and "pad" became "pad0" @@ -240,7 +226,6 @@ bool QXcbBasicConnection::isXIType(xcb_generic_event_t *event, uint16_t type) co auto *e = reinterpret_cast<qt_xcb_ge_event_t *>(event); return e->event_type == type; } -#endif // QT_CONFIG(xcb_xinput) bool QXcbBasicConnection::isXFixesType(uint responseType, int eventType) const { @@ -370,7 +355,6 @@ void QXcbBasicConnection::initializeXRandr() m_xrandrFirstEvent = reply->first_event; } -#if QT_CONFIG(xcb_xinput) void QXcbBasicConnection::initializeXInput2() { const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_input_id); @@ -393,7 +377,6 @@ void QXcbBasicConnection::initializeXInput2() m_xinputFirstEvent = reply->first_event; m_xi2Minor = xinputQuery->minor_version; } -#endif void QXcbBasicConnection::initializeXShape() { @@ -417,7 +400,6 @@ void QXcbBasicConnection::initializeXShape() void QXcbBasicConnection::initializeXKB() { -#if QT_CONFIG(xkb) const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_xkb_id); if (!reply || !reply->present) { qCWarning(lcQpaXcb, "XKeyboard extension not present on the X server"); @@ -439,7 +421,6 @@ void QXcbBasicConnection::initializeXKB() m_hasXkb = true; m_xkbFirstEvent = reply->first_event; -#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.h b/src/plugins/platforms/xcb/qxcbconnection_basic.h index 1bd4310562..109186f966 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_basic.h +++ b/src/plugins/platforms/xcb/qxcbconnection_basic.h @@ -99,12 +99,10 @@ public: bool hasXinerama() const { return m_hasXinerama; } bool hasBigRequest() const; -#if QT_CONFIG(xcb_xinput) bool isAtLeastXI21() const { return m_xi2Enabled && m_xi2Minor >= 1; } bool isAtLeastXI22() const { return m_xi2Enabled && m_xi2Minor >= 2; } bool isXIEvent(xcb_generic_event_t *event) const; bool isXIType(xcb_generic_event_t *event, uint16_t type) const; -#endif bool isXFixesType(uint responseType, int eventType) const; bool isXRandrType(uint responseType, int eventType) const; @@ -119,9 +117,7 @@ protected: void initializeXShape(); void initializeXKB(); void initializeXSync(); -#if QT_CONFIG(xcb_xinput) void initializeXInput2(); -#endif private: #if QT_CONFIG(xcb_xlib) @@ -147,11 +143,9 @@ private: QPair<int, int> m_xrenderVersion; bool m_xi2Enabled = false; -#if QT_CONFIG(xcb_xinput) int m_xi2Minor = -1; int m_xiOpCode = -1; uint32_t m_xinputFirstEvent = 0; -#endif uint32_t m_xfixesFirstEvent = 0; uint32_t m_xrandrFirstEvent = 0; diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index d0e02ecdd1..3caee3f409 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -49,13 +49,7 @@ #include <private/qguiapplication_p.h> -#if QT_CONFIG(xkb) -#include <xkbcommon/xkbcommon-x11.h> -#endif - -#if QT_CONFIG(xcb_xinput) #include <xcb/xinput.h> -#endif QT_BEGIN_NAMESPACE @@ -392,20 +386,16 @@ void QXcbKeyboard::updateKeymap() xkb_context_set_log_level(m_xkbContext.get(), logLevel); } -#if QT_CONFIG(xkb) if (connection()->hasXKB()) { m_xkbKeymap.reset(xkb_x11_keymap_new_from_device(m_xkbContext.get(), xcb_connection(), core_device_id, XKB_KEYMAP_COMPILE_NO_FLAGS)); if (m_xkbKeymap) m_xkbState.reset(xkb_x11_state_new_from_device(m_xkbKeymap.get(), xcb_connection(), core_device_id)); } else { -#endif m_xkbKeymap.reset(keymapFromCore(keysymMods)); if (m_xkbKeymap) m_xkbState.reset(xkb_state_new(m_xkbKeymap.get())); -#if QT_CONFIG(xkb) } -#endif if (!m_xkbKeymap) { qCWarning(lcQpaKeyboard, "failed to compile a keymap"); @@ -428,7 +418,6 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const return QXkbCommon::possibleKeys(m_xkbState.get(), event, m_superAsMeta, m_hyperAsMeta); } -#if QT_CONFIG(xkb) void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state) { if (m_config && connection()->hasXKB()) { @@ -444,7 +433,6 @@ void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state) handleStateChanges(changedComponents); } } -#endif static xkb_layout_index_t lockedGroup(quint16 state) { @@ -473,7 +461,6 @@ void QXcbKeyboard::updateXKBStateFromCore(quint16 state) } } -#if QT_CONFIG(xcb_xinput) void QXcbKeyboard::updateXKBStateFromXI(void *modInfo, void *groupInfo) { if (m_config && !connection()->hasXKB()) { @@ -491,7 +478,6 @@ void QXcbKeyboard::updateXKBStateFromXI(void *modInfo, void *groupInfo) handleStateChanges(changedComponents); } } -#endif void QXcbKeyboard::handleStateChanges(xkb_state_component changedComponents) { @@ -541,7 +527,6 @@ void QXcbKeyboard::updateXKBMods() QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) : QXcbObject(connection) { -#if QT_CONFIG(xkb) core_device_id = 0; if (connection->hasXKB()) { selectEvents(); @@ -551,11 +536,9 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) return; } } else { -#endif m_key_symbols = xcb_key_symbols_alloc(xcb_connection()); -#if QT_CONFIG(xkb) } -#endif + updateKeymap(); } @@ -573,7 +556,6 @@ void QXcbKeyboard::initialize() void QXcbKeyboard::selectEvents() { -#if QT_CONFIG(xkb) const uint16_t required_map_parts = (XCB_XKB_MAP_PART_KEY_TYPES | XCB_XKB_MAP_PART_KEY_SYMS | XCB_XKB_MAP_PART_MODIFIER_MAP | @@ -604,12 +586,10 @@ void QXcbKeyboard::selectEvents() free(error); qCWarning(lcQpaXcb, "failed to select notify events from XKB"); } -#endif } void QXcbKeyboard::updateVModMapping() { -#if QT_CONFIG(xkb) xcb_xkb_get_names_value_list_t names_list; memset(&vmod_masks, 0, sizeof(vmod_masks)); @@ -667,12 +647,10 @@ void QXcbKeyboard::updateVModMapping() else if (qstrcmp(vmod_name, "Hyper") == 0) vmod_masks.hyper = bit; } -#endif } void QXcbKeyboard::updateVModToRModMapping() { -#if QT_CONFIG(xkb) xcb_xkb_get_map_map_t map; memset(&rmod_masks, 0, sizeof(rmod_masks)); @@ -729,7 +707,6 @@ void QXcbKeyboard::updateVModToRModMapping() else if (vmod_masks.hyper == bit) rmod_masks.hyper = modmap; } -#endif } // Small helper: set modifier bit, if modifier position is valid diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index e35c82ad24..0ee08aeff2 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -43,14 +43,12 @@ #include "qxcbobject.h" #include <xcb/xcb_keysyms.h> -#if QT_CONFIG(xkb) #define explicit dont_use_cxx_explicit #include <xcb/xkb.h> #undef explicit -#endif -#include <xkbcommon/xkbcommon.h> #include <QtXkbCommonSupport/private/qxkbcommon_p.h> +#include <xkbcommon/xkbcommon-x11.h> #include <QEvent> @@ -74,18 +72,14 @@ public: void updateKeymap(); QList<int> possibleKeys(const QKeyEvent *event) const; - // when XKEYBOARD not present on the X server void updateXKBMods(); xkb_mod_mask_t xkbModMask(quint16 state); void updateXKBStateFromCore(quint16 state); -#if QT_CONFIG(xcb_xinput) void updateXKBStateFromXI(void *modInfo, void *groupInfo); -#endif -#if QT_CONFIG(xkb) - // when XKEYBOARD is present on the X server + int coreDeviceId() const { return core_device_id; } void updateXKBState(xcb_xkb_state_notify_event_t *state); -#endif + void handleStateChanges(xkb_state_component changedComponents); protected: @@ -97,10 +91,9 @@ protected: typedef QMap<xcb_keysym_t, int> KeysymModifierMap; struct xkb_keymap *keymapFromCore(const KeysymModifierMap &keysymMods); - // when XKEYBOARD not present on the X server void updateModifiers(const KeysymModifierMap &keysymMods); KeysymModifierMap keysymsToModifiers(); - // when XKEYBOARD is present on the X server + void updateVModMapping(); void updateVModToRModMapping(); @@ -119,7 +112,6 @@ private: _mod_masks rmod_masks; - // when XKEYBOARD not present on the X server xcb_key_symbols_t *m_key_symbols = nullptr; struct _xkb_mods { xkb_mod_index_t shift; @@ -132,11 +124,9 @@ private: xkb_mod_index_t mod5; }; _xkb_mods xkb_mods; -#if QT_CONFIG(xkb) - // when XKEYBOARD is present on the X server + _mod_masks vmod_masks; int core_device_id; -#endif QXkbCommon::ScopedXKBState m_xkbState; QXkbCommon::ScopedXKBKeymap m_xkbKeymap; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 97da420798..76d3545d35 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -67,9 +67,7 @@ #include <xcb/xcb_icccm.h> #include <xcb/xfixes.h> #include <xcb/shape.h> -#if QT_CONFIG(xcb_xinput) #include <xcb/xinput.h> -#endif #include <private/qguiapplication_p.h> #include <private/qwindow_p.h> @@ -492,14 +490,12 @@ void QXcbWindow::create() atom(QXcbAtom::_XEMBED_INFO), 32, 2, (void *)data); -#if QT_CONFIG(xcb_xinput) if (connection()->hasXInput2()) { if (connection()->xi2MouseEventsDisabled()) connection()->xi2SelectDeviceEventsCompatibility(m_window); else connection()->xi2SelectDeviceEvents(m_window); } -#endif setWindowState(window()->windowStates()); setWindowFlags(window()->flags()); @@ -1895,9 +1891,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in QPoint global(root_x, root_y); if (isWheel) { -#if QT_CONFIG(xcb_xinput) if (!connection()->isAtLeastXI21()) { -#endif QPoint angleDelta; if (detail == 4) angleDelta.setY(120); @@ -1910,9 +1904,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in if (modifiers & Qt::AltModifier) angleDelta = angleDelta.transposed(); QWindowSystemInterface::handleWheelEvent(window(), timestamp, local, global, QPoint(), angleDelta, modifiers); -#if QT_CONFIG(xcb_xinput) } -#endif return; } @@ -1948,13 +1940,8 @@ static inline bool doCheckUnGrabAncestor(QXcbConnection *conn) * not pressed, otherwise (e.g. on Alt+Tab) it can igonre important enter/leave events. */ if (conn) { - const bool mouseButtonsPressed = (conn->buttonState() != Qt::NoButton); -#if QT_CONFIG(xcb_xinput) return mouseButtonsPressed || (conn->hasXInput2() && !conn->xi2MouseEventsDisabled()); -#else - return mouseButtonsPressed; -#endif } return true; } @@ -1986,10 +1973,9 @@ void QXcbWindow::handleEnterNotifyEvent(int event_x, int event_y, int root_x, in if (ignoreEnterEvent(mode, detail, connection()) || connection()->mousePressWindow()) return; -#if QT_CONFIG(xcb_xinput) + // Updates scroll valuators, as user might have done some scrolling outside our X client. connection()->xi2UpdateScrollingDevices(); -#endif const QPoint local(event_x, event_y); QWindowSystemInterface::handleEnterEvent(window(), local, global); @@ -2064,7 +2050,6 @@ void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) event->time, QEvent::MouseMove); } -#if QT_CONFIG(xcb_xinput) static inline int fixed1616ToInt(xcb_input_fp1616_t val) { return int(qreal(val) / 0x10000); @@ -2165,7 +2150,6 @@ void QXcbWindow::handleXIEnterLeave(xcb_ge_event_t *event) break; } } -#endif QXcbWindow *QXcbWindow::toWindow() { return this; } @@ -2301,14 +2285,12 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab) if (grab && !connection()->canGrab()) return false; -#if QT_CONFIG(xcb_xinput) if (connection()->hasXInput2() && !connection()->xi2MouseEventsDisabled()) { bool result = connection()->xi2SetMouseGrabEnabled(m_window, grab); if (grab && result) connection()->setMouseGrabber(this); return result; } -#endif if (!grab) { xcb_ungrab_pointer(xcb_connection(), XCB_TIME_CURRENT_TIME); @@ -2376,7 +2358,7 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner) return false; const QPoint globalPos = QHighDpi::toNativePixels(window()->mapToGlobal(pos), window()->screen()); -#if QT_CONFIG(xcb_xinput) + // ### FIXME QTBUG-53389 bool startedByTouch = connection()->startSystemMoveResizeForTouchBegin(m_window, globalPos, corner); if (startedByTouch) { @@ -2386,9 +2368,7 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int corner) return false; } // KWin, Openbox, AwesomeWM have been tested to work with _NET_WM_MOVERESIZE. - } else -#endif - { // Started by mouse press. + } else { // Started by mouse press. if (connection()->isUnity()) return false; // _NET_WM_MOVERESIZE on this WM is bouncy (WM bug?). diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 5de5974ca7..13b37db028 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -137,10 +137,8 @@ public: void handleFocusInEvent(const xcb_focus_in_event_t *event) override; void handleFocusOutEvent(const xcb_focus_out_event_t *event) override; void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) override; -#if QT_CONFIG(xcb_xinput) void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) override; void handleXIEnterLeave(xcb_ge_event_t *) override; -#endif QXcbWindow *toWindow() override; diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro deleted file mode 100644 index 078b275381..0000000000 --- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro +++ /dev/null @@ -1,80 +0,0 @@ -# -# Statically compile in code for -# libxcb-fixes, libxcb-randr, libxcb-shm, libxcb-sync, libxcb-image, -# libxcb-keysyms, libxcb-icccm, libxcb-renderutil, libxcb-xkb, -# libxcb-xinerama, libxcb-xinput -# -CONFIG += static - -XCB_DIR = $$QT_SOURCE_TREE/src/3rdparty/xcb - -MODULE_INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude -INCLUDEPATH += $$XCB_DIR/include/xcb - -QMAKE_USE += xcb/nolink - -# ignore compiler warnings in 3rdparty code -QMAKE_CFLAGS_STATIC_LIB+=-w - -# -# libxcb -# -LIBXCB_DIR = $$XCB_DIR/libxcb - -SOURCES += \ - $$LIBXCB_DIR/xfixes.c \ - $$LIBXCB_DIR/randr.c \ - $$LIBXCB_DIR/shm.c \ - $$LIBXCB_DIR/sync.c \ - $$LIBXCB_DIR/render.c \ - $$LIBXCB_DIR/shape.c \ - $$LIBXCB_DIR/xkb.c \ - $$LIBXCB_DIR/xinerama.c \ - $$LIBXCB_DIR/xinput.c - -# -# xcb-util -# -XCB_UTIL_DIR = $$XCB_DIR/xcb-util - - -SOURCES += \ - $$XCB_UTIL_DIR/xcb_aux.c \ - $$XCB_UTIL_DIR/atoms.c \ - $$XCB_UTIL_DIR/event.c - -# -# xcb-util-image -# -XCB_IMAGE_DIR = $$XCB_DIR/xcb-util-image - -SOURCES += $$XCB_IMAGE_DIR/xcb_image.c - -# -# xcb-util-keysyms -# -XCB_KEYSYMS_DIR = $$XCB_DIR/xcb-util-keysyms - -SOURCES += $$XCB_KEYSYMS_DIR/keysyms.c - -# -# xcb-util-renderutil -# - -XCB_RENDERUTIL_DIR = $$XCB_DIR/xcb-util-renderutil - -SOURCES += $$XCB_RENDERUTIL_DIR/util.c - -# -# xcb-util-wm -# -XCB_WM_DIR = $$XCB_DIR/xcb-util-wm - -SOURCES += \ - $$XCB_WM_DIR/icccm.c - -OTHER_FILES = $$XCB_DIR/README - -TR_EXCLUDE += $$XCB_DIR/* - -load(qt_helper_lib) diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 0d27645a60..1c43c5ca04 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -2,8 +2,6 @@ TEMPLATE = subdirs CONFIG += ordered QT_FOR_CONFIG += gui-private -!qtConfig(system-xcb): SUBDIRS += xcb-static - SUBDIRS += xcb_qpa_lib.pro SUBDIRS += xcb-plugin.pro SUBDIRS += gl_integrations diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 34c671c8c7..a5d05faa9c 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -35,6 +35,7 @@ SOURCES = \ qxcbeventdispatcher.cpp \ qxcbconnection_basic.cpp \ qxcbconnection_screens.cpp \ + qxcbconnection_xi2.cpp \ qxcbatom.cpp HEADERS = \ @@ -71,10 +72,6 @@ qtConfig(xcb-xlib) { QMAKE_USE += xcb_xlib } -qtConfig(xcb-xinput) { - SOURCES += qxcbconnection_xi2.cpp -} - qtConfig(xcb-sm) { QMAKE_USE += x11sm SOURCES += qxcbsessionmanager.cpp @@ -94,20 +91,19 @@ qtConfig(vulkan) { qxcbvulkanwindow.h } -!qtConfig(system-xcb) { - QMAKE_USE += xcb-static -} else { - qtConfig(xcb-xinput): QMAKE_USE += xcb_xinput - QMAKE_USE += \ - xcb_icccm xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil \ - xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama -} -QMAKE_USE += xcb +QMAKE_USE += \ + xcb xcb_icccm xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil \ + xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb_xkb xkbcommon xkbcommon_x11 -QMAKE_USE += xkbcommon -qtConfig(xkb) { - QMAKE_USE += xkbcommon_x11 - qtConfig(system-xcb): QMAKE_USE += xcb_xkb +qtConfig(system-xcb-xinput) { + QMAKE_USE += xcb_xinput +} else { + # Use bundled xcb-xinput sources. + XCB_DIR = $$QT_SOURCE_TREE/src/3rdparty/xcb + INCLUDEPATH += $$XCB_DIR/include/ + SOURCES += $$XCB_DIR/libxcb/xinput.c + # Ignore compiler warnings in 3rdparty C code. + QMAKE_CFLAGS+=-w } qtConfig(dlopen): QMAKE_USE += libdl |