make some X11 extensions optional as was in stock Qt4

this makes it possible to build without tricks on Slitaz for an example (or
at least the GUI component, I have yet to test everything) where only the
bare minimum is installed/available

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-07-10 02:53:30 +03:00
parent 7a2bab6a36
commit 9ebc979ae2
10 changed files with 47 additions and 29 deletions

View file

@ -451,7 +451,7 @@ set_package_properties(Threads PROPERTIES
if(NOT KATIE_PLATFORM MATCHES "(win32|wince|mac)" AND NOT KATIE_BOOTSTRAP)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(X11 COMPONENTS ICE SM Xcursor Xext Xfixes Xi Xinerama Xrandr Xrender X11 Xtst Xt)
find_package(X11 COMPONENTS ICE SM Xcursor Xext Xfixes XSync XShm XShape Xi Xkb Xinerama Xrandr Xrender X11 Xtst Xt)
set_package_properties(X11 PROPERTIES
PURPOSE "Required for X11/X.Org integration support"
DESCRIPTION "Open source implementation of the X Window System"

View file

@ -455,15 +455,33 @@ if(WITH_X11 AND X11_FOUND)
${EXTRA_GUI_LIBS}
${X11_LIBRARIES}
${X11_X11_LIB}
${X11_Xrender_LIB}
${X11_Xt_LIB}
${X11_Xfixes_LIB}
${X11_Xcursor_LIB}
${X11_Xinerama_LIB}
${X11_Xi_LIB}
${X11_Xrandr_LIB}
)
include_directories(${X11_INCLUDE_DIR})
# in case those may be usefull via KATIE_DEFINITIONS the checks will have to
# be moved to the top-level CMake file
# TODO: xim
foreach(x11ext Xshape Xinerama Xrandr Xrender XSync Xkb Xfixes Xcursor Xinput XShm)
if(X11_${x11ext}_FOUND)
set(EXTRA_GUI_LIBS
${EXTRA_GUI_LIBS}
${X11_${x11ext}_LIB}
)
else()
message(WARNING "The X11 ${x11ext} extension was not found")
string(TOUPPER "${x11ext}" upperext)
add_definitions(-DQT_NO_${upperext})
endif()
endforeach()
if(NOT X11_Xinput_FOUND)
message(WARNING "X11 Xinput extension was not found thus disabling tabled support too")
add_definitions(-DQT_NO_TABLET)
endif()
if(NOT X11_SM_FOUND)
message(WARNING "X11 SM was not found thus disabling session manager support")
add_definitions(-DQT_NO_SESSIONMANAGER)
endif()
endif()
if(WITH_NIS AND NIS_FOUND)

View file

@ -48,7 +48,7 @@
#include "qapplication_p.h"
#include "qgraphicssystem_p.h"
#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#if defined(Q_WS_X11) && !defined(QT_NO_XSHM)
#include <qx11info_x11.h>
#include <sys/ipc.h>
#include <sys/shm.h>
@ -148,7 +148,7 @@ QImage::Format QNativeImage::systemFormat()
}
#elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#elif defined(Q_WS_X11) && !defined(QT_NO_XSHM)
QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget)
: xshmimg(0), xshmpm(0)

View file

@ -88,7 +88,7 @@ public:
HBITMAP bitmap;
HBITMAP null_bitmap;
#elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#elif defined(Q_WS_X11) && !defined(QT_NO_XSHM)
XImage *xshmimg;
Pixmap xshmpm;
XShmSegmentInfo xshminfo;

View file

@ -1955,7 +1955,7 @@ void qt_init(QApplicationPrivate *priv, int,
}
#endif // QT_NO_XRENDER
#ifndef QT_NO_MITSHM
#ifndef QT_NO_XSHM
int mitshm_minor;
int mitshm_major;
int mitshm_eventbase;
@ -1984,7 +1984,7 @@ void qt_init(QApplicationPrivate *priv, int,
X11->use_mitshm_pixmaps = X11->use_mitshm && mitshm_pixmaps;
}
}
#endif // QT_NO_MITSHM
#endif // QT_NO_XSHM
// initialize the graphics system - order is imporant here - it must be done before
// the QColormap::initialize() call

View file

