10#include <QtCore/QObject>
11#include <QtCore/QByteArray>
12#include <QtCore/QLoggingCategory>
13#include <QtGui/private/qtguiglobal_p.h>
27 QXcbBasicConnection(
const char *displayName);
28 ~QXcbBasicConnection();
30#if QT_CONFIG(xcb_xlib)
31 void *xlib_display()
const {
return m_xlibDisplay; }
33 const char *displayName()
const {
return m_displayName.constData(); }
34 int primaryScreenNumber()
const {
return m_primaryScreenNumber; }
35 xcb_connection_t *xcb_connection()
const {
return m_xcbConnection; }
36 bool isConnected()
const {
37 return m_xcbConnection && !xcb_connection_has_error(m_xcbConnection);
39 const xcb_setup_t *setup()
const {
return m_setup; }
41 size_t maxRequestDataBytes(size_t requestSize)
const;
43 inline xcb_atom_t atom(QXcbAtom::Atom qatom)
const {
return m_xcbAtom.atom(qatom); }
44 QXcbAtom::Atom qatom(xcb_atom_t atom)
const {
return m_xcbAtom.qatom(atom); }
45 xcb_atom_t internAtom(
const char *name);
46 QByteArray atomName(xcb_atom_t atom);
48 bool hasXFixes()
const {
return m_hasXFixes; }
49 bool hasXShape()
const {
return m_hasXhape; }
50 bool hasXRandr()
const {
return m_hasXRandr; }
51 bool hasInputShape()
const {
return m_hasInputShape; }
52 bool hasXKB()
const {
return m_hasXkb; }
53 bool hasXRender(
int major = -1,
int minor = -1)
const {
54 if (m_hasXRender && major != -1 && minor != -1)
55 return m_xrenderVersion >= std::pair(major, minor);
59 bool hasXInput2()
const {
return m_xi2Enabled; }
60 bool hasShm()
const {
return m_hasShm; }
61 bool hasShmFd()
const {
return m_hasShmFd; }
62 bool hasXSync()
const {
return m_hasXSync; }
63 bool hasBigRequest()
const;
65 bool isAtLeastXRandR12()
const {
return m_hasXRandr && m_xrandr1Minor >= 2; }
66 bool isAtLeastXRandR15()
const {
return m_hasXRandr && m_xrandr1Minor >= 5; }
68 bool isAtLeastXI21()
const {
return m_xi2Enabled && m_xi2Minor >= 1; }
69 bool isAtLeastXI22()
const {
return m_xi2Enabled && m_xi2Minor >= 2; }
70 bool isAtLeastXI24()
const {
return m_xi2Enabled && m_xi2Minor >= 4; }
71 bool isXIEvent(xcb_generic_event_t *event)
const;
72 bool isXIType(xcb_generic_event_t *event, uint16_t type)
const;
74 bool isXFixesType(uint responseType,
int eventType)
const;
75 bool isXRandrType(uint responseType,
int eventType)
const;
76 bool isXkbType(uint responseType)
const;
80 void initializeXFixes();
81 void initializeXRender();
82 void initializeXRandr();
83 void initializeXShape();
85 void initializeXSync();
86 void initializeXInput2();
89#if QT_CONFIG(xcb_xlib)
90 void *m_xlibDisplay =
nullptr;
92 QByteArray m_displayName;
93 xcb_connection_t *m_xcbConnection =
nullptr;
94 int m_primaryScreenNumber = 0;
95 const xcb_setup_t *m_setup =
nullptr;
98 bool m_hasXFixes =
false;
99 bool m_hasXhape =
false;
100 bool m_hasInputShape;
101 bool m_hasXRandr =
false;
102 bool m_hasXkb =
false;
103 bool m_hasXRender =
false;
104 bool m_hasShm =
false;
105 bool m_hasShmFd =
false;
106 bool m_hasXSync =
false;
108 std::pair<
int,
int> m_xrenderVersion;
110 bool m_xi2Enabled =
false;
113 uint32_t m_xinputFirstEvent = 0;
115 int m_xrandr1Minor = -1;
117 uint32_t m_xfixesFirstEvent = 0;
118 uint32_t m_xrandrFirstEvent = 0;
119 uint32_t m_xkbFirstEvent = 0;
121 uint32_t m_maximumRequestLength = 0;
124#define Q_XCB_REPLY_CONNECTION_ARG(connection, ...) connection
127 void operator()(
void *p)
const noexcept {
return std::free(p); }
130#define Q_XCB_REPLY(call, ...)
131 std::unique_ptr<call##_reply_t, QStdFreeDeleter>(
135#define Q_XCB_REPLY_UNCHECKED(call, ...)
136 std::unique_ptr<call##_reply_t, QStdFreeDeleter>(
bool(*)(xcb_generic_event_t *event, void *peekerData) PeekerCallback
bool removePeekerId(qint32 peekerId)
qint32 generatePeekerId()
const QXcbEventNode * flushedTail() const
xcb_generic_event_t * peek(PeekOption config, Peeker &&peeker)
@ PeekConsumeMatchAndContinue
xcb_generic_event_t * takeFirst(QEventLoop::ProcessEventsFlags flags)
xcb_generic_event_t * peek(Peeker &&peeker)
xcb_generic_event_t * takeFirst()
void flushBufferedEvents()
void waitForNewEvents(const QXcbEventNode *sinceFlushedTail, unsigned long time=(std::numeric_limits< unsigned long >::max)())
bool peekEventQueue(PeekerCallback peeker, void *peekerData=nullptr, PeekOptions option=PeekDefault, qint32 peekerId=-1)
bool isForeignWindow() const override
QXcbForeignWindow(QWindow *window, WId nativeHandle)
QXcbConnection * connection() const
xcb_connection_t * xcb_connection() const
xcb_atom_t atom(QXcbAtom::Atom atom) const
void setConnection(QXcbConnection *connection)
QXcbObject(QXcbConnection *connection=nullptr)
QXcbWindow * window() const
QXcbSyncWindowRequest(QXcbWindow *w)
virtual ~QXcbWindowEventListener()
virtual void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *)
virtual void handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *)
virtual void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource=Qt::MouseEventNotSynthesized)
virtual void handleButtonPressEvent(const xcb_button_press_event_t *)
virtual void handleEnterNotifyEvent(const xcb_enter_notify_event_t *)
virtual void handleMapNotifyEvent(const xcb_map_notify_event_t *)
virtual void handleClientMessageEvent(const xcb_client_message_event_t *)
virtual void handleDestroyNotifyEvent(const xcb_destroy_notify_event_t *)
virtual void handleXIEnterLeave(xcb_ge_event_t *)
virtual void handleMotionNotifyEvent(const xcb_motion_notify_event_t *)
virtual void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *)
virtual void handleButtonReleaseEvent(const xcb_button_release_event_t *)
virtual void handleExposeEvent(const xcb_expose_event_t *)
virtual void handleFocusOutEvent(const xcb_focus_out_event_t *)
virtual void handleFocusInEvent(const xcb_focus_in_event_t *)
virtual void handlePropertyNotifyEvent(const xcb_property_notify_event_t *)
virtual bool handleNativeEvent(xcb_generic_event_t *)
virtual QXcbWindow * toWindow()
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher)
QHash< xcb_window_t, QXcbWindowEventListener * > WindowMapper
#define Q_XCB_REPLY_CONNECTION_ARG(connection,...)
QList< xcb_rectangle_t > qRegionToXcbRectangleList(const QRegion ®ion)
void operator()(void *p) const noexcept