Ensure that we can build without X11 or XCB
* X11 is optional dependency * XCB is optional dependency * Qt::X11Extras is only found if both X11 and XCB are found * switch to HAVE_X11 instead of X11_FOUND in CMakeLists * remove/fix custom added definitions * use #if HAVE_X11 instead of #ifdef HAVE_X11 (that is always true) REVIEW: 115698
This commit is contained in:
parent
31e301174a
commit
bada0c97ba
@ -38,7 +38,7 @@ endif()
|
||||
set (QT_MIN_VERSION "5.2.0")
|
||||
set(KF5_VERSION "4.96.0")
|
||||
|
||||
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Quick X11Extras Sql UiTools Qml Widgets Svg Declarative Script Test PrintSupport)
|
||||
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Quick Sql UiTools Qml Widgets Svg Declarative Script Test PrintSupport)
|
||||
|
||||
find_package(KF5Activities ${KF5_VERSION} REQUIRED)
|
||||
find_package(KF5Archive ${KF5_VERSION} REQUIRED)
|
||||
@ -79,13 +79,18 @@ find_package(KF5XmlGui ${KF5_VERSION} REQUIRED)
|
||||
|
||||
#optional features
|
||||
find_package(X11 MODULE)
|
||||
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
|
||||
URL "http://www.x.org"
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
find_package(XCB MODULE COMPONENTS XCB COMPOSITE DAMAGE SHAPE)
|
||||
set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"
|
||||
URL "http://xcb.freedesktop.org"
|
||||
TYPE REQUIRED
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
if(X11_FOUND AND XCB_XCB_FOUND)
|
||||
set(HAVE_X11 1)
|
||||
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS X11Extras)
|
||||
#X11_Xrender discovery is done by FindX11
|
||||
add_feature_info("X Rendering Extension (libXrender)" X11_Xrender_FOUND "Support for compositing, rendering operations, and alpha-blending. STRONGLY RECOMMENDED")
|
||||
add_feature_info("X Screensaver Extension (libXss)" X11_Xscreensaver_FOUND "Support for KIdleTime (fallback mode)")
|
||||
|
@ -1,16 +1,19 @@
|
||||
project(corebindings)
|
||||
add_definitions(-DHAVE_X11=${HAVE_X11})
|
||||
if(XCB_XCB_FOUND AND XCB_COMPOSITE_FOUND AND XCB_DAMAGE_FOUND)
|
||||
if(HAVE_X11 AND XCB_XCB_FOUND AND XCB_COMPOSITE_FOUND AND XCB_DAMAGE_FOUND)
|
||||
add_definitions(-DHAVE_XCB_COMPOSITE=1)
|
||||
include_directories(
|
||||
${XCB_XCB_INCLUDE_DIR}
|
||||
${XCB_DAMAGE_INCLUDE_DIR}
|
||||
${XCB_COMPOSITE_INCLUDE_DIR}
|
||||
)
|
||||
else()
|
||||
add_definitions(-DHAVE_XCB_COMPOSITE=0)
|
||||
endif()
|
||||
if(XCB_XCB_FOUND AND XCB_SHAPE_FOUND)
|
||||
if(HAVE_X11 AND XCB_XCB_FOUND AND XCB_SHAPE_FOUND)
|
||||
add_definitions(-DHAVE_XCB_SHAPE=1)
|
||||
include_directories(${XCB_SHAPE_INCLUDE_DIR})
|
||||
else()
|
||||
add_definitions(-DHAVE_XCB_SHAPE=0)
|
||||
endif()
|
||||
|
||||
set(corebindings_SRCS
|
||||
@ -44,7 +47,7 @@ target_link_libraries(corebindingsplugin
|
||||
KF5::WindowSystem
|
||||
KF5::Plasma)
|
||||
|
||||
if(X11_FOUND)
|
||||
if(HAVE_X11)
|
||||
target_link_libraries(corebindingsplugin ${X11_LIBRARIES} ${XCB_XCB_LIBRARY} )
|
||||
target_link_libraries(corebindingsplugin Qt5::X11Extras)
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <config-plasma.h>
|
||||
#if HAVE_XCB_SHAPE
|
||||
#include <QX11Info>
|
||||
#include <xcb/shape.h>
|
||||
|
@ -21,8 +21,9 @@
|
||||
#include <QGlobalStatic>
|
||||
#include <QWindow>
|
||||
#include <QPainter>
|
||||
#include <config-plasma.h>
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
#include <QX11Info>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
@ -75,12 +76,12 @@ public:
|
||||
QPixmap m_emptyVerticalPix;
|
||||
QPixmap m_emptyHorizontalPix;
|
||||
|
||||
#if HAVE_X11
|
||||
//! xcb connection
|
||||
xcb_connection_t* _connection;
|
||||
|
||||
//! graphical context
|
||||
xcb_gcontext_t _gc;
|
||||
#if HAVE_X11
|
||||
bool m_isX11;
|
||||
#endif
|
||||
|
||||
@ -230,7 +231,7 @@ void DialogShadows::Private::initPixmap(const QString &element)
|
||||
|
||||
QPixmap DialogShadows::Private::initEmptyPixmap(const QSize &size)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return QPixmap();
|
||||
}
|
||||
@ -240,6 +241,7 @@ QPixmap DialogShadows::Private::initEmptyPixmap(const QSize &size)
|
||||
}
|
||||
return tempEmptyPix;
|
||||
#else
|
||||
Q_UNUSED(size)
|
||||
return QPixmap();
|
||||
#endif
|
||||
}
|
||||
@ -269,7 +271,7 @@ void DialogShadows::Private::setupPixmaps()
|
||||
|
||||
void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledBorders)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
@ -402,7 +404,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
|
||||
|
||||
void DialogShadows::Private::freeX11Pixmaps()
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
@ -441,7 +443,7 @@ void DialogShadows::Private::freeX11Pixmaps()
|
||||
|
||||
void DialogShadows::Private::clearPixmaps()
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
freeX11Pixmaps();
|
||||
|
||||
m_emptyCornerPix = QPixmap();
|
||||
@ -458,7 +460,7 @@ void DialogShadows::Private::clearPixmaps()
|
||||
|
||||
void DialogShadows::Private::updateShadow(const QWindow *window, Plasma::FrameSvg::EnabledBorders enabledBorders)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
@ -476,18 +478,23 @@ void DialogShadows::Private::updateShadow(const QWindow *window, Plasma::FrameSv
|
||||
//qDebug() << "going to set the shadow of" << window->winId() << "to" << data;
|
||||
XChangeProperty(dpy, window->winId(), atom, XA_CARDINAL, 32, PropModeReplace,
|
||||
reinterpret_cast<const unsigned char *>(data[enabledBorders].constData()), data[enabledBorders].size());
|
||||
#else
|
||||
Q_UNUSED(window)
|
||||
Q_UNUSED(enabledBorders)
|
||||
#endif
|
||||
}
|
||||
|
||||
void DialogShadows::Private::clearShadow(const QWindow *window)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
Display *dpy = QX11Info::display();
|
||||
Atom atom = XInternAtom(dpy, "_KDE_NET_WM_SHADOW", False);
|
||||
XDeleteProperty(dpy, window->winId(), atom);
|
||||
#else
|
||||
Q_UNUSED(window)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
|
||||
set(PLASMA_NO_PACKAGE_EXTRADATA TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT X11_FOUND)
|
||||
if(NOT HAVE_X11)
|
||||
set(PLASMA_NO_PACKAGEKIT TRUE)
|
||||
endif()
|
||||
|
||||
@ -87,7 +87,9 @@ set(Plasma_LIB_SRCS
|
||||
scripting/scriptengine.cpp
|
||||
)
|
||||
|
||||
set(Plasma_LIB_SRCS ${Plasma_LIB_SRCS} private/effectwatcher.cpp)
|
||||
if(HAVE_X11)
|
||||
set(Plasma_LIB_SRCS ${Plasma_LIB_SRCS} private/effectwatcher.cpp)
|
||||
endif()
|
||||
|
||||
kconfig_add_kcfg_files(Plasma_LIB_SRCS data/kconfigxt/libplasma-theme-global.kcfgc)
|
||||
|
||||
@ -103,7 +105,7 @@ kconfig_add_kcfg_files(Plasma_LIB_SRCS data/kconfigxt/libplasma-theme-global.kcf
|
||||
add_library(KF5Plasma ${Plasma_LIB_SRCS})
|
||||
add_library(KF5::Plasma ALIAS KF5Plasma)
|
||||
|
||||
if(X11_FOUND)
|
||||
if(HAVE_X11)
|
||||
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} Qt5::X11Extras ${X11_LIBRARIES} ${XCB_XCB_LIBRARY})
|
||||
endif()
|
||||
|
||||
|
@ -19,14 +19,12 @@
|
||||
|
||||
#include "private/componentinstaller_p.h"
|
||||
|
||||
#ifdef PLASMA_ENABLE_PACKAGEKIT_SUPPORT
|
||||
#include <QSet>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusPendingCall>
|
||||
#include <QWidget>
|
||||
#include <QLatin1String>
|
||||
#include <QStringList>
|
||||
#endif
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
@ -9,8 +9,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||
|
||||
add_definitions(-DHAVE_X11=${HAVE_X11})
|
||||
|
||||
find_package(Qt5Qml REQUIRED)
|
||||
find_package(Qt5Quick REQUIRED)
|
||||
find_package(Qt5Script REQUIRED)
|
||||
@ -70,7 +68,7 @@ target_link_libraries(plasma-shell
|
||||
)
|
||||
target_include_directories(plasma-shell PRIVATE "${CMAKE_BINARY_DIR}")
|
||||
|
||||
if(X11_FOUND)
|
||||
if(HAVE_X11)
|
||||
target_link_libraries(plasma-shell ${X11_LIBRARIES} ${XCB_XCB_LIBRARY} )
|
||||
target_link_libraries(plasma-shell Qt5::X11Extras)
|
||||
endif()
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <QWindow>
|
||||
#include <QPainter>
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#include <config-plasma.h>
|
||||
#if HAVE_X11
|
||||
#include <QX11Info>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
@ -74,12 +75,12 @@ public:
|
||||
QPixmap m_emptyVerticalPix;
|
||||
QPixmap m_emptyHorizontalPix;
|
||||
|
||||
#if HAVE_X11
|
||||
//! xcb connection
|
||||
xcb_connection_t* _connection;
|
||||
|
||||
//! graphical context
|
||||
xcb_gcontext_t _gc;
|
||||
#if HAVE_X11
|
||||
bool m_isX11;
|
||||
#endif
|
||||
|
||||
@ -229,7 +230,7 @@ void PanelShadows::Private::initPixmap(const QString &element)
|
||||
|
||||
QPixmap PanelShadows::Private::initEmptyPixmap(const QSize &size)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return QPixmap();
|
||||
}
|
||||
@ -239,6 +240,7 @@ QPixmap PanelShadows::Private::initEmptyPixmap(const QSize &size)
|
||||
}
|
||||
return tempEmptyPix;
|
||||
#else
|
||||
Q_UNUSED(size)
|
||||
return QPixmap();
|
||||
#endif
|
||||
}
|
||||
@ -268,7 +270,7 @@ void PanelShadows::Private::setupPixmaps()
|
||||
|
||||
void PanelShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledBorders)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
@ -401,7 +403,7 @@ void PanelShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledBo
|
||||
|
||||
void PanelShadows::Private::freeX11Pixmaps()
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
@ -440,7 +442,7 @@ void PanelShadows::Private::freeX11Pixmaps()
|
||||
|
||||
void PanelShadows::Private::clearPixmaps()
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
freeX11Pixmaps();
|
||||
|
||||
m_emptyCornerPix = QPixmap();
|
||||
@ -457,7 +459,7 @@ void PanelShadows::Private::clearPixmaps()
|
||||
|
||||
void PanelShadows::Private::updateShadow(const QWindow *window, Plasma::FrameSvg::EnabledBorders enabledBorders)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
@ -475,18 +477,23 @@ void PanelShadows::Private::updateShadow(const QWindow *window, Plasma::FrameSvg
|
||||
qDebug() << "going to set the shadow of" << window->winId() << "to" << data;
|
||||
XChangeProperty(dpy, window->winId(), atom, XA_CARDINAL, 32, PropModeReplace,
|
||||
reinterpret_cast<const unsigned char *>(data[enabledBorders].constData()), data[enabledBorders].size());
|
||||
#else
|
||||
Q_UNUSED(window)
|
||||
Q_UNUSED(enabledBorders)
|
||||
#endif
|
||||
}
|
||||
|
||||
void PanelShadows::Private::clearShadow(const QWindow *window)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
#if HAVE_X11
|
||||
if (!m_isX11) {
|
||||
return;
|
||||
}
|
||||
Display *dpy = QX11Info::display();
|
||||
Atom atom = XInternAtom(dpy, "_KDE_NET_WM_SHADOW", False);
|
||||
XDeleteProperty(dpy, window->winId(), atom);
|
||||
#else
|
||||
Q_UNUSED(window)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user