@ -1418,7 +1418,7 @@ void QDragManager::cancel(bool deleteSource)
global_accepted_action = Qt::IgnoreAction;
}
#ifndef QT_NO_SHAPE
#ifndef QT_NO_XSHAPE
static
bool windowInteractsWithPosition(const QPoint & pos, Window w, int shapeType)
{
@ -1460,9 +1460,9 @@ Window findRealWindow(const QPoint & pos, Window w, int md, bool ignoreNonXdndAw
AnyPropertyType, &type, &f,&n,&a,&data);
if (data) XFree(data);
if (type) {
#ifdef QT_NO_SHAPE
#ifdef QT_NO_XSHAPE
return w;
#else // !QT_NO_SHAPE
#else // !QT_NO_XSHAPE
const QPoint relPos = pos - QPoint(attr.x,attr.y);
// When ShapeInput and ShapeBounding are not set they return a single rectangle with the geometry of the window, this is why we
// need an && here so that in the case one is set and the other is not we still get the correct result.
@ -1475,7 +1475,7 @@ Window findRealWindow(const QPoint & pos, Window w, int md, bool ignoreNonXdndAw
#endif
if (windowContainsMouse)
return w;
#endif // QT_NO_SHAPE
#endif // QT_NO_XSHAPE
}
}

View file

@ -91,13 +91,13 @@
#endif // Q_OS_VXWORKS
#include <X11/Xatom.h>
//#define QT_NO_SHAPE
#ifdef QT_NO_SHAPE
//#define QT_NO_XSHAPE
#ifdef QT_NO_XSHAPE
# define XShapeCombineRegion(a,b,c,d,e,f,g)
# define XShapeCombineMask(a,b,c,d,e,f,g)
#else
# include <X11/extensions/shape.h>
#endif // QT_NO_SHAPE
#endif // QT_NO_XSHAPE
#if !defined (QT_NO_TABLET)
@ -300,9 +300,9 @@ extern "C" char *XSetIMValues(XIM /* im */, ...);
#endif // X11R4
#ifndef QT_NO_MITSHM
#ifndef QT_NO_XSHM
# include <X11/extensions/XShm.h>
#endif // QT_NO_MITSHM
#endif // QT_NO_XSHM
QT_BEGIN_NAMESPACE

View file

@ -78,7 +78,7 @@ public:
#ifdef Q_WS_X11
GC gc;
#ifndef QT_NO_MITSHM
#ifndef QT_NO_XSHM
uint needsSync : 1;
#endif
#ifndef QT_NO_XRENDER
@ -97,7 +97,7 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurfa
d_ptr->translucentBackground = X11->use_xrender
&& window->x11Info().depth() == 32;
#endif
#ifndef QT_NO_MITSHM
#ifndef QT_NO_XSHM
d_ptr->needsSync = false;
#endif
#endif
@ -126,7 +126,7 @@ QPaintDevice *QRasterWindowSurface::paintDevice()
return &d_ptr->image->image;
}
#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#if defined(Q_WS_X11) && !defined(QT_NO_XSHM)
void QRasterWindowSurface::syncX()
{
// delay writing to the backbuffer until we know for sure X is done reading from it
@ -139,7 +139,7 @@ void QRasterWindowSurface::syncX()
void QRasterWindowSurface::beginPaint(const QRegion &rgn)
{
#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#if defined(Q_WS_X11) && !defined(QT_NO_XSHM)
syncX();
#endif
@ -242,7 +242,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
QRect br = rgn.boundingRect().translated(offset).intersected(clipRect);
QPoint wpos = br.topLeft() - widgetOffset;
#ifndef QT_NO_MITSHM
#ifndef QT_NO_XSHM
if (d_ptr->image->xshmpm) {
XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
br.x(), br.y(), br.width(), br.height(), wpos.x(), wpos.y());
@ -395,7 +395,7 @@ bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy)
if (!d->image || d->image->image.isNull())
return false;
#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#if defined(Q_WS_X11) && !defined(QT_NO_XSHM)
syncX();
#endif

View file

@ -119,7 +119,7 @@ public:
#endif // QT_MAC_USE_COCOA
private:
#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#if defined(Q_WS_X11) && !defined(QT_NO_XSHM)
void syncX();
#endif
void prepareBuffer(QImage::Format format, QWidget *widget);

View file

@ -206,9 +206,9 @@ extern "C" Bool XUnregisterIMInstantiateCallback(
#endif // X11R4
#ifndef QT_NO_MITSHM
#ifndef QT_NO_XSHM
# include <X11/extensions/XShm.h>
#endif // QT_NO_MITSHM
#endif // QT_NO_XSHM
// rename a couple of X defines to get rid of name clashes
// resolve the conflict between X11's FocusIn and QEvent::FocusIn