xcb: tidy-up has_<extension> variable handling
Change-Id: I666c9d415e366d6b06b05e70e01456c47ac35b4a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
5d2240718c
commit
6c10c54aa8
@ -538,7 +538,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
|||||||
, m_defaultVisualId(defaultVisualId)
|
, m_defaultVisualId(defaultVisualId)
|
||||||
, m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
|
, m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
|
||||||
, m_nativeInterface(nativeInterface)
|
, m_nativeInterface(nativeInterface)
|
||||||
, has_render_extension(false)
|
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(xcb_xlib)
|
#if QT_CONFIG(xcb_xlib)
|
||||||
Display *dpy = XOpenDisplay(m_displayName.constData());
|
Display *dpy = XOpenDisplay(m_displayName.constData());
|
||||||
@ -1150,7 +1149,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
if (response_type == xfixes_first_event + XCB_XFIXES_SELECTION_NOTIFY) {
|
if (has_xfixes && response_type == xfixes_first_event + XCB_XFIXES_SELECTION_NOTIFY) {
|
||||||
xcb_xfixes_selection_notify_event_t *notify_event = reinterpret_cast<xcb_xfixes_selection_notify_event_t *>(event);
|
xcb_xfixes_selection_notify_event_t *notify_event = reinterpret_cast<xcb_xfixes_selection_notify_event_t *>(event);
|
||||||
setTime(notify_event->timestamp);
|
setTime(notify_event->timestamp);
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
@ -1971,14 +1970,15 @@ void QXcbConnection::initializeXFixes()
|
|||||||
if (!reply || !reply->present)
|
if (!reply || !reply->present)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xfixes_first_event = reply->first_event;
|
|
||||||
auto xfixes_query = Q_XCB_REPLY(xcb_xfixes_query_version, m_connection,
|
auto xfixes_query = Q_XCB_REPLY(xcb_xfixes_query_version, m_connection,
|
||||||
XCB_XFIXES_MAJOR_VERSION,
|
XCB_XFIXES_MAJOR_VERSION,
|
||||||
XCB_XFIXES_MINOR_VERSION);
|
XCB_XFIXES_MINOR_VERSION);
|
||||||
if (!xfixes_query || xfixes_query->major_version < 2) {
|
if (!xfixes_query || xfixes_query->major_version < 2) {
|
||||||
qWarning("QXcbConnection: Failed to initialize XFixes");
|
qWarning("QXcbConnection: Failed to initialize XFixes");
|
||||||
xfixes_first_event = 0;
|
return;
|
||||||
}
|
}
|
||||||
|
xfixes_first_event = reply->first_event;
|
||||||
|
has_xfixes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QXcbConnection::initializeXRender()
|
void QXcbConnection::initializeXRender()
|
||||||
@ -1988,14 +1988,14 @@ void QXcbConnection::initializeXRender()
|
|||||||
if (!reply || !reply->present)
|
if (!reply || !reply->present)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
has_render_extension = true;
|
|
||||||
auto xrender_query = Q_XCB_REPLY(xcb_render_query_version, m_connection,
|
auto xrender_query = Q_XCB_REPLY(xcb_render_query_version, m_connection,
|
||||||
XCB_RENDER_MAJOR_VERSION,
|
XCB_RENDER_MAJOR_VERSION,
|
||||||
XCB_RENDER_MINOR_VERSION);
|
XCB_RENDER_MINOR_VERSION);
|
||||||
if (!xrender_query || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) {
|
if (!xrender_query || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) {
|
||||||
qWarning("QXcbConnection: Failed to initialize XRender");
|
qWarning("QXcbConnection: Failed to initialize XRender");
|
||||||
has_render_extension = false;
|
return;
|
||||||
}
|
}
|
||||||
|
has_render_extension = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ public:
|
|||||||
inline xcb_timestamp_t netWmUserTime() const { return m_netWmUserTime; }
|
inline xcb_timestamp_t netWmUserTime() const { return m_netWmUserTime; }
|
||||||
inline void setNetWmUserTime(xcb_timestamp_t t) { if (t > m_netWmUserTime) m_netWmUserTime = t; }
|
inline void setNetWmUserTime(xcb_timestamp_t t) { if (t > m_netWmUserTime) m_netWmUserTime = t; }
|
||||||
|
|
||||||
bool hasXFixes() const { return xfixes_first_event > 0; }
|
bool hasXFixes() const { return has_xfixes; }
|
||||||
bool hasXShape() const { return has_shape_extension; }
|
bool hasXShape() const { return has_shape_extension; }
|
||||||
bool hasXRandr() const { return has_randr_extension; }
|
bool hasXRandr() const { return has_randr_extension; }
|
||||||
bool hasInputShape() const { return has_input_shape; }
|
bool hasInputShape() const { return has_input_shape; }
|
||||||
@ -669,12 +669,13 @@ private:
|
|||||||
uint32_t xrandr_first_event = 0;
|
uint32_t xrandr_first_event = 0;
|
||||||
uint32_t xkb_first_event = 0;
|
uint32_t xkb_first_event = 0;
|
||||||
|
|
||||||
|
bool has_xfixes = false;
|
||||||
bool has_xinerama_extension = false;
|
bool has_xinerama_extension = false;
|
||||||
bool has_shape_extension = false;
|
bool has_shape_extension = false;
|
||||||
bool has_randr_extension = false;
|
bool has_randr_extension = false;
|
||||||
bool has_input_shape;
|
bool has_input_shape;
|
||||||
bool has_xkb = false;
|
bool has_xkb = false;
|
||||||
bool has_render_extension;
|
bool has_render_extension = false;
|
||||||
|
|
||||||
Qt::MouseButtons m_buttonState = 0;
|
Qt::MouseButtons m_buttonState = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user