summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/kernel.pri7
-rw-r--r--src/gui/kernel/qguiapplication.cpp13
-rw-r--r--src/gui/kernel/qguiapplication_p.h5
-rw-r--r--src/gui/kernel/qinputdevicemanager.cpp64
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h77
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h69
6 files changed, 233 insertions, 2 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 6479acd3fc..41574fa0bb 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -74,7 +74,9 @@ HEADERS += \
kernel/qpaintdevicewindow_p.h \
kernel/qrasterwindow.h \
kernel/qplatformgraphicsbuffer.h \
- kernel/qplatformgraphicsbufferhelper.h
+ kernel/qplatformgraphicsbufferhelper.h \
+ kernel/qinputdevicemanager_p.h \
+ kernel/qinputdevicemanager_p_p.h
SOURCES += \
kernel/qgenericpluginfactory.cpp \
@@ -130,7 +132,8 @@ SOURCES += \
kernel/qrasterwindow.cpp \
kernel/qplatformgraphicsbuffer.cpp \
kernel/qplatformgraphicsbufferhelper.cpp \
- kernel/qplatformhardwarecompositor.cpp
+ kernel/qplatformhardwarecompositor.cpp \
+ kernel/qinputdevicemanager.cpp
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
HEADERS += \
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a2953259ff..23deb2c4b2 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -75,6 +75,7 @@
#include "private/qwindow_p.h"
#include "private/qcursor_p.h"
#include "private/qopenglcontext_p.h"
+#include "private/qinputdevicemanager_p.h"
#include "private/qdnd_p.h"
#include <qpa/qplatformthemefactory_p.h>
@@ -164,6 +165,8 @@ static QBasicMutex applicationFontMutex;
QFont *QGuiApplicationPrivate::app_font = 0;
bool QGuiApplicationPrivate::obey_desktop_settings = true;
+QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
+
static qreal fontSmoothingGamma = 1.7;
extern void qRegisterGuiVariant();
@@ -3470,6 +3473,16 @@ void QGuiApplicationPrivate::setMouseEventFlags(QMouseEvent *event, Qt::MouseEve
event->caps |= (value & Qt::MouseEventFlagMask) << MouseFlagsShift;
}
+QInputDeviceManager *QGuiApplicationPrivate::inputDeviceManager()
+{
+ Q_ASSERT(QGuiApplication::instance());
+
+ if (!m_inputDeviceManager)
+ m_inputDeviceManager = new QInputDeviceManager(QGuiApplication::instance());
+
+ return m_inputDeviceManager;
+}
+
#include "moc_qguiapplication.cpp"
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 8b444e1d34..471316d7ed 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -66,6 +66,7 @@ struct QDrawHelperGammaTables;
#ifndef QT_NO_DRAGANDDROP
class QDrag;
#endif // QT_NO_DRAGANDDROP
+class QInputDeviceManager;
class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
{
@@ -272,6 +273,8 @@ public:
static Qt::MouseEventSource wheelEventSource(const QWheelEvent *event);
+ static QInputDeviceManager *inputDeviceManager();
+
const QDrawHelperGammaTables *gammaTables();
// hook reimplemented in QApplication to apply the QStyle function on the QIcon
@@ -301,6 +304,8 @@ private:
QAtomicPointer<QDrawHelperGammaTables> m_gammaTables;
bool ownGlobalShareContext;
+
+ static QInputDeviceManager *m_inputDeviceManager;
};
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
new file mode 100644
index 0000000000..925a89c85b
--- /dev/null
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputdevicemanager_p.h"
+#include "qinputdevicemanager_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QInputDeviceManager::QInputDeviceManager(QObject *parent)
+ : QObject(*new QInputDeviceManagerPrivate, parent)
+{
+}
+
+int QInputDeviceManager::deviceCount(DeviceType type) const
+{
+ Q_D(const QInputDeviceManager);
+ return d->deviceCount(type);
+}
+
+int QInputDeviceManagerPrivate::deviceCount(QInputDeviceManager::DeviceType type) const
+{
+ return m_deviceCount.value(type);
+}
+
+void QInputDeviceManagerPrivate::setDeviceCount(QInputDeviceManager::DeviceType type, int count)
+{
+ Q_Q(QInputDeviceManager);
+ if (m_deviceCount.value(type) != count) {
+ m_deviceCount[type] = count;
+ emit q->deviceListChanged(type);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
new file mode 100644
index 0000000000..ca334e4645
--- /dev/null
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QINPUTDEVICEMANAGER_P_H
+#define QINPUTDEVICEMANAGER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+
+QT_BEGIN_NAMESPACE
+
+class QInputDeviceManagerPrivate;
+
+class Q_GUI_EXPORT QInputDeviceManager : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QInputDeviceManager)
+
+public:
+ enum DeviceType {
+ DeviceTypeUnknown,
+ DeviceTypePointer,
+ DeviceTypeKeyboard,
+ DeviceTypeTouch
+ };
+
+ QInputDeviceManager(QObject *parent = 0);
+
+ int deviceCount(DeviceType type) const;
+
+signals:
+ void deviceListChanged(DeviceType type);
+};
+
+QT_END_NAMESPACE
+
+#endif // QINPUTDEVICEMANAGER_P_H
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
new file mode 100644
index 0000000000..7583fbe030
--- /dev/null
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QINPUTDEVICEMANAGER_P_P_H
+#define QINPUTDEVICEMANAGER_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qmap.h>
+#include <private/qobject_p.h>
+#include "qinputdevicemanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QInputDeviceManagerPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QInputDeviceManager)
+
+public:
+ static QInputDeviceManagerPrivate *get(QInputDeviceManager *mgr) { return mgr->d_func(); }
+
+ int deviceCount(QInputDeviceManager::DeviceType type) const;
+ void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
+
+ QMap<QInputDeviceManager::DeviceType, int> m_deviceCount;
+};
+
+QT_END_NAMESPACE
+
+#endif // QINPUTDEVICEMANAGER_P_P_H