summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2017-08-04 11:58:25 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2017-08-08 22:20:51 +0000
commit6c10c54aa805f79100a29b0648be51d8af41f26a (patch)
tree4dbcd17281cebc61e78b5832e3d2353a1cc96c82 /src/plugins/platforms
parent5d2240718c4d4d7b8989ce1a171f449f2147cab4 (diff)
xcb: tidy-up has_<extension> variable handling
Change-Id: I666c9d415e366d6b06b05e70e01456c47ac35b4a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h5
2 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 1671bdabb2..8c444ce7aa 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -538,7 +538,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
, m_defaultVisualId(defaultVisualId)
, m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
, m_nativeInterface(nativeInterface)
- , has_render_extension(false)
{
#if QT_CONFIG(xcb_xlib)
Display *dpy = XOpenDisplay(m_displayName.constData());
@@ -1150,7 +1149,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
}
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);
setTime(notify_event->timestamp);
#ifndef QT_NO_CLIPBOARD
@@ -1971,14 +1970,15 @@ void QXcbConnection::initializeXFixes()
if (!reply || !reply->present)
return;
- xfixes_first_event = reply->first_event;
auto xfixes_query = Q_XCB_REPLY(xcb_xfixes_query_version, m_connection,
XCB_XFIXES_MAJOR_VERSION,
XCB_XFIXES_MINOR_VERSION);
if (!xfixes_query || xfixes_query->major_version < 2) {
qWarning("QXcbConnection: Failed to initialize XFixes");
- xfixes_first_event = 0;
+ return;
}
+ xfixes_first_event = reply->first_event;
+ has_xfixes = true;
}
void QXcbConnection::initializeXRender()
@@ -1988,14 +1988,14 @@ void QXcbConnection::initializeXRender()
if (!reply || !reply->present)
return;
- has_render_extension = true;
auto xrender_query = Q_XCB_REPLY(xcb_render_query_version, m_connection,
XCB_RENDER_MAJOR_VERSION,
XCB_RENDER_MINOR_VERSION);
if (!xrender_query || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) {
qWarning("QXcbConnection: Failed to initialize XRender");
- has_render_extension = false;
+ return;
}
+ has_render_extension = true;
#endif
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 13f5cd5842..8ac05574f3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -455,7 +455,7 @@ public:
inline xcb_timestamp_t netWmUserTime() const { return m_netWmUserTime; }
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 hasXRandr() const { return has_randr_extension; }
bool hasInputShape() const { return has_input_shape; }
@@ -669,12 +669,13 @@ private:
uint32_t xrandr_first_event = 0;
uint32_t xkb_first_event = 0;
+ bool has_xfixes = false;
bool has_xinerama_extension = false;
bool has_shape_extension = false;
bool has_randr_extension = false;
bool has_input_shape;
bool has_xkb = false;
- bool has_render_extension;
+ bool has_render_extension = false;
Qt::MouseButtons m_buttonState = 0;