42 #ifndef QT_NO_QWS_MOUSE_INTEGRITY 48 #include <INTEGRITY.h> 52 #include <device/hiddriver.h> 89 void stoploop() { loop =
false; ReleaseSemaphore(loopsem); };
150 Error driverError, deviceError;
157 driverError = gh_hid_get_driver(i, &driver);
161 deviceError = gh_hid_init_device(driver, j, &handle);
165 deviceError = gh_hid_get_setting(handle, HID_SETTING_CAPABILITIES, &type);
166 if ((deviceError ==
Success) && (type & HID_TYPE_AXIS)) {
167 handleList.append(handle);
170 gh_hid_close(handle);
173 }
while (deviceError ==
Success);
176 }
while (driverError ==
Success);
177 return (devices > 0);
187 Qt::KeyboardModifiers keymod;
193 foreach (HIDHandle h, handleList) {
194 CheckSuccess(CreateActivity(CurrentTask(), 2,
false, i, &act));
197 CheckSuccess(gh_hid_async_wait_for_event(h, act));
201 CheckSuccess(CreateSemaphore(0, &loopsem));
202 CheckSuccess(CreateActivity(CurrentTask(), 2,
false, 0, &loopact));
203 CheckSuccess(AsynchronousReceive(loopact, (
Object)loopsem, NULL));
207 uint32_t num_events = 1;
209 WaitForActivity(&
id);
211 while (gh_hid_get_event(handleList.at(
id), &
event, &num_events) ==
Success) {
212 if (event.type == HID_TYPE_AXIS) {
213 switch (event.index) {
215 currentpos.
setX(event.value);
218 currentpos.
setY(event.value);
221 currentpos.
setX(currentpos.
x() +
event.value);
224 currentpos.
setY(currentpos.
y() +
event.value);
229 }
else if (event.type == HID_TYPE_KEY) {
230 switch (event.index) {
231 case HID_BUTTON_LEFT:
237 case HID_BUTTON_MIDDLE:
243 case HID_BUTTON_RIGHT:
250 }
else if (event.type == HID_TYPE_SYNC) {
253 imp->dataReady(currentpos.
x(), currentpos.
y(), currentbutton);
257 CheckSuccess(gh_hid_async_wait_for_event(handleList.at(
id), actList.at(
id)));
260 CloseSemaphore(loopsem);
280 #include "qmouseintegrity_qws.moc" 282 #endif // QT_NO_QWS_MOUSE_INTEGRITY QPoint transform(const QPoint &)
Transforms the given position from device coordinates to screen coordinates, and returns the transfor...
void clearCalibration()
Clears the current calibration, i.e., makes the mouse driver return mouse events in raw device coordi...
#define QT_END_NAMESPACE
This macro expands to.
void mouseDataAvailable(int x, int y, int buttons)
The QWSCalibratedMouseHandler class provides mouse calibration and noise reduction in Qt for Embedded...
void readMouseData(int x, int y, int buttons)
bool setup(QString driverName, uint32_t index)
static Qt::MouseButtons buttons
virtual void calibrate(const QWSPointerCalibrationData *)
Updates the calibration parameters based on coordinate mapping of the given data. ...
The QString class provides a Unicode character string.
const QPoint & pos() const
Returns the current mouse position.
void mouseChanged(const QPoint &pos, int bstate, int wheel=0)
Notifies the system of a new mouse event.
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
virtual void clearCalibration()
Clears the current calibration, i.e., makes the mouse driver return mouse events in raw device coordi...
bool sendFiltered(const QPoint &, int button)
Notifies the system of a new mouse event after applying a noise reduction filter. ...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QIntMouseListenThread * mousethread
QIntMouseHandler * handler
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void run()
The starting point for the thread.
static const char * data(const QByteArray &arr)
QIntMouseHandler(const QString &driver=QString(), const QString &device=QString())
The QWSPointerCalibrationData class is a container for mouse calibration data in Qt for Embedded Linu...
void dataReady(int x, int y, int buttons)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
void start(Priority=InheritPriority)
Begins execution of the thread by calling run().
bool wait(unsigned long time=ULONG_MAX)
Blocks the thread until either of these conditions is met:
The QPoint class defines a point in the plane using integer precision.
int y() const
Returns the y coordinate of this point.
QIntMouseListenThread(QIntMousePrivate *im)
QFuture< T > run(Function function,...)
QList< HIDHandle > handleList
int x() const
Returns the x coordinate of this point.
void resume()
Implement this function to resume reading and handling mouse events, e.
QImageIOHandler * handler
QIntMousePrivate(QIntMouseHandler *handler)
friend class QIntMouseListenTaskThread
void limitToScreen(QPoint &pt)
Ensures that the given position is within the screen's boundaries, changing the position if necessary...
void suspend()
Implement this function to suspend reading and handling of mouse events, e.
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
The QThread class provides a platform-independent way to manage threads.
void calibrate(const QWSPointerCalibrationData *data)
Updates the calibration parameters based on coordinate mapping of the given data. ...
void exit(int retcode=0)
Tells the thread's event loop to exit with a return code.
QList< Activity > actList