Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qinputdevicemanager.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
9 | ** Commercial License Usage | - | ||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||
16 | ** | - | ||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
25 | ** | - | ||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
29 | ** | - | ||||||
30 | ** $QT_END_LICENSE$ | - | ||||||
31 | ** | - | ||||||
32 | ****************************************************************************/ | - | ||||||
33 | - | |||||||
34 | #include "qinputdevicemanager_p.h" | - | ||||||
35 | #include "qinputdevicemanager_p_p.h" | - | ||||||
36 | - | |||||||
37 | QT_BEGIN_NAMESPACE | - | ||||||
38 | - | |||||||
39 | /*! | - | ||||||
40 | \class QInputDeviceManager | - | ||||||
41 | \internal | - | ||||||
42 | - | |||||||
43 | \brief QInputDeviceManager acts as a communication hub between QtGui and the input handlers. | - | ||||||
44 | - | |||||||
45 | On embedded platforms the input handling code is either compiled into the platform | - | ||||||
46 | plugin or is loaded dynamically as a generic plugin without any interface. The input | - | ||||||
47 | handler in use may also change between each run (e.g. evdevmouse/keyboard/touch | - | ||||||
48 | vs. libinput). QWindowSystemInterface is too limiting when Qt (the platform plugin) is | - | ||||||
49 | acting as a windowing system, and is one way only. | - | ||||||
50 | - | |||||||
51 | QInputDeviceManager solves this by providing a global object that is used to communicate | - | ||||||
52 | from the input handlers to the rest of Qt (e.g. the number of connected mice, which may | - | ||||||
53 | be important information for the cursor drawing code), and vice-versa (e.g. to indicate | - | ||||||
54 | to the input handler that a manual cursor position change was requested by the | - | ||||||
55 | application via QCursor::setPos and thus any internal state has to be updated accordingly). | - | ||||||
56 | */ | - | ||||||
57 | - | |||||||
58 | QInputDeviceManager::QInputDeviceManager(QObject *parent) | - | ||||||
59 | : QObject(*new QInputDeviceManagerPrivate, parent) | - | ||||||
60 | { | - | ||||||
61 | qRegisterMetaType<DeviceType>(); | - | ||||||
62 | } never executed: end of block | 0 | ||||||
63 | - | |||||||
64 | int QInputDeviceManager::deviceCount(DeviceType type) const | - | ||||||
65 | { | - | ||||||
66 | Q_D(const QInputDeviceManager); | - | ||||||
67 | return d->deviceCount(type); never executed: return d->deviceCount(type); | 0 | ||||||
68 | } | - | ||||||
69 | - | |||||||
70 | int QInputDeviceManagerPrivate::deviceCount(QInputDeviceManager::DeviceType type) const | - | ||||||
71 | { | - | ||||||
72 | return m_deviceCount.value(type); never executed: return m_deviceCount.value(type); | 0 | ||||||
73 | } | - | ||||||
74 | - | |||||||
75 | void QInputDeviceManagerPrivate::setDeviceCount(QInputDeviceManager::DeviceType type, int count) | - | ||||||
76 | { | - | ||||||
77 | Q_Q(QInputDeviceManager); | - | ||||||
78 | if (m_deviceCount.value(type) != count) {
| 0 | ||||||
79 | m_deviceCount[type] = count; | - | ||||||
80 | emit q->deviceListChanged(type); | - | ||||||
81 | } never executed: end of block | 0 | ||||||
82 | } never executed: end of block | 0 | ||||||
83 | - | |||||||
84 | void QInputDeviceManager::setCursorPos(const QPoint &pos) | - | ||||||
85 | { | - | ||||||
86 | emit cursorPositionChangeRequested(pos); | - | ||||||
87 | } never executed: end of block | 0 | ||||||
88 | - | |||||||
89 | QT_END_NAMESPACE | - | ||||||
Source code | Switch to Preprocessed file |