diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 9966e06c7b..0b31e9c3e7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -71,16 +71,6 @@ #include <QTabletEvent> #endif -#if QT_CONFIG(xinput2) -#include <X11/extensions/XI2.h> -#ifdef XIScrollClass -#define XCB_USE_XINPUT21 // XI 2.1 adds smooth scrolling support -#ifdef XI_TouchBeginMask -#define XCB_USE_XINPUT22 // XI 2.2 adds multi-point touch support -#endif -#endif -#endif // QT_CONFIG(xinput2) - struct xcb_randr_get_output_info_reply_t; QT_BEGIN_NAMESPACE @@ -93,6 +83,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcQpaEvents) Q_DECLARE_LOGGING_CATEGORY(lcQpaXcb) Q_DECLARE_LOGGING_CATEGORY(lcQpaPeeker) Q_DECLARE_LOGGING_CATEGORY(lcQpaKeyboard) +Q_DECLARE_LOGGING_CATEGORY(lcQpaXDnd) class QXcbVirtualDesktop; class QXcbScreen; @@ -128,6 +119,7 @@ namespace QXcbAtom { WM_CLIENT_LEADER, WM_WINDOW_ROLE, SM_CLIENT_ID, + WM_CLIENT_MACHINE, // Clipboard CLIPBOARD, @@ -303,9 +295,6 @@ namespace QXcbAtom { _COMPIZ_TOOLKIT_ACTION, _GTK_LOAD_ICONTHEMES, - NPredefinedAtoms, - - _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, NAtoms }; } @@ -362,7 +351,7 @@ 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(xinput2) +#if QT_CONFIG(xcb_xinput) virtual void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource = Qt::MouseEventNotSynthesized) {} virtual void handleXIEnterLeave(xcb_ge_event_t *) {} #endif @@ -436,8 +425,7 @@ public: xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; } #if QT_CONFIG(xcb_xlib) - void *xlib_display() const; - void *createVisualInfoForDefaultVisualId() const; + void *xlib_display() const { return m_xlib_display; } #endif void sync(); @@ -488,6 +476,7 @@ public: bool hasXInput2() const { return m_xi2Enabled; } bool hasShm() const { return has_shm; } bool hasShmFd() const { return has_shm_fd; } + bool hasXSync() const { return has_sync_extension; } bool threadedEventHandling() const { return m_reader->isRunning(); } @@ -520,10 +509,11 @@ public: QXcbNativeInterface *nativeInterface() const { return m_nativeInterface; } QXcbSystemTrayTracker *systemTrayTracker() const; - static bool xEmbedSystemTrayAvailable(); - static bool xEmbedSystemTrayVisualHasAlphaChannel(); -#if QT_CONFIG(xinput2) + Qt::MouseButtons queryMouseButtons() const; + Qt::KeyboardModifiers queryKeyboardModifiers() const; + +#if QT_CONFIG(xcb_xinput) void xi2SelectStateEvents(); void xi2SelectDeviceEvents(xcb_window_t window); void xi2SelectDeviceEventsCompatibility(xcb_window_t window); @@ -532,15 +522,11 @@ public: bool isAtLeastXI21() const { return m_xi2Enabled && m_xi2Minor >= 1; } bool isAtLeastXI22() const { return m_xi2Enabled && m_xi2Minor >= 2; } Qt::MouseButton xiToQtMouseButton(uint32_t b); -#ifdef XCB_USE_XINPUT21 void xi2UpdateScrollingDevices(); -#endif -#ifdef XCB_USE_XINPUT22 bool startSystemMoveResizeForTouchBegin(xcb_window_t window, const QPoint &point, int corner); void abortSystemMoveResizeForTouch(); bool isTouchScreen(int id); #endif -#endif QXcbEventReader *eventReader() const { return m_reader; } bool canGrab() const { return m_canGrabServer; } @@ -566,6 +552,7 @@ private: void initializeXinerama(); void initializeXShape(); void initializeXKB(); + void initializeXSync(); void handleClientMessageEvent(const xcb_client_message_event_t *event); QXcbScreen* findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc) const; QXcbScreen* findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output) const; @@ -581,7 +568,7 @@ private: bool compressEvent(xcb_generic_event_t *event, int currentIndex, QXcbEventArray *eventqueue) const; bool m_xi2Enabled = false; -#if QT_CONFIG(xinput2) +#if QT_CONFIG(xcb_xinput) int m_xi2Minor = -1; void initializeXInput2(); void xi2SetupDevice(void *info, bool removeExisting = true); @@ -609,10 +596,8 @@ private: void xi2HandleEvent(xcb_ge_event_t *event); void xi2HandleHierarchyEvent(void *event); void xi2HandleDeviceChangedEvent(void *event); - int m_xiOpCode, m_xiEventBase, m_xiErrorBase; -#ifdef XCB_USE_XINPUT22 + int m_xiOpCode; void xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow); -#endif // XCB_USE_XINPUT22 #if QT_CONFIG(tabletevent) struct TabletData { int deviceId = 0; @@ -647,14 +632,11 @@ private: QPointF lastScrollPosition; }; QHash<int, ScrollingDevice> m_scrollingDevices; -#ifdef XCB_USE_XINPUT21 void xi2HandleScrollEvent(void *event, ScrollingDevice &scrollingDevice); void xi2UpdateScrollingDevice(ScrollingDevice &scrollingDevice); ScrollingDevice *scrollingDeviceForId(int id); -#endif static bool xi2GetValuatorValueIfSet(const void *event, int valuatorNum, double *value); - static void xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event); #endif xcb_connection_t *m_connection = nullptr; @@ -688,9 +670,8 @@ private: #endif QXcbEventReader *m_reader = nullptr; -#if QT_CONFIG(xinput2) +#if QT_CONFIG(xcb_xinput) QHash<int, TouchDeviceData> m_touchDevices; -#ifdef XCB_USE_XINPUT22 struct StartSystemMoveResizeInfo { xcb_window_t window = XCB_NONE; uint16_t deviceid; @@ -698,7 +679,6 @@ private: int corner; } m_startSystemMoveResizeInfo; #endif -#endif WindowMapper m_mapper; QVector<PeekFunc> m_peekFuncs; @@ -706,6 +686,9 @@ private: uint32_t xfixes_first_event = 0; uint32_t xrandr_first_event = 0; uint32_t xkb_first_event = 0; +#if QT_CONFIG(xcb_xinput) + uint32_t xinput_first_event = 0; +#endif bool has_xfixes = false; bool has_xinerama_extension = false; @@ -716,6 +699,7 @@ private: bool has_render_extension = false; bool has_shm = false; bool has_shm_fd = false; + bool has_sync_extension = false; QPair<int, int> m_xrenderVersion; @@ -743,7 +727,7 @@ private: QByteArray m_xdgCurrentDesktop; }; -#if QT_CONFIG(xinput2) +#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); @@ -793,18 +777,11 @@ struct QStdFreeDeleter { call##_reply(Q_XCB_REPLY_CONNECTION_ARG(__VA_ARGS__), call##_unchecked(__VA_ARGS__), nullptr) \ ) -template <typename T> -union q_padded_xcb_event { - T event; - char padding[32]; -}; - // The xcb_send_event() requires all events to have 32 bytes. It calls memcpy() on the // passed in event. If the passed in event is less than 32 bytes, memcpy() reaches into // unrelated memory. -#define Q_DECLARE_XCB_EVENT(event_var, event_type) \ - q_padded_xcb_event<event_type> store = {}; \ - auto &event_var = store.event; +template <typename T> +struct alignas(32) q_padded_xcb_event : T { }; QT_END_NAMESPACE |