Verified Commit 9bd91e66 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

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
parent 3e9f33bb
......@@ -293,7 +293,6 @@ set_package_properties(hwdata PROPERTIES
PURPOSE "Runtime-only dependency needed for mapping monitor hardware vendor IDs to full names"
URL "https://github.com/vcrhonek/hwdata"
)
set(HAVE_HWDATA ${hwdata_FOUND})
include(ECMQMLModules)
ecm_find_qmlmodule(QtQuick 2.3)
......
......@@ -34,7 +34,7 @@
if (UNIX AND NOT APPLE)
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)
if (hwdata_DIR-NOTFOUND OR hwdata_PNPIDS_FILE-NOTFOUND)
if (NOT hwdata_DIR OR NOT hwdata_PNPIDS_FILE)
set(hwdata_FOUND FALSE)
else()
set(hwdata_FOUND TRUE)
......
......@@ -25,7 +25,6 @@
#cmakedefine01 HAVE_BREEZE_DECO
#cmakedefine01 HAVE_LIBCAP
#cmakedefine01 HAVE_SCHED_RESET_ON_FORK
#cmakedefine01 HAVE_HWDATA
#if HAVE_BREEZE_DECO
#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}"
#endif
......@@ -42,7 +41,3 @@
#define XCB_ICCCM_WM_STATE_NORMAL 1
#define XCB_ICCCM_WM_STATE_ICONIC 3
#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 <QFile>
#include <QStandardPaths>
namespace KWin
{
......@@ -142,11 +143,10 @@ static QByteArray parseSerialNumber(const uint8_t *data)
static QByteArray parseVendor(const uint8_t *data)
{
#if HAVE_HWDATA
const auto pnpId = parsePnpId(data);
// 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)) {
while (!pnpFile.atEnd()) {
const auto line = pnpFile.readLine();
......@@ -155,9 +155,7 @@ static QByteArray parseVendor(const uint8_t *data)
}
}
}
#else
Q_UNUSED(data)
#endif
return {};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment