51 #include <QApplication> 55 #include <sys/keycodes.h> 60 : mBBIntegration(integration)
86 int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType);
88 qFatal(
"QBB: failed to query event type, errno=%d",
errno);
97 case SCREEN_EVENT_MTOUCH_TOUCH:
98 case SCREEN_EVENT_MTOUCH_MOVE:
99 case SCREEN_EVENT_MTOUCH_RELEASE:
103 case SCREEN_EVENT_KEYBOARD:
107 case SCREEN_EVENT_POINTER:
111 case SCREEN_EVENT_CLOSE:
115 case SCREEN_EVENT_CREATE:
119 case SCREEN_EVENT_DISPLAY:
125 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 126 qDebug() <<
"QBB: QNX unknown event";
139 int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
141 qFatal(
"QBB: failed to query event flags, errno=%d",
errno);
147 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym);
149 qFatal(
"QBB: failed to query event sym, errno=%d",
errno);
153 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers);
155 qFatal(
"QBB: failed to query event modifiers, errno=%d",
errno);
159 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan);
161 qFatal(
"QBB: failed to query event modifiers, errno=%d",
errno);
165 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
167 qFatal(
"QBB: failed to query event cap, errno=%d",
errno);
177 if (qbbInputContext && qbbInputContext->
handleKeyboardEvent(flags, sym, modifiers, scan, cap))
190 if (modifiers & KEYMOD_SHIFT)
192 if (modifiers & KEYMOD_CTRL)
194 if (modifiers & KEYMOD_ALT)
201 if (flags & KEY_CAP_VALID) {
205 if (cap >= 0x20 && cap <= 0x0ff) {
206 key =
Qt::Key(std::toupper(cap));
209 keyStr =
QChar((
int)(key & 0x3f));
211 if (flags & KEY_SYM_VALID) {
215 }
else if ((cap > 0x0ff && cap < UNICODE_PRIVATE_USE_AREA_FIRST) || cap > UNICODE_PRIVATE_USE_AREA_LAST) {
225 scan, sym, modifiers, keyStr);
226 #if defined(QBBScreenEventHandler_DEBUG) 227 qDebug() <<
"QBB: Qt key t=" << type <<
", k=" << key <<
", s=" << keyStr;
234 #if defined(QBBScreenEventHandler_DEBUG) 235 qDebug() <<
"Injecting mouse event..." << x << y;
239 void *qnxWindow = w ? w->platformWindow() : 0;
247 #if defined(QBBScreenEventHandler_DEBUG) 248 qDebug() <<
"QBB: Qt leave, w=" << wOld;
254 #if defined(QBBScreenEventHandler_DEBUG) 255 qDebug() <<
"QBB: Qt enter, w=" << w;
267 localPoint =
QPoint(x - w->
x(), y - w->
y());
278 #if defined(QBBScreenEventHandler_DEBUG) 279 qDebug() <<
"QBB: Qt mouse, w=" << w <<
", (" << localPoint.
x() <<
"," << localPoint.
y() <<
"), b=" << (int)buttons;
295 int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &qnxWindow);
297 qFatal(
"QBB: failed to query event window, errno=%d",
errno);
302 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState);
304 qFatal(
"QBB: failed to query event button state, errno=%d",
errno);
309 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
311 qFatal(
"QBB: failed to query event window position, errno=%d",
errno);
316 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
318 qFatal(
"QBB: failed to query event position, errno=%d",
errno);
323 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta);
325 qFatal(
"QBB: failed to query event wheel delta, errno=%d",
errno);
337 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 338 qDebug() <<
"QBB: Qt leave, w=" << wOld;
344 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 345 qDebug() <<
"QBB: Qt enter, w=" << w;
357 QPoint globalPoint(pos[0], pos[1]);
358 QPoint localPoint(windowPos[0], windowPos[1]);
365 if (buttonState & 0x01)
367 if (buttonState & 0x02)
369 if (buttonState & 0x04)
371 if (buttonState & 0x08)
373 if (buttonState & 0x10)
382 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 383 qDebug() <<
"QBB: Qt mouse, w=" << w <<
", (" << localPoint.
x() <<
"," << localPoint.
y() <<
"), b=" << (int)buttons;
391 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 392 qDebug() <<
"QBB: Qt wheel, w=" << w <<
", (" << localPoint.
x() <<
"," << localPoint.
y() <<
"), d=" << (int)wheelDelta;
407 int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
409 qFatal(
"QBB: failed to query event position, errno=%d",
errno);
417 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
419 qFatal(
"QBB: failed to query event window position, errno=%d",
errno);
425 result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, &touchId);
427 qFatal(
"QBB: failed to query event touch id, errno=%d",
errno);
433 result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &qnxWindow);
435 qFatal(
"QBB: failed to query event window, errno=%d",
errno);
450 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 451 qDebug() <<
"QBB: Qt leave, w=" << wOld;
457 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 458 qDebug() <<
"QBB: Qt enter, w=" << w;
469 QPoint globalPoint(pos[0], pos[1]);
470 QPoint localPoint(windowPos[0], windowPos[1]);
477 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 478 qDebug() <<
"QBB: Qt mouse, w=" << w <<
", (" << localPoint.
x() <<
"," << localPoint.
y() <<
"), b=" <<
buttons;
493 case SCREEN_EVENT_MTOUCH_TOUCH:
497 case SCREEN_EVENT_MTOUCH_MOVE:
501 case SCREEN_EVENT_MTOUCH_RELEASE:
522 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 523 qDebug() <<
"QBB: Qt touch, w=" << w <<
", p=(" << pos[0] <<
"," << pos[1] <<
"), t=" <<
type;
531 screen_window_t
window = 0;
532 if (screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, (
void**)&window) != 0)
533 qFatal(
"QBB: failed to query event window property, errno=%d",
errno);
545 screen_window_t
window = 0;
546 if (screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, (
void**)&window) != 0)
547 qFatal(
"QBB: failed to query event window property, errno=%d",
errno);
555 if (screen_get_event_property_pv(event, SCREEN_PROPERTY_DISPLAY, (
void **)&nativeDisplay) != 0) {
556 qWarning(
"QBB: failed to query display property, errno=%d",
errno);
561 if (screen_get_event_property_iv(event, SCREEN_PROPERTY_ATTACHED, &isAttached) != 0) {
562 qWarning(
"QBB: failed to query display attached property, errno=%d",
errno);
566 #if defined(QBBSCREENEVENTHANDLER_DEBUG) 573 }
else if (!isAttached) {
579 #include "moc_qbbscreeneventhandler.cpp"
Qt::MouseButtons mLastButtonState
QBBScreenEventHandler(QBBIntegration *integration)
#define QT_END_NAMESPACE
This macro expands to.
QPoint mLastGlobalMousePoint
void createDisplay(screen_display_t display, int screenIndex)
static void handleWheelEvent(QWidget *w, const QPoint &local, const QPoint &global, int d, Qt::Orientation o)
void handleCreateEvent(screen_event_t event)
void injectPointerMoveEvent(int x, int y)
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or 0 if no application wi...
The QPointF class defines a point in the plane using floating point precision.
bool isKeypadKey(int key)
static Qt::MouseButtons buttons
The QString class provides a Unicode character string.
static void setPos(int x, int y)
Moves the cursor (hot spot) to the global screen position (x, y).
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
The QChar class provides a 16-bit Unicode character.
void handleKeyboardEvent(screen_event_t event)
bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList< struct TouchPoint > &points)
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
void append(const T &t)
Inserts value at the end of the list.
bool handleEvent(screen_event_t event)
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
void handleDisplayEvent(screen_event_t event)
static void handleMouseEvent(QWidget *w, const QPoint &local, const QPoint &global, Qt::MouseButtons b)
tlw == 0 means that ev is in global coords only
QBBIntegration * mBBIntegration
Q_CORE_EXPORT void qWarning(const char *,...)
static void handleCloseEvent(QWidget *w)
QBBScreen * screenForNative(screen_display_t screen) const
static void handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
void handleTouchEvent(screen_event_t event, int type)
Qt::Key keyTranslator(int key)
void handlePointerEvent(screen_event_t event)
void newWindowCreated(screen_window_t window)
Q_CORE_EXPORT void qFatal(const char *,...)
Type
This enum type defines the valid event types in Qt.
Q_GUI_EXPORT EGLNativeDisplayType nativeDisplay()
The QPoint class defines a point in the plane using integer precision.
int height() const
Returns the height.
QPoint mLastLocalMousePoint
int y() const
Returns the y coordinate of this point.
void removeDisplay(QBBScreen *screen)
Qt::TouchPointState state
The QSize class defines the size of a two-dimensional object using integer point precision.
QWindowSystemInterface::TouchPoint mTouchPoints[MAX_TOUCH_POINTS]
int x() const
Returns the x coordinate of this point.
void windowClosed(screen_window_t window)
The QInputContext class abstracts the input method dependent data and composing state.
static void handleEnterEvent(QWidget *w)
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static void handleLeaveEvent(QWidget *w)
void handleCloseEvent(screen_event_t event)
The QList class is a template class that provides lists.