xcb: Use QT_CONFIG macro to check for xcb-sm, xcb-render, and xcb-glx

And remove the corresponding defines.
Note that XCB_USE_GLX and XCB_HAS_XCB_GLX were used as synonyms
because QGLXBufferSwapComplete was wrapped in #if defined(XCB_USE_GLX)
and at the same time it was used only when XCB_HAS_XCB_GLX
was defined.

Change-Id: I6c04b0ccfd5369b78b3e8af2ec39d38ae5c311dc
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
Alexander Volkov 2017-02-22 14:33:56 +03:00 committed by Gatis Paeglis
parent 5ac03a14bf
commit 46312b611b
8 changed files with 43 additions and 66 deletions

View File

@ -5,19 +5,10 @@ INCLUDEPATH += $$PWD/../
load(qt_build_paths) load(qt_build_paths)
# build with session management support
qtConfig(xcb-sm) {
DEFINES += XCB_USE_SM
}
!qtConfig(system-xcb) { !qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
QMAKE_USE += xcb-static xcb QMAKE_USE += xcb-static xcb
} else { } else {
qtConfig(xkb): QMAKE_USE += xcb_xkb qtConfig(xkb): QMAKE_USE += xcb_xkb
# to support custom cursors with depth > 1 qtConfig(xcb-render): QMAKE_USE += xcb_render
qtConfig(xcb-render) {
DEFINES += XCB_USE_RENDER
}
QMAKE_USE += xcb_syslibs QMAKE_USE += xcb_syslibs
} }

View File

