Replace "no devices registered" warnings with qCDebug

The idea was to keep nagging us to update all the platform plugins to
do device registration. But besides being annoying, it would cause
test failures if we start adding QTest::ignoreMessage() all over,
and then some platforms start doing device registration properly.

Change-Id: Ia0fbb64cf86f33532be032ec9eebe6e4ad607f20
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Shawn Rutledge 2020-06-22 11:08:14 +02:00
parent 4a12757e5d
commit 29d3e7ce38
3 changed files with 12 additions and 13 deletions

View File

@ -41,11 +41,14 @@
#include "qinputdevice_p.h" #include "qinputdevice_p.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QLoggingCategory>
#include <QMutex> #include <QMutex>
#include <QScreen> #include <QScreen>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcQpaInputDevices)
/*! /*!
\class QInputDevice \class QInputDevice
\brief The QInputDevice class describes a device from which a QInputEvent originates. \brief The QInputDevice class describes a device from which a QInputEvent originates.
@ -208,9 +211,9 @@ const QInputDevice *QInputDevice::primaryKeyboard(const QString& seatName)
} }
} }
if (!ret) { if (!ret) {
qWarning() << "no keyboards registered for seat" << seatName qCDebug(lcQpaInputDevices) << "no keyboards registered for seat" << seatName
<< "The platform plugin should have provided one via " << "The platform plugin should have provided one via "
"QWindowSystemInterface::registerInputDevice(). Creating a default one for now."; "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
ret = new QInputDevice(QLatin1String("core keyboard"), 0, DeviceType::Keyboard, seatName); ret = new QInputDevice(QLatin1String("core keyboard"), 0, DeviceType::Keyboard, seatName);
QInputDevicePrivate::registerDevice(ret); QInputDevicePrivate::registerDevice(ret);
return ret; return ret;

View File

@ -328,9 +328,9 @@ const QPointingDevice *QPointingDevice::primaryPointingDevice(const QString& sea
} }
} }
if (!mouse && !touchpad) { if (!mouse && !touchpad) {
qWarning() << "no mouse-like devices registered for seat" << seatName qCDebug(lcQpaInputDevices) << "no mouse-like devices registered for seat" << seatName
<< "The platform plugin should have provided one via " << "The platform plugin should have provided one via "
"QWindowSystemInterface::registerInputDevice(). Creating a default mouse for now."; "QWindowSystemInterface::registerInputDevice(). Creating a default mouse for now.";
mouse = new QPointingDevice(QLatin1String("core pointer"), 1, DeviceType::Mouse, mouse = new QPointingDevice(QLatin1String("core pointer"), 1, DeviceType::Mouse,
PointerType::Generic, Capability::Position, 1, 3, seatName); PointerType::Generic, Capability::Position, 1, 3, seatName);
QInputDevicePrivate::registerDevice(mouse); QInputDevicePrivate::registerDevice(mouse);
@ -372,9 +372,9 @@ const QPointingDevice *QPointingDevice::tabletDevice(QInputDevice::DeviceType de
return pdev; return pdev;
} }
} }
qWarning() << "failed to find registered tablet device" << deviceType << pointerType << Qt::hex << uniqueId.numericId() qCDebug(lcQpaInputDevices) << "failed to find registered tablet device" << deviceType << pointerType << Qt::hex << uniqueId.numericId()
<< "The platform plugin should have provided one via " << "The platform plugin should have provided one via "
"QWindowSystemInterface::registerInputDevice(). Creating a default one for now."; "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
QPointingDevice *dev = new QPointingDevice(QLatin1String("fake tablet"), 2, deviceType, pointerType, QPointingDevice *dev = new QPointingDevice(QLatin1String("fake tablet"), 2, deviceType, pointerType,
QInputDevice::Capability::Position | QInputDevice::Capability::Pressure, QInputDevice::Capability::Position | QInputDevice::Capability::Pressure,
1, 1, QString(), uniqueId); 1, 1, QString(), uniqueId);

View File

@ -64,10 +64,6 @@ void tst_QInputDevice::multiSeatDevices()
QVERIFY(QInputDevicePrivate::fromId(1010)->hasCapability(QInputDevice::Capability::Scroll)); QVERIFY(QInputDevicePrivate::fromId(1010)->hasCapability(QInputDevice::Capability::Scroll));
QVERIFY(QInputDevicePrivate::fromId(2010)); QVERIFY(QInputDevicePrivate::fromId(2010));
QVERIFY(!QInputDevicePrivate::fromId(2010)->hasCapability(QInputDevice::Capability::Scroll)); QVERIFY(!QInputDevicePrivate::fromId(2010)->hasCapability(QInputDevice::Capability::Scroll));
QTest::ignoreMessage(QtWarningMsg, "no keyboards registered for seat \"\" The platform plugin should have provided one via "
"QWindowSystemInterface::registerInputDevice(). Creating a default one for now.");
QTest::ignoreMessage(QtWarningMsg, "no mouse-like devices registered for seat \"\" The platform plugin should have provided one via "
"QWindowSystemInterface::registerInputDevice(). Creating a default mouse for now.");
QVERIFY(QInputDevice::primaryKeyboard()); QVERIFY(QInputDevice::primaryKeyboard());
QCOMPARE(QInputDevice::primaryKeyboard()->id(), 0); QCOMPARE(QInputDevice::primaryKeyboard()->id(), 0);
QVERIFY(QPointingDevice::primaryPointingDevice()); QVERIFY(QPointingDevice::primaryPointingDevice());