kinfocenter: fix build in x11-less environments

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
This commit is contained in:
Andreas Müller
2015-02-05 21:34:52 +01:00
parent 0c4d7d63a8
commit 9f0320c229
2 changed files with 123 additions and 0 deletions

View File

@@ -0,0 +1,121 @@
From 449bfd081227a01d726955efa3c4848e64fe6d4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
Date: Thu, 5 Feb 2015 21:15:54 +0100
Subject: [PATCH] fix build in x11-less environments
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
Modules/info/CMakeLists.txt | 3 +--
Modules/opengl/CMakeLists.txt | 5 ++++-
Modules/opengl/opengl.cpp | 13 +++++++++++--
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/Modules/info/CMakeLists.txt b/Modules/info/CMakeLists.txt
index b252022..141ecb7 100644
--- a/Modules/info/CMakeLists.txt
+++ b/Modules/info/CMakeLists.txt
@@ -22,8 +22,10 @@ target_link_libraries(kcm_info
KF5::KCMUtils
KF5::I18n
KF5::IconThemes
- KF5::KDELibs4Support
- ${X11_X11_LIB})
+ KF5::KDELibs4Support)
+if(HAVE_X11)
+target_link_libraries(kcm_info ${X11_X11_LIB})
+endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
target_link_libraries(kcm_info devinfo)
diff --git a/Modules/opengl/CMakeLists.txt b/Modules/opengl/CMakeLists.txt
index ab45779..2e05799 100644
--- a/Modules/opengl/CMakeLists.txt
+++ b/Modules/opengl/CMakeLists.txt
@@ -18,7 +18,10 @@ ki18n_wrap_ui(KCM_OPENGL_PART_UIS_H ${KCM_OPENGL_PART_UIS})
add_library(kcm_opengl MODULE ${KCM_OPENGL_PART_SRCS} ${KCM_OPENGL_PART_UIS_H})
-target_link_libraries(kcm_opengl KF5::KCMUtils KF5::I18n ${X11_X11_LIB})
+target_link_libraries(kcm_opengl KF5::KCMUtils KF5::I18n)
+if(HAVE_X11)
+target_link_libraries(kcm_opengl ${X11_X11_LIB})
+endif()
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
diff --git a/Modules/opengl/opengl.cpp b/Modules/opengl/opengl.cpp
index c87cde8..5df02e3 100644
--- a/Modules/opengl/opengl.cpp
+++ b/Modules/opengl/opengl.cpp
@@ -39,9 +39,12 @@
#include <KLocalizedString>
#include <kmessagebox.h>
+#include <config-X11.h>
+#if HAVE_X11
// X11 includes
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#endif
#include <openglconfig.h>
@@ -735,7 +738,8 @@ static QTreeWidgetItem *get_gl_info_glx(Display *dpy, int scrnum, Bool allowDire
}
#endif
-#if KCM_HAVE_EGL
+#if KCM_HAVE_EGL
+#if HAVE_X11
static QTreeWidgetItem *get_gl_info_egl(Display *dpy, int scrnum, QTreeWidgetItem *l1, QTreeWidgetItem *after)
{
Window win;
@@ -847,6 +851,7 @@ static QTreeWidgetItem *get_gl_info_egl(Display *dpy, int scrnum, QTreeWidgetIte
return result;
}
+#endif // HAVE_X11
static QTreeWidgetItem *get_gl_info_egl_qt(QTreeWidgetItem *l1, QTreeWidgetItem *after, QSurfaceFormat::OpenGLContextProfile profile, const QString &title)
{
@@ -894,7 +899,9 @@ bool GetInfo_OpenGL(QTreeWidget *treeWidget)
{
QTreeWidgetItem *l1, *l2 = NULL;
+#if HAVE_X11
static bool isX11 = QGuiApplication::platformName() == QStringLiteral("xcb");
+#endif
static bool isWayland = QGuiApplication::platformName().contains(QStringLiteral("wayland"));
QTreeWidgetItem *header = new QTreeWidgetItem();
@@ -906,6 +913,7 @@ bool GetInfo_OpenGL(QTreeWidget *treeWidget)
l1 = new QTreeWidgetItem(treeWidget);
+#if HAVE_X11
if (isX11) {
char *displayName = NULL;
Display *dpy;
@@ -936,7 +944,7 @@ bool GetInfo_OpenGL(QTreeWidget *treeWidget)
if (IsDirect) l2 = get_gl_info_glx(dpy, scrnum, false, l1, l2);
#endif
-#if KCM_HAVE_EGL
+#if KCM_HAVE_EGL && HAVE_X11
l2 = get_gl_info_egl(dpy, scrnum, l1, l2);
if (l2)
l2->setExpanded(true);
@@ -953,6 +961,7 @@ bool GetInfo_OpenGL(QTreeWidget *treeWidget)
#endif
XCloseDisplay(dpy);
}
+#endif
if (isWayland) {
l1->setText(0, i18n("Name of the Display"));
--
1.9.3

View File

@@ -38,6 +38,8 @@ PV = "${PLASMA_VERSION}"
SRC_URI[md5sum] = "45a9b78c78fd8a53018a28043b8b9634"
SRC_URI[sha256sum] = "89a976d2eb6aef02db02db82d645eacbf710f6e0c3ad9fdd932455c309a62e94"
SRC_URI += "file://0001-fix-build-in-x11-less-environments.patch"
FILES_${PN} += " \
${datadir}/kcmusb \
${datadir}/desktop-directories \