[QNX] Enable MT screen event handling on Blackberry
Consuming incoming screen events through the BPS event dispatcher on its current incarnation has proven to be very inefficient since it cannot put up with the screen event throughput. This patch enables the screen event thread also for Q_OS_BLACKBERRY platforms, in addition to stock QNX. This behavior can still be configured through the project file, though. Task-number: QTBUG-26177 Change-Id: I98a3b22549c9fbf0c16b5a8c39a55c1eaa6ec1f4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
197b145a23
commit
9e66ee2d59
@ -16,6 +16,12 @@ contains(QT_CONFIG, opengles2) {
|
||||
|
||||
CONFIG(blackberry) {
|
||||
CONFIG += qqnx_pps
|
||||
|
||||
# Comment this to enable screen event handling
|
||||
# through the event dispatcher.
|
||||
DEFINES += QQNX_SCREENEVENTTHREAD
|
||||
} else {
|
||||
DEFINES += QQNX_SCREENEVENTTHREAD
|
||||
}
|
||||
|
||||
# Uncomment these to enable debugging output for various aspects of the plugin
|
||||
|
@ -101,12 +101,22 @@ void QQnxBpsEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *disp
|
||||
|
||||
void QQnxBpsEventFilter::registerForScreenEvents(QQnxScreen *screen)
|
||||
{
|
||||
if (!m_screenEventHandler) {
|
||||
qWarning("QQNX: trying to register for screen events, but no handler provided.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (screen_request_events(screen->nativeContext()) != BPS_SUCCESS)
|
||||
qWarning("QQNX: failed to register for screen events on screen %p", screen->nativeContext());
|
||||
}
|
||||
|
||||
void QQnxBpsEventFilter::unregisterForScreenEvents(QQnxScreen *screen)
|
||||
{
|
||||
if (!m_screenEventHandler) {
|
||||
qWarning("QQNX: trying to unregister for screen events, but no handler provided.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (screen_stop_events(screen->nativeContext()) != BPS_SUCCESS)
|
||||
qWarning("QQNX: failed to unregister for screen events on screen %p", screen->nativeContext());
|
||||
}
|
||||
@ -144,6 +154,11 @@ bool QQnxBpsEventFilter::bpsEventFilter(bps_event_t *event)
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "event=" << event << "domain=" << eventDomain;
|
||||
|
||||
if (eventDomain == screen_get_domain()) {
|
||||
if (!m_screenEventHandler) {
|
||||
qWarning("QQNX: registered for screen events, but no handler provided.");
|
||||
return false;
|
||||
}
|
||||
|
||||
screen_event_t screenEvent = screen_event_get_event(event);
|
||||
return m_screenEventHandler->handleEvent(screenEvent);
|
||||
}
|
||||
|
@ -156,8 +156,7 @@ QQnxIntegration::QQnxIntegration()
|
||||
#endif
|
||||
|
||||
// Create/start event thread
|
||||
// Not on BlackBerry, it has specialised event dispatcher which also handles screen events
|
||||
#if !defined(Q_OS_BLACKBERRY)
|
||||
#if defined(QQNX_SCREENEVENTTHREAD)
|
||||
m_screenEventThread = new QQnxScreenEventThread(m_screenContext, m_screenEventHandler);
|
||||
m_screenEventThread->start();
|
||||
#endif
|
||||
@ -184,7 +183,8 @@ QQnxIntegration::QQnxIntegration()
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
QQnxVirtualKeyboardBps* virtualKeyboardBps = new QQnxVirtualKeyboardBps;
|
||||
m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler, m_screenEventHandler, virtualKeyboardBps);
|
||||
m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler,
|
||||
(m_screenEventThread ? 0 : m_screenEventHandler), virtualKeyboardBps);
|
||||
m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher);
|
||||
|
||||
m_virtualKeyboard = virtualKeyboardBps;
|
||||
@ -198,7 +198,7 @@ QQnxIntegration::QQnxIntegration()
|
||||
// create the displays first.
|
||||
createDisplays();
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
#if !defined(QQNX_SCREENEVENTTHREAD) && defined(Q_OS_BLACKBERRY)
|
||||
// Register for screen domain events with bps
|
||||
Q_FOREACH (QQnxScreen *screen, m_screens)
|
||||
m_bpsEventFilter->registerForScreenEvents(screen);
|
||||
@ -241,13 +241,15 @@ QQnxIntegration::~QQnxIntegration()
|
||||
#endif
|
||||
delete m_navigatorEventHandler;
|
||||
|
||||
#if !defined(Q_OS_BLACKBERRY)
|
||||
#if defined(QQNX_SCREENEVENTTHREAD)
|
||||
// Stop/destroy screen event thread
|
||||
delete m_screenEventThread;
|
||||
#else
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
Q_FOREACH (QQnxScreen *screen, m_screens)
|
||||
m_bpsEventFilter->unregisterForScreenEvents(screen);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
delete m_bpsEventFilter;
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user