132QInputDevice::QInputDevice(
const QString &name, qint64 id, QInputDevice::DeviceType type,
133 const QString &seatName, QObject *parent)
134 : QObject(*
new QInputDevicePrivate(name, id, type, QInputDevice::Capability::None, seatName), parent)
290QStringList QInputDevice::seatNames()
292 QMutexLocker locker(&devicesMutex);
293 const InputDevicesList devices = *deviceList();
296 for (
const QInputDevice *d : devices) {
297 if (!result.contains(d->seatName()))
298 result.append(d->seatName());
307const QInputDevice *QInputDevice::primaryKeyboard(
const QString& seatName)
309 QMutexLocker locker(&devicesMutex);
310 const InputDevicesList devices = *deviceList();
312 const QInputDevice *ret =
nullptr;
313 for (
const QInputDevice *d : devices) {
314 if (d->type() != DeviceType::Keyboard)
316 if (seatName.isNull() || d->seatName() == seatName) {
318 if (!d->parent() || !qobject_cast<
const QInputDevice *>(d->parent()))
325 qCDebug(lcQpaInputDevices) <<
"no keyboards registered for seat" << seatName
326 <<
"The platform plugin should have provided one via "
327 "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
328 ret =
new QInputDevice(
"core keyboard"_L1, 0, DeviceType::Keyboard, seatName, QCoreApplication::instance());
329 QInputDevicePrivate::registerDevice(ret);
332 qWarning() <<
"core keyboard ambiguous for seat" << seatName;
386void QInputDevicePrivate::unregisterDevice(
const QInputDevice *dev)
388 if (deviceList.isDestroyed())
391 QMutexLocker lock(&devicesMutex);
392 deviceList()->removeOne(dev);
393 qCInfo(lcQpaInputDevices) <<
"Unregistered" << dev;
402QDebug operator<<(QDebug debug,
const QInputDevice *device)
404 QDebugStateSaver saver(debug);
408 debug <<
"QInputDevice(";
410 return debug <<
"0x0)";
412 const QInputDevicePrivate *d = QInputDevicePrivate::get(device);
414 if (d->pointingDeviceType)
415 return operator<<(debug,
static_cast<
const QPointingDevice *>(device));
417 debug <<
"QInputDevice(";
418 debug <<
'"' << device->name() <<
"\", type=" << device->type()
419 <<
", ID=" << device->systemId() <<
", seat='" << device->seatName() <<
"'";