7#include <QGuiApplication>
8#include <qpa/qwindowsysteminterface.h>
9#include <device/hiddriver.h>
15 static const Value ActivityPriority = 2;
21 CheckSuccess(CreateActivity(CurrentTask(), ActivityPriority,
false, (Value)
this, &
act));
25 CheckSuccess(CloseActivity(
act));
35 : driver(hidd),
handle(hidh), currentPos(0, 0) { }
38 CheckSuccess(gh_hid_close(
handle));
48 Qt::MouseButtons buttons;
74 gh_hid_wait_for_new_device(driver,
act);
80 uintptr_t devicecontext;
87 err = gh_hid_enum_devices(driver, &device_id, &devicecontext);
88 if (err == OperationNotImplemented)
90 else if (err == Failure)
92 if (!
devices.contains(device_id)) {
93 err = gh_hid_init_device(driver, device_id, &
handle);
96 devices.insert(device_id, hidnot);
101 if (err == OperationNotImplemented) {
107 if (!
devices.contains(device_id)) {
108 err = gh_hid_init_device(driver, device_id, &
handle);
112 devices.insert(device_id, hidnot);
126 uint32_t num_events = 1;
129 if (
event.type == HID_TYPE_AXIS) {
130 switch (
event.index) {
138 currentPos.
setX(currentPos.
x() +
event.value);
141 currentPos.
setY(currentPos.
y() +
event.value);
147 }
else if (
event.type == HID_TYPE_KEY) {
148 switch (
event.index) {
149 case HID_BUTTON_LEFT:
153 buttons &=
~Qt::LeftButton;
155 case HID_BUTTON_MIDDLE:
159 buttons &=
~Qt::MiddleButton;
161 case HID_BUTTON_RIGHT:
165 buttons &=
~Qt::RightButton;
171 }
else if (
event.type == HID_TYPE_SYNC) {
174 }
else if (
event.type == HID_TYPE_DISCONNECT) {
183 CheckSuccess(gh_hid_async_wait_for_event(
handle,
act));
186void QIntegrityHIDManager::open_devices()
205 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 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
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