forked from mirrors/nixpkgs
131 lines
5.3 KiB
Diff
131 lines
5.3 KiB
Diff
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index 460022f..422a708 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -1,5 +1,7 @@
|
|
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES})
|
|
|
|
+configure_file(config-libkscreen.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-libkscreen.h)
|
|
+
|
|
set(libkscreen_SRCS
|
|
backendloader.cpp
|
|
config.cpp
|
|
diff --git a/src/backendloader.cpp b/src/backendloader.cpp
|
|
index b93e469..8aebc14 100644
|
|
--- a/src/backendloader.cpp
|
|
+++ b/src/backendloader.cpp
|
|
@@ -16,6 +16,7 @@
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
*************************************************************************************/
|
|
|
|
+#include "config-libkscreen.h"
|
|
#include "backendloader.h"
|
|
#include "debug_p.h"
|
|
#include "backends/abstractbackend.h"
|
|
@@ -40,55 +41,54 @@ bool BackendLoader::init()
|
|
const QString backend = qgetenv("KSCREEN_BACKEND").constData();
|
|
const QString backendFilter = QString::fromLatin1("KSC_%1*").arg(backend);
|
|
|
|
- const QStringList paths = QCoreApplication::libraryPaths();
|
|
- Q_FOREACH (const QString &path, paths) {
|
|
- const QDir dir(path + QDir::separator() + QLatin1String("/kf5/kscreen/"),
|
|
- backendFilter,
|
|
- QDir::SortFlags(QDir::QDir::NoSort),
|
|
- QDir::NoDotAndDotDot | QDir::Files);
|
|
- const QFileInfoList finfos = dir.entryInfoList();
|
|
- Q_FOREACH (const QFileInfo &finfo, finfos) {
|
|
- // Skip "Fake" backend unless explicitly specified via KSCREEN_BACKEND
|
|
- if (backend.isEmpty() && finfo.fileName().contains(QLatin1String("KSC_Fake"))) {
|
|
- continue;
|
|
- }
|
|
+ QString path = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" PLUGIN_INSTALL_DIR "/");
|
|
|
|
- // When on X11, skip the QScreen backend, instead use the XRandR backend,
|
|
- // if not specified in KSCREEN_BACKEND
|
|
- if (backend.isEmpty() &&
|
|
- finfo.fileName().contains(QLatin1String("KSC_QScreen")) &&
|
|
- QX11Info::isPlatformX11()) {
|
|
- continue;
|
|
- }
|
|
+ const QDir dir(path + QDir::separator() + QLatin1String("/kf5/kscreen/"),
|
|
+ backendFilter,
|
|
+ QDir::SortFlags(QDir::QDir::NoSort),
|
|
+ QDir::NoDotAndDotDot | QDir::Files);
|
|
+ const QFileInfoList finfos = dir.entryInfoList();
|
|
+ Q_FOREACH (const QFileInfo &finfo, finfos) {
|
|
+ // Skip "Fake" backend unless explicitly specified via KSCREEN_BACKEND
|
|
+ if (backend.isEmpty() && finfo.fileName().contains(QLatin1String("KSC_Fake"))) {
|
|
+ continue;
|
|
+ }
|
|
|
|
- // When not on X11, skip the XRandR backend, and fall back to QSCreen
|
|
- // if not specified in KSCREEN_BACKEND
|
|
- if (backend.isEmpty() &&
|
|
- finfo.fileName().contains(QLatin1String("KSC_XRandR")) &&
|
|
- !QX11Info::isPlatformX11()) {
|
|
- continue;
|
|
- }
|
|
+ // When on X11, skip the QScreen backend, instead use the XRandR backend,
|
|
+ // if not specified in KSCREEN_BACKEND
|
|
+ if (backend.isEmpty() &&
|
|
+ finfo.fileName().contains(QLatin1String("KSC_QScreen")) &&
|
|
+ QX11Info::isPlatformX11()) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ // When not on X11, skip the XRandR backend, and fall back to QSCreen
|
|
+ // if not specified in KSCREEN_BACKEND
|
|
+ if (backend.isEmpty() &&
|
|
+ finfo.fileName().contains(QLatin1String("KSC_XRandR")) &&
|
|
+ !QX11Info::isPlatformX11()) {
|
|
+ continue;
|
|
+ }
|
|
|
|
- QPluginLoader loader(finfo.filePath());
|
|
- loader.load();
|
|
- QObject *instance = loader.instance();
|
|
- if (!instance) {
|
|
+ QPluginLoader loader(finfo.filePath());
|
|
+ loader.load();
|
|
+ QObject *instance = loader.instance();
|
|
+ if (!instance) {
|
|
+ loader.unload();
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ s_backend = qobject_cast< AbstractBackend* >(instance);
|
|
+ if (s_backend) {
|
|
+ if (!s_backend->isValid()) {
|
|
+ qCDebug(KSCREEN) << "Skipping" << s_backend->name() << "backend";
|
|
+ delete s_backend;
|
|
+ s_backend = 0;
|
|
loader.unload();
|
|
continue;
|
|
}
|
|
-
|
|
- s_backend = qobject_cast< AbstractBackend* >(instance);
|
|
- if (s_backend) {
|
|
- if (!s_backend->isValid()) {
|
|
- qCDebug(KSCREEN) << "Skipping" << s_backend->name() << "backend";
|
|
- delete s_backend;
|
|
- s_backend = 0;
|
|
- loader.unload();
|
|
- continue;
|
|
- }
|
|
- qCDebug(KSCREEN) << "Loading" << s_backend->name() << "backend";
|
|
- return true;
|
|
- }
|
|
+ qCDebug(KSCREEN) << "Loading" << s_backend->name() << "backend";
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
diff --git a/src/config-libkscreen.h.cmake b/src/config-libkscreen.h.cmake
|
|
new file mode 100644
|
|
index 0000000..a99f3d1
|
|
--- /dev/null
|
|
+++ b/src/config-libkscreen.h.cmake
|
|
@@ -0,0 +1,2 @@
|
|
+#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
|
+#define PLUGIN_INSTALL_DIR "${PLUGIN_INSTALL_DIR}"
|