@ -39,7 +39,7 @@
#include "qxcbglxintegration.h" #include "qxcbglxintegration.h"
#if defined(XCB_HAS_XCB_GLX) #if QT_CONFIG(xcb_glx)
#include <xcb/glx.h> #include <xcb/glx.h>
#endif #endif
@ -56,11 +56,10 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined(XCB_HAS_XCB_GLX) && XCB_GLX_MAJOR_VERSION == 1 && XCB_GLX_MINOR_VERSION < 4 #if QT_CONFIG(xcb_glx)
#if XCB_GLX_MAJOR_VERSION == 1 && XCB_GLX_MINOR_VERSION < 4
#define XCB_GLX_BUFFER_SWAP_COMPLETE 1 #define XCB_GLX_BUFFER_SWAP_COMPLETE 1
typedef struct xcb_glx_buffer_swap_complete_event_t {
typedef struct xcb_glx_buffer_swap_complete_event_t {
uint8_t response_type; uint8_t response_type;
uint8_t pad0; uint8_t pad0;
uint16_t sequence; uint16_t sequence;
@ -72,11 +71,9 @@ typedef struct xcb_glx_buffer_swap_complete_event_t {
uint32_t msc_hi; uint32_t msc_hi;
uint32_t msc_lo; uint32_t msc_lo;
uint32_t sbc; uint32_t sbc;
} xcb_glx_buffer_swap_complete_event_t; } xcb_glx_buffer_swap_complete_event_t;
#endif #endif
typedef struct {
#if defined(XCB_USE_GLX)
typedef struct {
int type; int type;
unsigned long serial; /* # of last request processed by server */ unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */ Bool send_event; /* true if this came from a SendEvent request */
@ -86,7 +83,7 @@ typedef struct {
int64_t ust; int64_t ust;
int64_t msc; int64_t msc;
int64_t sbc; int64_t sbc;
} QGLXBufferSwapComplete; } QGLXBufferSwapComplete;
#endif #endif
QXcbGlxIntegration::QXcbGlxIntegration() QXcbGlxIntegration::QXcbGlxIntegration()
@ -103,7 +100,7 @@ QXcbGlxIntegration::~QXcbGlxIntegration()
bool QXcbGlxIntegration::initialize(QXcbConnection *connection) bool QXcbGlxIntegration::initialize(QXcbConnection *connection)
{ {
m_connection = connection; m_connection = connection;
#ifdef XCB_HAS_XCB_GLX #if QT_CONFIG(xcb_glx)
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection->xcb_connection(), &xcb_glx_id); const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection->xcb_connection(), &xcb_glx_id);
if (!reply || !reply->present) if (!reply || !reply->present)
@ -145,7 +142,7 @@ bool QXcbGlxIntegration::handleXcbEvent(xcb_generic_event_t *event, uint respons
XEvent dummy; XEvent dummy;
event->sequence = LastKnownRequestProcessed(xdisplay); event->sequence = LastKnownRequestProcessed(xdisplay);
if (proc(xdisplay, &dummy, (xEvent*)event)) { if (proc(xdisplay, &dummy, (xEvent*)event)) {
#ifdef XCB_HAS_XCB_GLX #if QT_CONFIG(xcb_glx)
// DRI2 clients don't receive GLXBufferSwapComplete events on the wire. // DRI2 clients don't receive GLXBufferSwapComplete events on the wire.
// Instead the GLX event is synthesized from the DRI2BufferSwapComplete event // Instead the GLX event is synthesized from the DRI2BufferSwapComplete event
// by DRI2WireToEvent(). For an application to be able to see the event // by DRI2WireToEvent(). For an application to be able to see the event

View File

@ -3,14 +3,9 @@ TARGET = qxcb-glx-integration
include(../gl_integrations_plugin_base.pri) include(../gl_integrations_plugin_base.pri)
QT += glx_support-private QT += glx_support-private
#should be removed from the sources
DEFINES += XCB_USE_GLX
DEFINES += QT_NO_FOREACH DEFINES += QT_NO_FOREACH
qtConfig(xcb-glx) { qtConfig(xcb-glx): QMAKE_USE += xcb_glx
DEFINES += XCB_HAS_XCB_GLX
QMAKE_USE += xcb_glx
}
!static:qtConfig(dlopen): QMAKE_USE += libdl !static:qtConfig(dlopen): QMAKE_USE += libdl

View File

@ -80,7 +80,7 @@
#include <X11/extensions/XI2proto.h> #include <X11/extensions/XI2proto.h>
#endif #endif
#ifdef XCB_USE_RENDER #if QT_CONFIG(xcb_render)
#include <xcb/render.h> #include <xcb/render.h>
#endif #endif
@ -583,7 +583,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
#if QT_CONFIG(xkb) #if QT_CONFIG(xkb)
&xcb_xkb_id, &xcb_xkb_id,
#endif #endif
#ifdef XCB_USE_RENDER #if QT_CONFIG(xcb_render)
&xcb_render_id, &xcb_render_id,
#endif #endif
0 0
@ -1533,7 +1533,7 @@ xcb_window_t QXcbConnection::clientLeader()
1, 1,
&m_clientLeader)); &m_clientLeader));
#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM) #if QT_CONFIG(xcb_sm)
// If we are session managed, inform the window manager about it // If we are session managed, inform the window manager about it
QByteArray session = qGuiApp->sessionId().toLatin1(); QByteArray session = qGuiApp->sessionId().toLatin1();
if (!session.isEmpty()) { if (!session.isEmpty()) {
@ -2067,7 +2067,7 @@ void QXcbConnection::initializeXFixes()
void QXcbConnection::initializeXRender() void QXcbConnection::initializeXRender()
{ {
#ifdef XCB_USE_RENDER #if QT_CONFIG(xcb_render)
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_render_id); const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_render_id);
if (!reply || !reply->present) if (!reply || !reply->present)
return; return;

View File

@ -41,7 +41,7 @@
#include <QtGui/QColor> #include <QtGui/QColor>
#include <QtGui/private/qimage_p.h> #include <QtGui/private/qimage_p.h>
#include <QtGui/private/qdrawhelper_p.h> #include <QtGui/private/qdrawhelper_p.h>
#ifdef XCB_USE_RENDER #if QT_CONFIG(xcb_render)
#include <xcb/render.h> #include <xcb/render.h>
// 'template' is used as a function argument name in xcb_renderutil.h // 'template' is used as a function argument name in xcb_renderutil.h
#define template template_param #define template template_param
@ -199,7 +199,7 @@ xcb_pixmap_t qt_xcb_XPixmapFromBitmap(QXcbScreen *screen, const QImage &image)
xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image, xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image,
const QPoint &spot) const QPoint &spot)
{ {
#ifdef XCB_USE_RENDER #if QT_CONFIG(xcb_render)
xcb_connection_t *conn = screen->xcb_connection(); xcb_connection_t *conn = screen->xcb_connection();
const int w = image.width(); const int w = image.width();
const int h = image.height(); const int h = image.height();

View File

@ -455,7 +455,7 @@ QByteArray QXcbIntegration::wmClass() const
return m_wmClass; return m_wmClass;
} }
#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM) #if QT_CONFIG(xcb_sm)
QPlatformSessionManager *QXcbIntegration::createPlatformSessionManager(const QString &id, const QString &key) const QPlatformSessionManager *QXcbIntegration::createPlatformSessionManager(const QString &id, const QString &key) const
{ {
return new QXcbSessionManager(id, key); return new QXcbSessionManager(id, key);

View File

@ -40,6 +40,7 @@
#ifndef QXCBINTEGRATION_H #ifndef QXCBINTEGRATION_H
#define QXCBINTEGRATION_H #define QXCBINTEGRATION_H
#include <QtGui/private/qtguiglobal_p.h>
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h> #include <qpa/qplatformscreen.h>
@ -105,7 +106,7 @@ public:
QByteArray wmClass() const; QByteArray wmClass() const;
#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM) #if QT_CONFIG(xcb_sm)
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override; QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override;
#endif #endif

View File

@ -58,9 +58,7 @@ qtConfig(xcb-xlib) {
} }
} }
# build with session management support
qtConfig(xcb-sm) { qtConfig(xcb-sm) {
DEFINES += XCB_USE_SM
QMAKE_USE += x11sm QMAKE_USE += x11sm
SOURCES += qxcbsessionmanager.cpp SOURCES += qxcbsessionmanager.cpp
HEADERS += qxcbsessionmanager.h HEADERS += qxcbsessionmanager.h
@ -69,16 +67,11 @@ qtConfig(xcb-sm) {
include(gl_integrations/gl_integrations.pri) include(gl_integrations/gl_integrations.pri)
!qtConfig(system-xcb) { !qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
QMAKE_USE += xcb-static xcb QMAKE_USE += xcb-static xcb
} else { } else {
LIBS += -lxcb-xinerama ### there is no configure test for this! LIBS += -lxcb-xinerama ### there is no configure test for this!
qtConfig(xkb): QMAKE_USE += xcb_xkb qtConfig(xkb): QMAKE_USE += xcb_xkb
# to support custom cursors with depth > 1 qtConfig(xcb-render): QMAKE_USE += xcb_render
qtConfig(xcb-render) {
DEFINES += XCB_USE_RENDER
QMAKE_USE += xcb_render
}
QMAKE_USE += xcb_syslibs QMAKE_USE += xcb_syslibs
} }