131QInputDevice::QInputDevice(
const QString &name, qint64 id, QInputDevice::DeviceType type,
132 const QString &seatName, QObject *parent)
133 : QObject(*
new QInputDevicePrivate(name, id, type, QInputDevice::Capability::None, seatName), parent)
289QStringList QInputDevice::seatNames()
291 QMutexLocker locker(&devicesMutex);
292 const InputDevicesList devices = *deviceList();
295 for (
const QInputDevice *d : devices) {
296 if (!result.contains(d->seatName()))
297 result.append(d->seatName());
306const QInputDevice *QInputDevice::primaryKeyboard(
const QString& seatName)
308 QMutexLocker locker(&devicesMutex);
309 const InputDevicesList devices = *deviceList();
311 const QInputDevice *ret =
nullptr;
312 for (
const QInputDevice *d : devices) {
313 if (d->type() != DeviceType::Keyboard)
315 if (seatName.isNull() || d->seatName() == seatName) {
317 if (!d->parent() || !qobject_cast<
const QInputDevice *>(d->parent()))
324 qCDebug(lcQpaInputDevices) <<
"no keyboards registered for seat" << seatName
325 <<
"The platform plugin should have provided one via "
326 "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
327 ret =
new QInputDevice(
"core keyboard"_L1, 0, DeviceType::Keyboard, seatName, QCoreApplication::instance());
328 QInputDevicePrivate::registerDevice(ret);
331 qWarning() <<
"core keyboard ambiguous for seat" << seatName;
385void QInputDevicePrivate::unregisterDevice(
const QInputDevice *dev)
387 if (deviceList.isDestroyed())
390 QMutexLocker lock(&devicesMutex);
391 deviceList()->removeOne(dev);
392 qCInfo(lcQpaInputDevices) <<
"Unregistered" << dev;
401QDebug operator<<(QDebug debug,
const QInputDevice *device)
403 QDebugStateSaver saver(debug);
407 debug <<
"QInputDevice(";
409 return debug <<
"0x0)";
411 const QInputDevicePrivate *d = QInputDevicePrivate::get(device);
413 if (d->pointingDeviceType)
414 return operator<<(debug,
static_cast<
const QPointingDevice *>(device));
416 debug <<
"QInputDevice(";
417 debug <<
'"' << device->name() <<
"\", type=" << device->type()
418 <<
", ID=" << device->systemId() <<
", seat='" << device->seatName() <<
"'";