7#include <QGuiApplication>
8#include <qpa/qwindowsysteminterface.h>
9#include <device/hiddriver.h>
10#include <private/qguiapplication_p.h>
11#include <private/qinputdevicemanager_p_p.h>
17 static const Value ActivityPriority = 2;
23 CheckSuccess(CreateActivity(CurrentTask(), ActivityPriority,
false, (Value)
this, &
act));
27 CheckSuccess(CloseActivity(
act));
37 : driver(hidd),
handle(hidh), currentPos(0, 0) { }
40 CheckSuccess(gh_hid_close(
handle));
50 Qt::MouseButtons buttons;
76 gh_hid_wait_for_new_device(driver,
act);
82 uintptr_t devicecontext;
90 err = gh_hid_enum_devices(driver, &device_id, &devicecontext);
91 if (err == OperationNotImplemented)
93 else if (err == Failure)
95 if (!
devices.contains(device_id)) {
96 err = gh_hid_init_device(driver, device_id, &
handle);
99 devices.insert(device_id, hidnot);
106 if (err == OperationNotImplemented) {
112 if (!
devices.contains(device_id)) {
113 err = gh_hid_init_device(driver, device_id, &
handle);
117 devices.insert(device_id, hidnot);
131 uint32_t num_events = 1;
134 if (
event.type == HID_TYPE_AXIS) {
135 switch (
event.index) {
143 currentPos.
setX(currentPos.
x() +
event.value);
146 currentPos.
setY(currentPos.
y() +
event.value);
152 }
else if (
event.type == HID_TYPE_KEY) {
153 switch (
event.index) {
154 case HID_BUTTON_LEFT:
158 buttons &=
~Qt::LeftButton;
160 case HID_BUTTON_MIDDLE:
164 buttons &=
~Qt::MiddleButton;
166 case HID_BUTTON_RIGHT:
170 buttons &=
~Qt::RightButton;
176 }
else if (
event.type == HID_TYPE_SYNC) {
179 }
else if (
event.type == HID_TYPE_DISCONNECT) {
188 CheckSuccess(gh_hid_async_wait_for_event(
handle,
act));
191void QIntegrityHIDManager::open_devices()
210 WaitForActivity((Value *)&
notifier);
DarwinBluetooth::LECBManagerNotifier * notifier
void process_event(void) override
HIDDeviceHandler(HIDDriver *hidd, HIDHandle hidh)
HIDHandle get_handle(void)
HIDDriver * get_driver(void)
void async_wait(void) override
void process_event(void) override
HIDDriverHandler(HIDDriver *hidd)
void async_wait(void) override
virtual void process_event()=0
virtual void async_wait()=0
static QInputDeviceManager * inputDeviceManager()
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent=nullptr)
void append(parameter_type t)
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr void setY(int y) noexcept
Sets the y coordinate of this point to the given y coordinate.
constexpr int y() const noexcept
Returns the y coordinate of this point.
constexpr void setX(int x) noexcept
Sets the x coordinate of this point to the given x coordinate.
\macro QT_RESTRICTED_CAST_FROM_ASCII
void start(Priority=InheritPriority)
static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods=Qt::NoModifier, Qt::MouseEventSource source=Qt::MouseEventNotSynthesized)
qDeleteAll(list.begin(), list.end())
Combined button and popup list for selecting options.
GLuint64 GLenum void * handle
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent