fix: make hwdata truly a runtime dependency

Summary: Followup to comments in D10041

Reviewers: #plasma, ngraham, davidedmundson, zzag

Reviewed By: #plasma, ngraham, davidedmundson, zzag

Subscribers: iasensio, wstephenson, davidedmundson, zzag, ngraham, kwin, cgiboudeaux

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27729
master
Daniel Vrátil 5 years ago
parent 3e9f33bb3e
commit 9bd91e66cd
No known key found for this signature in database
GPG Key ID: 4D69557AECB13683

@ -293,7 +293,6 @@ set_package_properties(hwdata PROPERTIES
PURPOSE "Runtime-only dependency needed for mapping monitor hardware vendor IDs to full names" PURPOSE "Runtime-only dependency needed for mapping monitor hardware vendor IDs to full names"
URL "https://github.com/vcrhonek/hwdata" URL "https://github.com/vcrhonek/hwdata"
) )
set(HAVE_HWDATA ${hwdata_FOUND})
include(ECMQMLModules) include(ECMQMLModules)
ecm_find_qmlmodule(QtQuick 2.3) ecm_find_qmlmodule(QtQuick 2.3)

@ -34,7 +34,7 @@
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
find_path(hwdata_DIR NAMES hwdata/pnp.ids HINTS /usr/share ENV XDG_DATA_DIRS) find_path(hwdata_DIR NAMES hwdata/pnp.ids HINTS /usr/share ENV XDG_DATA_DIRS)
find_file(hwdata_PNPIDS_FILE NAMES hwdata/pnp.ids HINTS /usr/share) find_file(hwdata_PNPIDS_FILE NAMES hwdata/pnp.ids HINTS /usr/share)
if (hwdata_DIR-NOTFOUND OR hwdata_PNPIDS_FILE-NOTFOUND) if (NOT hwdata_DIR OR NOT hwdata_PNPIDS_FILE)
set(hwdata_FOUND FALSE) set(hwdata_FOUND FALSE)
else() else()
set(hwdata_FOUND TRUE) set(hwdata_FOUND TRUE)

@ -25,7 +25,6 @@
#cmakedefine01 HAVE_BREEZE_DECO #cmakedefine01 HAVE_BREEZE_DECO
#cmakedefine01 HAVE_LIBCAP #cmakedefine01 HAVE_LIBCAP
#cmakedefine01 HAVE_SCHED_RESET_ON_FORK #cmakedefine01 HAVE_SCHED_RESET_ON_FORK
#cmakedefine01 HAVE_HWDATA
#if HAVE_BREEZE_DECO #if HAVE_BREEZE_DECO
#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}" #define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}"
#endif #endif
@ -42,7 +41,3 @@
#define XCB_ICCCM_WM_STATE_NORMAL 1 #define XCB_ICCCM_WM_STATE_NORMAL 1
#define XCB_ICCCM_WM_STATE_ICONIC 3 #define XCB_ICCCM_WM_STATE_ICONIC 3
#endif #endif
#if HAVE_HWDATA
#cmakedefine HWDATA_PNPIDS_FILE "@hwdata_PNPIDS_FILE@"
#endif

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config-kwin.h" #include "config-kwin.h"
#include <QFile> #include <QFile>
#include <QStandardPaths>
namespace KWin namespace KWin
{ {
@ -142,11 +143,10 @@ static QByteArray parseSerialNumber(const uint8_t *data)
static QByteArray parseVendor(const uint8_t *data) static QByteArray parseVendor(const uint8_t *data)
{ {
#if HAVE_HWDATA
const auto pnpId = parsePnpId(data); const auto pnpId = parsePnpId(data);
// Map to vendor name // Map to vendor name
QFile pnpFile(QStringLiteral(HWDATA_PNPIDS_FILE)); QFile pnpFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("hwdata/pnp.ids")));
if (pnpFile.exists() && pnpFile.open(QIODevice::ReadOnly)) { if (pnpFile.exists() && pnpFile.open(QIODevice::ReadOnly)) {
while (!pnpFile.atEnd()) { while (!pnpFile.atEnd()) {
const auto line = pnpFile.readLine(); const auto line = pnpFile.readLine();
@ -155,9 +155,7 @@ static QByteArray parseVendor(const uint8_t *data)
} }
} }
} }
#else
Q_UNUSED(data)
#endif
return {}; return {};
} }

Loading…
Cancel
Save