void QBBEventThread::dispatchEvent(screen_event_t event) { // get the event type errno = 0; int qnxType; int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType); if (result) { qFatal("QBB: failed to query event type, errno=%d", errno); } switch (qnxType) { case SCREEN_EVENT_MTOUCH_TOUCH: case SCREEN_EVENT_MTOUCH_MOVE: case SCREEN_EVENT_MTOUCH_RELEASE: handleTouchEvent(event, qnxType); break; case SCREEN_EVENT_KEYBOARD: handleKeyboardEvent(event); break; case SCREEN_EVENT_POINTER: handlePointerEvent(event); break; case SCREEN_EVENT_CLOSE: handleCloseEvent(event); break; case SCREEN_EVENT_USER: // treat all user events as shutdown requests #if defined(QBBEVENTTHREAD_DEBUG) qDebug() << "QBB: QNX user event"; #endif mQuit = true; break; default: // event ignored #if defined(QBBEVENTTHREAD_DEBUG) qDebug() << "QBB: QNX unknown event"; #endif break; } }
void QDirectFbInput::handleEvents() { DFBResult hasEvent = m_eventBuffer->HasEvent(m_eventBuffer.data()); while(hasEvent == DFB_OK){ DFBEvent event; DFBResult ok = m_eventBuffer->GetEvent(m_eventBuffer.data(), &event); if (ok != DFB_OK) DirectFBError("Failed to get event",ok); if (event.clazz == DFEC_WINDOW) { switch (event.window.type) { case DWET_BUTTONDOWN: case DWET_BUTTONUP: case DWET_MOTION: handleMouseEvents(event); break; case DWET_WHEEL: handleWheelEvent(event); break; case DWET_KEYDOWN: case DWET_KEYUP: handleKeyEvents(event); break; case DWET_ENTER: case DWET_LEAVE: handleEnterLeaveEvents(event); break; case DWET_GOTFOCUS: handleGotFocusEvent(event); break; case DWET_CLOSE: handleCloseEvent(event); break; case DWET_POSITION_SIZE: handleGeometryEvent(event); break; default: break; } } hasEvent = m_eventBuffer->HasEvent(m_eventBuffer.data()); } }
bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType) { switch (qnxType) { case SCREEN_EVENT_MTOUCH_TOUCH: case SCREEN_EVENT_MTOUCH_MOVE: case SCREEN_EVENT_MTOUCH_RELEASE: handleTouchEvent(event, qnxType); break; case SCREEN_EVENT_KEYBOARD: handleKeyboardEvent(event); break; case SCREEN_EVENT_POINTER: handlePointerEvent(event); break; case SCREEN_EVENT_CREATE: handleCreateEvent(event); break; case SCREEN_EVENT_CLOSE: handleCloseEvent(event); break; case SCREEN_EVENT_DISPLAY: handleDisplayEvent(event); break; default: // event ignored qScreenEventDebug() << Q_FUNC_INFO << "unknown event" << qnxType; return false; } return true; }
bool QWidgetWindow::event(QEvent *event) { if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) { // \a event is uninteresting for QWidgetWindow, the event was probably // generated before WA_DontShowOnScreen was set return m_widget->event(event); } switch (event->type()) { case QEvent::Close: handleCloseEvent(static_cast<QCloseEvent *>(event)); return true; case QEvent::Enter: case QEvent::Leave: handleEnterLeaveEvent(event); return true; // these should not be sent to QWidget, the corresponding events // are sent by QApplicationPrivate::notifyActiveWindowChange() case QEvent::FocusIn: handleFocusInEvent(static_cast<QFocusEvent *>(event)); // Fallthrough case QEvent::FocusOut: { #ifndef QT_NO_ACCESSIBILITY QAccessible::State state; state.active = true; QAccessibleStateChangeEvent ev(widget(), state); QAccessible::updateAccessibility(&ev); #endif return false; } case QEvent::FocusAboutToChange: if (QApplicationPrivate::focus_widget) { if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) qApp->inputMethod()->commit(); QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event); } return true; case QEvent::KeyPress: case QEvent::KeyRelease: case QEvent::ShortcutOverride: handleKeyEvent(static_cast<QKeyEvent *>(event)); return true; case QEvent::MouseMove: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: handleMouseEvent(static_cast<QMouseEvent *>(event)); return true; case QEvent::NonClientAreaMouseMove: case QEvent::NonClientAreaMouseButtonPress: case QEvent::NonClientAreaMouseButtonRelease: case QEvent::NonClientAreaMouseButtonDblClick: handleNonClientAreaMouseEvent(static_cast<QMouseEvent *>(event)); return true; case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: case QEvent::TouchCancel: handleTouchEvent(static_cast<QTouchEvent *>(event)); return true; case QEvent::Move: handleMoveEvent(static_cast<QMoveEvent *>(event)); return true; case QEvent::Resize: handleResizeEvent(static_cast<QResizeEvent *>(event)); return true; #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: handleWheelEvent(static_cast<QWheelEvent *>(event)); return true; #endif #ifndef QT_NO_DRAGANDDROP case QEvent::DragEnter: case QEvent::DragMove: handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event)); return true; case QEvent::DragLeave: handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event)); return true; case QEvent::Drop: handleDropEvent(static_cast<QDropEvent *>(event)); return true; #endif case QEvent::Expose: handleExposeEvent(static_cast<QExposeEvent *>(event)); return true; case QEvent::WindowStateChange: handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event)); return true; case QEvent::ThemeChange: { QEvent widgetEvent(QEvent::ThemeChange); QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); } return true; #ifndef QT_NO_TABLETEVENT case QEvent::TabletPress: case QEvent::TabletMove: case QEvent::TabletRelease: handleTabletEvent(static_cast<QTabletEvent *>(event)); return true; #endif #ifndef QT_NO_GESTURES case QEvent::NativeGesture: handleGestureEvent(static_cast<QNativeGestureEvent *>(event)); return true; #endif #ifndef QT_NO_CONTEXTMENU case QEvent::ContextMenu: handleContextMenuEvent(static_cast<QContextMenuEvent *>(event)); return true; #endif // Handing show events to widgets (see below) here would cause them to be triggered twice case QEvent::Show: case QEvent::Hide: return QWindow::event(event); case QEvent::WindowBlocked: qt_button_down = 0; break; default: break; } return m_widget->event(event) || QWindow::event(event); }
/// /// event filter method /// bool QtEventConsumer::eventFilter ( QObject *obj, QEvent *event ) { /// /// process control /// //if process is stoped... if (f_recording_ == false) { //no event handling DEBUG(D_CONSUMER,"(QtEventConsumer::eventFilter) Stop state. No event handled."); return false; } //if process is paused... else if (f_recording_ && f_paused_) { //filter all events and //block the application DEBUG(D_CONSUMER,"(QtEventConsumer::eventFilter) Pause state. Events blocked."); return true; } //no widget or event provided else if (obj == NULL || event == NULL) { DEBUG(D_CONSUMER,"(QtEventConsumer::eventFilter) No widget or event provided."); return false; } //object is not a widget or window /*else if (!obj->isWidgetType()) { DEBUG(D_CONSUMER,"(QtEventConsumer::eventFilter) Object is not a widget."); return false; }*/ //if process is recording... else { //apply the filter... } //DEBUG(D_CONSUMER,"(QtEventConsumer::eventFilter) Type = " // + QString::number(event->type()).toStdString()); /// ///filter depending on the type.. /// //window events if (event->type() == QEvent::KeyPress) { handleKeyPressEvent(obj, event); } //mouse events else if (event->type() == QEvent::MouseButtonPress) { handleMousePressEvent(obj, event); } else if (event->type() == QEvent::MouseButtonRelease) { handleMouseReleaseEvent(obj, event); } else if (event->type() == QEvent::MouseButtonDblClick) { handleMouseDoubleEvent(obj, event); } else if (event->type() == QEvent::Wheel) { handleWheelEvent(obj, event); } //keyboard events else if (event->type() == QEvent::Close) { handleCloseEvent(obj, event); } ///the event should continue to reach its goal... return false; }