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)
284QStringList QInputDevice::seatNames()
286 QMutexLocker locker(&devicesMutex);
287 const InputDevicesList devices = *deviceList();
290 for (
const QInputDevice *d : devices) {
291 if (!result.contains(d->seatName()))
292 result.append(d->seatName());
301const QInputDevice *QInputDevice::primaryKeyboard(
const QString& seatName)
303 QMutexLocker locker(&devicesMutex);
304 const InputDevicesList devices = *deviceList();
306 const QInputDevice *ret =
nullptr;
307 for (
const QInputDevice *d : devices) {
308 if (d->type() != DeviceType::Keyboard)
310 if (seatName.isNull() || d->seatName() == seatName) {
312 if (!d->parent() || !qobject_cast<
const QInputDevice *>(d->parent()))
319 qCDebug(lcQpaInputDevices) <<
"no keyboards registered for seat" << seatName
320 <<
"The platform plugin should have provided one via "
321 "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
322 ret =
new QInputDevice(
"core keyboard"_L1, 0, DeviceType::Keyboard, seatName, QCoreApplication::instance());
323 QInputDevicePrivate::registerDevice(ret);
326 qWarning() <<
"core keyboard ambiguous for seat" << seatName;
380void QInputDevicePrivate::unregisterDevice(
const QInputDevice *dev)
382 if (deviceList.isDestroyed())
385 QMutexLocker lock(&devicesMutex);
386 deviceList()->removeOne(dev);
387 qCInfo(lcQpaInputDevices) <<
"Unregistered" << dev;
396QDebug operator<<(QDebug debug,
const QInputDevice *device)
398 QDebugStateSaver saver(debug);
402 debug <<
"QInputDevice(";
404 return debug <<
"0x0)";
406 const QInputDevicePrivate *d = QInputDevicePrivate::get(device);
408 if (d->pointingDeviceType)
409 return operator<<(debug,
static_cast<
const QPointingDevice *>(device));
411 debug <<
"QInputDevice(";
412 debug <<
'"' << device->name() <<
"\", type=" << device->type()
413 <<
", ID=" << device->systemId() <<
", seat='" << device->seatName() <<
"'";