From 91bdfd30200b862581b67373220db9651e2bda3b Mon Sep 17 00:00:00 2001 From: Simjees Abraham Date: Wed, 28 Mar 2012 15:25:53 +0200 Subject: [PATCH 01/15] irrelevant qDebugs from QGuiApplication removed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit removed the qDebugs that are not relevant for the user and were printed when the app was started from QtCreator. Change-Id: Iae49d6c780a4d3cfd55b3e149555294e150f3f52 Reviewed-by: Samuel Rødal --- src/gui/kernel/qguiapplication.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 4cd02c3d5b..54cb5fdbeb 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -585,7 +585,6 @@ static void init_plugins(const QList &pluginList) { for (int i = 0; i < pluginList.count(); ++i) { QByteArray pluginSpec = pluginList.at(i); - qDebug() << "init_plugins" << i << pluginSpec; int colonPos = pluginSpec.indexOf(':'); QObject *plugin; if (colonPos < 0) @@ -593,7 +592,6 @@ static void init_plugins(const QList &pluginList) else plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)), QLatin1String(pluginSpec.mid(colonPos+1))); - qDebug() << " created" << plugin; if (plugin) QGuiApplicationPrivate::generic_plugin_list.append(plugin); } From f5c5708f6e56eb0de5c1d0556218af4680d8fd1f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Mar 2012 16:25:10 +0200 Subject: [PATCH 02/15] rcc: Add a note about the usage of the source code for Qt Designer. Change-Id: I672b470fcbd37b024451e7ed5f241643a1ab85a6 Reviewed-by: Marius Storm-Olsen --- src/tools/rcc/rcc.cpp | 2 ++ src/tools/rcc/rcc.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 8a9afec690..740ae91b68 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -52,6 +52,8 @@ #include #include +// Note: A copy of this file is used in Qt Designer (qttools/src/designer/src/lib/shared/rcc.cpp) + QT_BEGIN_NAMESPACE enum { diff --git a/src/tools/rcc/rcc.h b/src/tools/rcc/rcc.h index 6fe8059551..a808f576c5 100644 --- a/src/tools/rcc/rcc.h +++ b/src/tools/rcc/rcc.h @@ -39,6 +39,8 @@ ** ****************************************************************************/ +// Note: A copy of this file is used in Qt Designer (qttools/src/designer/src/lib/shared/rcc_p.h) + #ifndef RCC_H #define RCC_H From a80a2c6da241dac77f533bc702a1c7d94349a812 Mon Sep 17 00:00:00 2001 From: Kevin Krammer Date: Wed, 28 Mar 2012 13:20:40 +0200 Subject: [PATCH 03/15] Move screen event processing into its own class The event handler class can then be reused when we have proper BPS event support available from corelib Change-Id: Iafe645e69248597377045c711108ce0acbe3984b Reviewed-by: Sean Harmer Reviewed-by: Thomas McGuire Reviewed-by: Robin Burchell --- src/plugins/platforms/qnx/qnx.pro | 7 +- src/plugins/platforms/qnx/qqnxeventthread.cpp | 473 ++---------------- src/plugins/platforms/qnx/qqnxeventthread.h | 21 +- src/plugins/platforms/qnx/qqnxintegration.cpp | 2 +- .../platforms/qnx/qqnxscreeneventhandler.cpp | 473 ++++++++++++++++++ .../platforms/qnx/qqnxscreeneventhandler.h | 82 +++ 6 files changed, 592 insertions(+), 466 deletions(-) create mode 100644 src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp create mode 100644 src/plugins/platforms/qnx/qqnxscreeneventhandler.h diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 588464fc47..185934c1d1 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -20,6 +20,7 @@ QT += opengl opengl-private platformsupport platformsupport-private widgets-priv #DEFINES += QQNXRASTERBACKINGSTORE_DEBUG #DEFINES += QQNXROOTWINDOW_DEBUG #DEFINES += QQNXSCREEN_DEBUG +#DEFINES += QQNXSCREENEVENT_DEBUG #DEFINES += QQNXVIRTUALKEYBOARD_DEBUG #DEFINES += QQNXWINDOW_DEBUG @@ -35,7 +36,8 @@ SOURCES = main.cpp \ qqnxrasterbackingstore.cpp \ qqnxvirtualkeyboard.cpp \ qqnxclipboard.cpp \ - qqnxrootwindow.cpp + qqnxrootwindow.cpp \ + qqnxscreeneventhandler.cpp HEADERS = qqnxbuffer.h \ @@ -50,7 +52,8 @@ HEADERS = qqnxbuffer.h \ qqnxrasterbackingstore.h \ qqnxvirtualkeyboard.h \ qqnxclipboard.h \ - qqnxrootwindow.h + qqnxrootwindow.h \ + qqnxscreeneventhandler.h CONFIG(blackberry) { SOURCES += qqnxservices.cpp diff --git a/src/plugins/platforms/qnx/qqnxeventthread.cpp b/src/plugins/platforms/qnx/qqnxeventthread.cpp index cd30da1971..1e08dbcd9c 100644 --- a/src/plugins/platforms/qnx/qqnxeventthread.cpp +++ b/src/plugins/platforms/qnx/qqnxeventthread.cpp @@ -40,53 +40,20 @@ ****************************************************************************/ #include "qqnxeventthread.h" -#include "qqnxintegration.h" -#include "qqnxkeytranslator.h" - -#if defined(QQNX_IMF) -#include "qqnxinputcontext_imf.h" -#else -#include "qqnxinputcontext_noimf.h" -#endif - -#include -#include -#include +#include "qqnxscreeneventhandler.h" #include #include #include -#include #include -QQnxEventThread::QQnxEventThread(screen_context_t context, QPlatformScreen& screen) +QQnxEventThread::QQnxEventThread(screen_context_t context) : QThread(), m_screenContext(context), - m_platformScreen(screen), - m_quit(false), - m_lastButtonState(Qt::NoButton), - m_lastMouseWindow(0) + m_quit(false) { - // Create a touch device - m_touchDevice = new QTouchDevice; - m_touchDevice->setType(QTouchDevice::TouchScreen); - m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure | QTouchDevice::NormalizedPosition); - QWindowSystemInterface::registerTouchDevice(m_touchDevice); - - // initialize array of touch points - for (int i = 0; i < MaximumTouchPoints; i++) { - - // map array index to id - m_touchPoints[i].id = i; - - // pressure is not supported - use default - m_touchPoints[i].pressure = 1.0; - - // nothing touching - m_touchPoints[i].state = Qt::TouchPointReleased; - } } QQnxEventThread::~QQnxEventThread() @@ -95,16 +62,21 @@ QQnxEventThread::~QQnxEventThread() shutdown(); } +void QQnxEventThread::injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap) +{ + QQnxScreenEventHandler::injectKeyboardEvent(flags, sym, mod, scan, cap); +} + void QQnxEventThread::run() { + QQnxScreenEventHandler eventHandler; screen_event_t event; // create screen event errno = 0; int result = screen_create_event(&event); - if (result) { + if (result) qFatal("QQNX: failed to create event, errno=%d", errno); - } #if defined(QQNXEVENTTHREAD_DEBUG) qDebug() << "QQNX: event loop started"; @@ -116,12 +88,26 @@ void QQnxEventThread::run() // block until screen event is available errno = 0; result = screen_get_event(m_screenContext, event, -1); - if (result) { + if (result) qFatal("QQNX: failed to get event, errno=%d", errno); - } // process received event - dispatchEvent(event); + // get the event type + errno = 0; + int qnxType; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType); + if (result) + qFatal("QQNX: failed to query event type, errno=%d", errno); + + if (qnxType == SCREEN_EVENT_USER) { + // treat all user events as shutdown requests + #if defined(QQNXEVENTTHREAD_DEBUG) + qDebug() << "QQNX: QNX user event"; + #endif + m_quit = true; + } else { + eventHandler.handleEvent(event, qnxType); + } } #if defined(QQNXEVENTTHREAD_DEBUG) @@ -139,26 +125,23 @@ void QQnxEventThread::shutdown() // create screen event errno = 0; int result = screen_create_event(&event); - if (result) { + if (result) qFatal("QQNX: failed to create event, errno=%d", errno); - } // set the event type as user errno = 0; int type = SCREEN_EVENT_USER; result = screen_set_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type); - if (result) { + if (result) qFatal("QQNX: failed to set event type, errno=%d", errno); - } // NOTE: ignore SCREEN_PROPERTY_USER_DATA; treat all user events as shutdown events // post event to event loop so it will wake up and die errno = 0; result = screen_send_event(m_screenContext, event, getpid()); - if (result) { + if (result) qFatal("QQNX: failed to set event type, errno=%d", errno); - } // cleanup screen_destroy_event(event); @@ -174,399 +157,3 @@ void QQnxEventThread::shutdown() qDebug() << "QQNX: event loop shutdown end"; #endif } - -void QQnxEventThread::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("QQNX: 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(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: QNX user event"; -#endif - m_quit = true; - break; - - default: - // event ignored -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: QNX unknown event"; -#endif - break; - } -} - -void QQnxEventThread::handleKeyboardEvent(screen_event_t event) -{ - // get flags of key event - errno = 0; - int flags; - int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags); - if (result) { - qFatal("QQNX: failed to query event flags, errno=%d", errno); - } - - // get key code - errno = 0; - int sym; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym); - if (result) { - qFatal("QQNX: failed to query event sym, errno=%d", errno); - } - - int modifiers; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers); - if (result) { - qFatal("QQNX: failed to query event modifiers, errno=%d", errno); - } - - int scan; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan); - if (result) { - qFatal("QQNX: failed to query event modifiers, errno=%d", errno); - } - - int cap; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap); - if (result) { - qFatal("QQNX: failed to query event cap, errno=%d", errno); - } - - injectKeyboardEvent(flags, sym, modifiers, scan, cap); -} - -void QQnxEventThread::injectKeyboardEvent(int flags, int sym, int modifiers, int scan, int cap) -{ - Q_UNUSED(scan); - - Qt::KeyboardModifiers qtMod = Qt::NoModifier; - if (modifiers & KEYMOD_SHIFT) - qtMod |= Qt::ShiftModifier; - if (modifiers & KEYMOD_CTRL) - qtMod |= Qt::ControlModifier; - if (modifiers & KEYMOD_ALT) - qtMod |= Qt::AltModifier; - - // determine event type - QEvent::Type type = (flags & KEY_DOWN) ? QEvent::KeyPress : QEvent::KeyRelease; - - // Check if the key cap is valid - if (flags & KEY_CAP_VALID) { - Qt::Key key; - QString keyStr; - - if (cap >= 0x20 && cap <= 0x0ff) { - key = Qt::Key(std::toupper(cap)); // Qt expects the CAP to be upper case. - - if ( qtMod & Qt::ControlModifier ) { - keyStr = QChar((int)(key & 0x3f)); - } else { - if (flags & KEY_SYM_VALID) { - keyStr = QChar(sym); - } - } - } else if ((cap > 0x0ff && cap < UNICODE_PRIVATE_USE_AREA_FIRST) || cap > UNICODE_PRIVATE_USE_AREA_LAST) { - key = (Qt::Key)cap; - keyStr = QChar(sym); - } else { - if (isKeypadKey(cap)) - qtMod |= Qt::KeypadModifier; // Is this right? - key = keyTranslator(cap); - } - - QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, keyStr); -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt key t=" << type << ", k=" << key << ", s=" << keyStr; -#endif - } -} - -void QQnxEventThread::handlePointerEvent(screen_event_t event) -{ - errno = 0; - - // Query the window that was clicked - screen_window_t qnxWindow; - void *handle; - int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); - if (result) { - qFatal("QQNX: failed to query event window, errno=%d", errno); - } - qnxWindow = static_cast(handle); - - // Query the button states - int buttonState = 0; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState); - if (result) { - qFatal("QQNX: failed to query event button state, errno=%d", errno); - } - - // Query the window position - int windowPos[2]; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos); - if (result) { - qFatal("QQNX: failed to query event window position, errno=%d", errno); - } - - // Query the screen position - int pos[2]; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos); - if (result) { - qFatal("QQNX: failed to query event position, errno=%d", errno); - } - - // Query the wheel delta - int wheelDelta = 0; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta); - if (result) { - qFatal("QQNX: failed to query event wheel delta, errno=%d", errno); - } - - // Map window handle to top-level QWindow - QWindow *w = QQnxIntegration::window(qnxWindow); - - // Generate enter and leave events as needed. - if (qnxWindow != m_lastMouseWindow) { - QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow); - - if (wOld) { - QWindowSystemInterface::handleLeaveEvent(wOld); -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt leave, w=" << wOld; -#endif - } - - if (w) { - QWindowSystemInterface::handleEnterEvent(w); -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt enter, w=" << w; -#endif - } - } - m_lastMouseWindow = qnxWindow; - - // Apply scaling to wheel delta and invert value for Qt. We'll probably want to scale - // this via a system preference at some point. But for now this is a sane value and makes - // the wheel usable. - wheelDelta *= -10; - - // convert point to local coordinates - QPoint globalPoint(pos[0], pos[1]); - QPoint localPoint(windowPos[0], windowPos[1]); - - // Convert buttons. - // Some QNX header files invert 'Right Button versus "Left Button' ('Right' == 0x01). But they also offer a 'Button Swap' bit, - // so we may receive events as shown. (If this is wrong, the fix is easy.) - // QNX Button mask is 8 buttons wide, with a maximum value of x080. - Qt::MouseButtons buttons = Qt::NoButton; - if (buttonState & 0x01) - buttons |= Qt::LeftButton; - if (buttonState & 0x02) - buttons |= Qt::MidButton; - if (buttonState & 0x04) - buttons |= Qt::RightButton; - if (buttonState & 0x08) - buttons |= Qt::ExtraButton1; // AKA 'Qt::BackButton' - if (buttonState & 0x10) - buttons |= Qt::ExtraButton2; // AKA 'Qt::ForwardButton' - if (buttonState & 0x20) - buttons |= Qt::ExtraButton3; - if (buttonState & 0x40) - buttons |= Qt::ExtraButton4; - if (buttonState & 0x80) - buttons |= Qt::ExtraButton5; - - if (w) { - // Inject mouse event into Qt only if something has changed. - if (m_lastGlobalMousePoint != globalPoint || - m_lastLocalMousePoint != localPoint || - m_lastButtonState != buttons) { - QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons); -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast(buttons); -#endif - } - - if (wheelDelta) { - // Screen only supports a single wheel, so we will assume Vertical orientation for - // now since that is pretty much standard. - QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical); -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast(wheelDelta); -#endif - } - } - - m_lastGlobalMousePoint = globalPoint; - m_lastLocalMousePoint = localPoint; - m_lastButtonState = buttons; -} - -void QQnxEventThread::handleTouchEvent(screen_event_t event, int qnxType) -{ - // get display coordinates of touch - errno = 0; - int pos[2]; - int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos); - if (result) { - qFatal("QQNX: failed to query event position, errno=%d", errno); - } - - // get window coordinates of touch - errno = 0; - int windowPos[2]; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos); - if (result) { - qFatal("QQNX: failed to query event window position, errno=%d", errno); - } - - // determine which finger touched - errno = 0; - int touchId; - result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, &touchId); - if (result) { - qFatal("QQNX: failed to query event touch id, errno=%d", errno); - } - - // determine which window was touched - errno = 0; - void *handle; - result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); - if (result) { - qFatal("QQNX: failed to query event window, errno=%d", errno); - } - screen_window_t qnxWindow = static_cast(handle); - - // check if finger is valid - if (touchId < MaximumTouchPoints) { - - // Map window handle to top-level QWindow - QWindow *w = QQnxIntegration::window(qnxWindow); - - // Generate enter and leave events as needed. - if (qnxWindow != m_lastMouseWindow) { - QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow); - - if (wOld) { - QWindowSystemInterface::handleLeaveEvent(wOld); - #if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt leave, w=" << wOld; - #endif - } - - if (w) { - QWindowSystemInterface::handleEnterEvent(w); - #if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt enter, w=" << w; - #endif - } - } - m_lastMouseWindow = qnxWindow; - - if (w) { - // convert primary touch to mouse event - if (touchId == 0) { - - // convert point to local coordinates - QPoint globalPoint(pos[0], pos[1]); - QPoint localPoint(windowPos[0], windowPos[1]); - - // map touch state to button state - Qt::MouseButtons buttons = (qnxType == SCREEN_EVENT_MTOUCH_RELEASE) ? Qt::NoButton : Qt::LeftButton; - - // inject event into Qt - QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons); -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << buttons; -#endif - } - - // get size of screen which contains window - QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w); - QSizeF screenSize = platformScreen->physicalSize(); - - // update cached position of current touch point - m_touchPoints[touchId].normalPosition = QPointF( static_cast(pos[0]) / screenSize.width(), static_cast(pos[1]) / screenSize.height() ); - m_touchPoints[touchId].area = QRectF( pos[0], pos[1], 0.0, 0.0 ); - - // determine event type and update state of current touch point - QEvent::Type type = QEvent::None; - switch (qnxType) { - case SCREEN_EVENT_MTOUCH_TOUCH: - m_touchPoints[touchId].state = Qt::TouchPointPressed; - type = QEvent::TouchBegin; - break; - case SCREEN_EVENT_MTOUCH_MOVE: - m_touchPoints[touchId].state = Qt::TouchPointMoved; - type = QEvent::TouchUpdate; - break; - case SCREEN_EVENT_MTOUCH_RELEASE: - m_touchPoints[touchId].state = Qt::TouchPointReleased; - type = QEvent::TouchEnd; - break; - } - - // build list of active touch points - QList pointList; - for (int i = 0; i < MaximumTouchPoints; i++) { - if (i == touchId) { - // current touch point is always active - pointList.append(m_touchPoints[i]); - } else if (m_touchPoints[i].state != Qt::TouchPointReleased) { - // finger is down but did not move - m_touchPoints[i].state = Qt::TouchPointStationary; - pointList.append(m_touchPoints[i]); - } - } - - // inject event into Qt - QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList); -#if defined(QQNXEVENTTHREAD_DEBUG) - qDebug() << "QQNX: Qt touch, w=" << w << ", p=(" << pos[0] << "," << pos[1] << "), t=" << type; -#endif - } - } -} - -void QQnxEventThread::handleCloseEvent(screen_event_t event) -{ - // Query the window that was closed - void *handle; - int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); - if (result != 0) { - qFatal("QQNX: failed to query event window, errno=%d", errno); - } - screen_window_t qnxWindow = static_cast(handle); - - // Map window handle to top-level QWindow - QWindow *w = QQnxIntegration::window(qnxWindow); - if (w != 0) { - QWindowSystemInterface::handleCloseEvent(w); - } -} - diff --git a/src/plugins/platforms/qnx/qqnxeventthread.h b/src/plugins/platforms/qnx/qqnxeventthread.h index 61831233e9..9724587c37 100644 --- a/src/plugins/platforms/qnx/qqnxeventthread.h +++ b/src/plugins/platforms/qnx/qqnxeventthread.h @@ -44,9 +44,6 @@ #include -#include -#include - #include QT_BEGIN_NAMESPACE @@ -54,7 +51,7 @@ QT_BEGIN_NAMESPACE class QQnxEventThread : public QThread { public: - QQnxEventThread(screen_context_t context, QPlatformScreen& screen); + explicit QQnxEventThread(screen_context_t context); virtual ~QQnxEventThread(); static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap); @@ -63,26 +60,10 @@ protected: virtual void run(); private: - enum { - MaximumTouchPoints = 10 - }; - void shutdown(); - void dispatchEvent(screen_event_t event); - void handleKeyboardEvent(screen_event_t event); - void handlePointerEvent(screen_event_t event); - void handleTouchEvent(screen_event_t event, int type); - void handleCloseEvent(screen_event_t event); screen_context_t m_screenContext; - QPlatformScreen& m_platformScreen; bool m_quit; - QPoint m_lastGlobalMousePoint; - QPoint m_lastLocalMousePoint; - Qt::MouseButtons m_lastButtonState; - screen_window_t m_lastMouseWindow; - QTouchDevice *m_touchDevice; - QWindowSystemInterface::TouchPoint m_touchPoints[MaximumTouchPoints]; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 5ef34f3aea..00ba7d825e 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -108,7 +108,7 @@ QQnxIntegration::QQnxIntegration() QQnxGLContext::initialize(); // Create/start event thread - m_eventThread = new QQnxEventThread(m_screenContext, *QQnxScreen::primaryDisplay()); + m_eventThread = new QQnxEventThread(m_screenContext); m_eventThread->start(); // Create/start navigator event handler diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp new file mode 100644 index 0000000000..9ac5ca4a05 --- /dev/null +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -0,0 +1,473 @@ +/*************************************************************************** +** +** Copyright (C) 2011 - 2012 Research In Motion +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qqnxscreeneventhandler.h" +#include "qqnxintegration.h" +#include "qqnxkeytranslator.h" + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +QQnxScreenEventHandler::QQnxScreenEventHandler() + : m_lastButtonState(Qt::NoButton) + , m_lastMouseWindow(0) + , m_touchDevice(0) +{ + // Create a touch device + m_touchDevice = new QTouchDevice; + m_touchDevice->setType(QTouchDevice::TouchScreen); + m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure | QTouchDevice::NormalizedPosition); + QWindowSystemInterface::registerTouchDevice(m_touchDevice); + + // initialize array of touch points + for (int i = 0; i < MaximumTouchPoints; i++) { + + // map array index to id + m_touchPoints[i].id = i; + + // pressure is not supported - use default + m_touchPoints[i].pressure = 1.0; + + // nothing touching + m_touchPoints[i].state = Qt::TouchPointReleased; + } +} + +bool QQnxScreenEventHandler::handleEvent(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("QQNX: failed to query event type, errno=%d", errno); + } + + return handleEvent(event, qnxType); +} + +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_CLOSE: + handleCloseEvent(event); + break; + + default: + // event ignored +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: QNX unknown event"; +#endif + return false; + } + + return true; +} + +void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifiers, int scan, int cap) +{ + Q_UNUSED(scan); + + Qt::KeyboardModifiers qtMod = Qt::NoModifier; + if (modifiers & KEYMOD_SHIFT) + qtMod |= Qt::ShiftModifier; + if (modifiers & KEYMOD_CTRL) + qtMod |= Qt::ControlModifier; + if (modifiers & KEYMOD_ALT) + qtMod |= Qt::AltModifier; + + // determine event type + QEvent::Type type = (flags & KEY_DOWN) ? QEvent::KeyPress : QEvent::KeyRelease; + + // Check if the key cap is valid + if (flags & KEY_CAP_VALID) { + Qt::Key key; + QString keyStr; + + if (cap >= 0x20 && cap <= 0x0ff) { + key = Qt::Key(std::toupper(cap)); // Qt expects the CAP to be upper case. + + if ( qtMod & Qt::ControlModifier ) { + keyStr = QChar((int)(key & 0x3f)); + } else { + if (flags & KEY_SYM_VALID) { + keyStr = QChar(sym); + } + } + } else if ((cap > 0x0ff && cap < UNICODE_PRIVATE_USE_AREA_FIRST) || cap > UNICODE_PRIVATE_USE_AREA_LAST) { + key = (Qt::Key)cap; + keyStr = QChar(sym); + } else { + if (isKeypadKey(cap)) + qtMod |= Qt::KeypadModifier; // Is this right? + key = keyTranslator(cap); + } + + QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, keyStr); +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt key t=" << type << ", k=" << key << ", s=" << keyStr; +#endif + } +} + +void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event) +{ + // get flags of key event + errno = 0; + int flags; + int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags); + if (result) { + qFatal("QQNX: failed to query event flags, errno=%d", errno); + } + + // get key code + errno = 0; + int sym; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym); + if (result) { + qFatal("QQNX: failed to query event sym, errno=%d", errno); + } + + int modifiers; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers); + if (result) { + qFatal("QQNX: failed to query event modifiers, errno=%d", errno); + } + + int scan; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan); + if (result) { + qFatal("QQNX: failed to query event modifiers, errno=%d", errno); + } + + int cap; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap); + if (result) { + qFatal("QQNX: failed to query event cap, errno=%d", errno); + } + + injectKeyboardEvent(flags, sym, modifiers, scan, cap); +} + +void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) +{ + errno = 0; + + // Query the window that was clicked + screen_window_t qnxWindow; + void *handle; + int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); + if (result) { + qFatal("QQNX: failed to query event window, errno=%d", errno); + } + qnxWindow = static_cast(handle); + + // Query the button states + int buttonState = 0; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState); + if (result) { + qFatal("QQNX: failed to query event button state, errno=%d", errno); + } + + // Query the window position + int windowPos[2]; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos); + if (result) { + qFatal("QQNX: failed to query event window position, errno=%d", errno); + } + + // Query the screen position + int pos[2]; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos); + if (result) { + qFatal("QQNX: failed to query event position, errno=%d", errno); + } + + // Query the wheel delta + int wheelDelta = 0; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta); + if (result) { + qFatal("QQNX: failed to query event wheel delta, errno=%d", errno); + } + + // Map window handle to top-level QWindow + QWindow *w = QQnxIntegration::window(qnxWindow); + + // Generate enter and leave events as needed. + if (qnxWindow != m_lastMouseWindow) { + QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow); + + if (wOld) { + QWindowSystemInterface::handleLeaveEvent(wOld); +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt leave, w=" << wOld; +#endif + } + + if (w) { + QWindowSystemInterface::handleEnterEvent(w); +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt enter, w=" << w; +#endif + } + } + m_lastMouseWindow = qnxWindow; + + // Apply scaling to wheel delta and invert value for Qt. We'll probably want to scale + // this via a system preference at some point. But for now this is a sane value and makes + // the wheel usable. + wheelDelta *= -10; + + // convert point to local coordinates + QPoint globalPoint(pos[0], pos[1]); + QPoint localPoint(windowPos[0], windowPos[1]); + + // Convert buttons. + // Some QNX header files invert 'Right Button versus "Left Button' ('Right' == 0x01). But they also offer a 'Button Swap' bit, + // so we may receive events as shown. (If this is wrong, the fix is easy.) + // QNX Button mask is 8 buttons wide, with a maximum value of x080. + Qt::MouseButtons buttons = Qt::NoButton; + if (buttonState & 0x01) + buttons |= Qt::LeftButton; + if (buttonState & 0x02) + buttons |= Qt::MidButton; + if (buttonState & 0x04) + buttons |= Qt::RightButton; + if (buttonState & 0x08) + buttons |= Qt::ExtraButton1; // AKA 'Qt::BackButton' + if (buttonState & 0x10) + buttons |= Qt::ExtraButton2; // AKA 'Qt::ForwardButton' + if (buttonState & 0x20) + buttons |= Qt::ExtraButton3; + if (buttonState & 0x40) + buttons |= Qt::ExtraButton4; + if (buttonState & 0x80) + buttons |= Qt::ExtraButton5; + + if (w) { + // Inject mouse event into Qt only if something has changed. + if (m_lastGlobalMousePoint != globalPoint || + m_lastLocalMousePoint != localPoint || + m_lastButtonState != buttons) { + QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons); +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast(buttons); +#endif + } + + if (wheelDelta) { + // Screen only supports a single wheel, so we will assume Vertical orientation for + // now since that is pretty much standard. + QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical); +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast(wheelDelta); +#endif + } + } + + m_lastGlobalMousePoint = globalPoint; + m_lastLocalMousePoint = localPoint; + m_lastButtonState = buttons; +} + +void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) +{ + // get display coordinates of touch + errno = 0; + int pos[2]; + int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos); + if (result) { + qFatal("QQNX: failed to query event position, errno=%d", errno); + } + + // get window coordinates of touch + errno = 0; + int windowPos[2]; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos); + if (result) { + qFatal("QQNX: failed to query event window position, errno=%d", errno); + } + + // determine which finger touched + errno = 0; + int touchId; + result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, &touchId); + if (result) { + qFatal("QQNX: failed to query event touch id, errno=%d", errno); + } + + // determine which window was touched + errno = 0; + void *handle; + result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); + if (result) { + qFatal("QQNX: failed to query event window, errno=%d", errno); + } + screen_window_t qnxWindow = static_cast(handle); + + // check if finger is valid + if (touchId < MaximumTouchPoints) { + + // Map window handle to top-level QWindow + QWindow *w = QQnxIntegration::window(qnxWindow); + + // Generate enter and leave events as needed. + if (qnxWindow != m_lastMouseWindow) { + QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow); + + if (wOld) { + QWindowSystemInterface::handleLeaveEvent(wOld); + #if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt leave, w=" << wOld; + #endif + } + + if (w) { + QWindowSystemInterface::handleEnterEvent(w); + #if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt enter, w=" << w; + #endif + } + } + m_lastMouseWindow = qnxWindow; + + if (w) { + // convert primary touch to mouse event + if (touchId == 0) { + + // convert point to local coordinates + QPoint globalPoint(pos[0], pos[1]); + QPoint localPoint(windowPos[0], windowPos[1]); + + // map touch state to button state + Qt::MouseButtons buttons = (qnxType == SCREEN_EVENT_MTOUCH_RELEASE) ? Qt::NoButton : Qt::LeftButton; + + // inject event into Qt + QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons); +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << buttons; +#endif + } + + // get size of screen which contains window + QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w); + QSizeF screenSize = platformScreen->physicalSize(); + + // update cached position of current touch point + m_touchPoints[touchId].normalPosition = QPointF( static_cast(pos[0]) / screenSize.width(), static_cast(pos[1]) / screenSize.height() ); + m_touchPoints[touchId].area = QRectF( pos[0], pos[1], 0.0, 0.0 ); + + // determine event type and update state of current touch point + QEvent::Type type = QEvent::None; + switch (qnxType) { + case SCREEN_EVENT_MTOUCH_TOUCH: + m_touchPoints[touchId].state = Qt::TouchPointPressed; + type = QEvent::TouchBegin; + break; + case SCREEN_EVENT_MTOUCH_MOVE: + m_touchPoints[touchId].state = Qt::TouchPointMoved; + type = QEvent::TouchUpdate; + break; + case SCREEN_EVENT_MTOUCH_RELEASE: + m_touchPoints[touchId].state = Qt::TouchPointReleased; + type = QEvent::TouchEnd; + break; + } + + // build list of active touch points + QList pointList; + for (int i = 0; i < MaximumTouchPoints; i++) { + if (i == touchId) { + // current touch point is always active + pointList.append(m_touchPoints[i]); + } else if (m_touchPoints[i].state != Qt::TouchPointReleased) { + // finger is down but did not move + m_touchPoints[i].state = Qt::TouchPointStationary; + pointList.append(m_touchPoints[i]); + } + } + + // inject event into Qt + QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList); +#if defined(QQNXSCREENEVENT_DEBUG) + qDebug() << "QQNX: Qt touch, w=" << w << ", p=(" << pos[0] << "," << pos[1] << "), t=" << type; +#endif + } + } +} + +void QQnxScreenEventHandler::handleCloseEvent(screen_event_t event) +{ + // Query the window that was closed + void *handle; + int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); + if (result != 0) { + qFatal("QQNX: failed to query event window, errno=%d", errno); + } + screen_window_t qnxWindow = static_cast(handle); + + // Map window handle to top-level QWindow + QWindow *w = QQnxIntegration::window(qnxWindow); + if (w != 0) { + QWindowSystemInterface::handleCloseEvent(w); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h new file mode 100644 index 0000000000..365351766c --- /dev/null +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h @@ -0,0 +1,82 @@ +/*************************************************************************** +** +** Copyright (C) 2011 - 2012 Research In Motion +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQNXSCREENEVENTHANDLER_H +#define QQNXSCREENEVENTHANDLER_H + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QQnxScreenEventHandler +{ +public: + QQnxScreenEventHandler(); + + bool handleEvent(screen_event_t event); + bool handleEvent(screen_event_t event, int qnxType); + + static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap); + +private: + void handleKeyboardEvent(screen_event_t event); + void handlePointerEvent(screen_event_t event); + void handleTouchEvent(screen_event_t event, int qnxType); + void handleCloseEvent(screen_event_t event); + +private: + enum { + MaximumTouchPoints = 10 + }; + + QPoint m_lastGlobalMousePoint; + QPoint m_lastLocalMousePoint; + Qt::MouseButtons m_lastButtonState; + screen_window_t m_lastMouseWindow; + QTouchDevice *m_touchDevice; + QWindowSystemInterface::TouchPoint m_touchPoints[MaximumTouchPoints]; +}; + +QT_END_NAMESPACE + +#endif // QQNXSCREENEVENTHANDLER_H From 5d117fd427e3e727df5d3f417a2b91366f2a31c1 Mon Sep 17 00:00:00 2001 From: Kevin Krammer Date: Fri, 23 Mar 2012 12:50:22 +0100 Subject: [PATCH 04/15] Refactoring virtual keyboard class into non-singleton Getting rid of the singleton gives us better control over when the virtual keyboard handling class is instantiated and configured. Also notify screens about keyboard height changes and let them notify through QWindowSystemInterface instead of "guessing" the screen in QQnxVirtualKeyboard. Change-Id: I71a7f6b5e9d5455563404f6abe7a0daec567a12d Reviewed-by: Sean Harmer Reviewed-by: Robin Burchell --- .../platforms/qnx/qqnxinputcontext_imf.cpp | 24 ++++---- .../platforms/qnx/qqnxinputcontext_imf.h | 5 +- .../platforms/qnx/qqnxinputcontext_noimf.cpp | 28 +++++---- .../platforms/qnx/qqnxinputcontext_noimf.h | 5 +- src/plugins/platforms/qnx/qqnxintegration.cpp | 19 +++++- src/plugins/platforms/qnx/qqnxintegration.h | 2 + src/plugins/platforms/qnx/qqnxscreen.cpp | 17 +++++- src/plugins/platforms/qnx/qqnxscreen.h | 9 ++- .../platforms/qnx/qqnxvirtualkeyboard.cpp | 59 +++++-------------- .../platforms/qnx/qqnxvirtualkeyboard.h | 14 ++--- 10 files changed, 98 insertions(+), 84 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 3f9d768ccc..3cf2d4ed62 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -674,12 +674,15 @@ static bool imfAvailable() return s_imfReady; } -QQnxInputContext::QQnxInputContext(): +QT_BEGIN_NAMESPACE + +QQnxInputContext::QQnxInputContext(QQnxVirtualKeyboard &keyboard): QPlatformInputContext(), m_lastCaretPos(0), m_isComposing(false), m_inputPanelVisible(false), - m_inputPanelLocale(QLocale::c()) + m_inputPanelLocale(QLocale::c()), + m_virtualKeyboad(keyboard) { #if defined(QQNXINPUTCONTEXT_DEBUG) qDebug() << Q_FUNC_INFO; @@ -697,7 +700,6 @@ QQnxInputContext::QQnxInputContext(): // p_vkb_init_selection_service(); - QQnxVirtualKeyboard &keyboard = QQnxVirtualKeyboard::instance(); connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool))); connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale))); keyboardVisibilityChanged(keyboard.isVisible()); @@ -959,7 +961,7 @@ bool QQnxInputContext::hasSelectedText() bool QQnxInputContext::dispatchRequestSoftwareInputPanel() { - QQnxVirtualKeyboard::instance().showKeyboard(); + m_virtualKeyboard.showKeyboard(); #if defined(QQNXINPUTCONTEXT_DEBUG) qDebug() << "QQNX: requesting virtual keyboard"; #endif @@ -986,7 +988,7 @@ bool QQnxInputContext::dispatchRequestSoftwareInputPanel() bool QQnxInputContext::dispatchCloseSoftwareInputPanel() { - QQnxVirtualKeyboard::instance().hideKeyboard(); + m_virtualKeyboard.hideKeyboard(); #if defined(QQNXINPUTCONTEXT_DEBUG) qDebug() << "QQNX: hiding virtual keyboard"; #endif @@ -1685,12 +1687,14 @@ void QQnxInputContext::inputItemChanged() if (m_inputPanelVisible) hideInputPanel(); } else { - if (qobject_cast(inputItem)) { - QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::NumPunc); - } else { - QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::Default); - } + if (qobject_cast(inputItem)) + m_virtualKeyboard.setKeyboardMode(QQnxVirtualKeyboard::Phone); + else + m_virtualKeyboard.setKeyboardMode(QQnxVirtualKeyboard::Default); + if (!m_inputPanelVisible) showInputPanel(); } } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h index 1fb55296a6..2574e19527 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h @@ -53,11 +53,13 @@ QT_BEGIN_NAMESPACE +class QQnxVirtualKeyboard; + class QQnxInputContext : public QPlatformInputContext { Q_OBJECT public: - QQnxInputContext(); + QQnxInputContext(QQnxVirtualKeyboard &keyboard); ~QQnxInputContext(); virtual bool isValid() const; @@ -123,6 +125,7 @@ private: QString m_composingText; bool m_inputPanelVisible; QLocale m_inputPanelLocale; + QQnxVirtualKeyboard &m_virtualKeyboad; }; Q_DECLARE_METATYPE(extracted_text_t*) diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 33b6c0e6f3..6c8a0abe17 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -46,12 +46,14 @@ #include #include -QQnxInputContext::QQnxInputContext() : +QT_BEGIN_NAMESPACE + +QQnxInputContext::QQnxInputContext(QQnxVirtualKeyboard &keyboard) : QPlatformInputContext(), m_inputPanelVisible(false), - m_inputPanelLocale(QLocale::c()) + m_inputPanelLocale(QLocale::c()), + m_virtualKeyboard(keyboard) { - QQnxVirtualKeyboard &keyboard = QQnxVirtualKeyboard::instance(); connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool))); connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale))); keyboardVisibilityChanged(keyboard.isVisible()); @@ -86,7 +88,7 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) return false; if (event->type() == QEvent::CloseSoftwareInputPanel) { - QQnxVirtualKeyboard::instance().hideKeyboard(); + m_virtualKeyboard.hideKeyboard(); #if defined(QQNXINPUTCONTEXT_DEBUG) qDebug() << "QQNX: hiding virtual keyboard"; #endif @@ -94,7 +96,7 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) } if (event->type() == QEvent::RequestSoftwareInputPanel) { - QQnxVirtualKeyboard::instance().showKeyboard(); + m_virtualKeyboard.showKeyboard(); #if defined(QQNXINPUTCONTEXT_DEBUG) qDebug() << "QQNX: requesting virtual keyboard"; #endif @@ -120,7 +122,7 @@ void QQnxInputContext::showInputPanel() #if defined(QQNXINPUTCONTEXT_DEBUG) qDebug() << Q_FUNC_INFO; #endif - QQnxVirtualKeyboard::instance().showKeyboard(); + m_virtualKeyboard.showKeyboard(); } void QQnxInputContext::hideInputPanel() @@ -128,7 +130,7 @@ void QQnxInputContext::hideInputPanel() #if defined(QQNXINPUTCONTEXT_DEBUG) qDebug() << Q_FUNC_INFO; #endif - QQnxVirtualKeyboard::instance().hideKeyboard(); + m_virtualKeyboard.hideKeyboard(); } bool QQnxInputContext::isInputPanelVisible() const @@ -176,12 +178,14 @@ void QQnxInputContext::inputItemChanged() if (m_inputPanelVisible) hideInputPanel(); } else { - if (qobject_cast(inputItem)) { - QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::NumPunc); - } else { - QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::Default); - } + if (qobject_cast(inputItem)) + m_virtualKeyboard.setKeyboardMode(QQnxVirtualKeyboard::Phone); + else + m_virtualKeyboard.setKeyboardMode(QQnxVirtualKeyboard::Default); + if (!m_inputPanelVisible) showInputPanel(); } } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h index 33a4631d16..efc501b65f 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h @@ -48,11 +48,13 @@ QT_BEGIN_NAMESPACE +class QQnxVirtualKeyboard; + class QQnxInputContext : public QPlatformInputContext { Q_OBJECT public: - explicit QQnxInputContext(); + explicit QQnxInputContext(QQnxVirtualKeyboard &keyboard); ~QQnxInputContext(); virtual bool isValid() const; @@ -77,6 +79,7 @@ private: bool m_inputPanelVisible; QLocale m_inputPanelLocale; + QQnxVirtualKeyboard &m_virtualKeyboard; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 00ba7d825e..bb31de874b 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -79,6 +79,7 @@ QQnxIntegration::QQnxIntegration() : QPlatformIntegration() , m_eventThread(0) , m_navigatorEventHandler(0) + , m_virtualKeyboard(0) , m_inputContext(0) , m_fontDatabase(new QGenericUnixFontDatabase()) , m_paintUsingOpenGL(false) @@ -122,10 +123,18 @@ QQnxIntegration::QQnxIntegration() #endif // Create/start the keyboard class. - QQnxVirtualKeyboard::instance(); + m_virtualKeyboard = new QQnxVirtualKeyboard(); + + // delay invocation of start() to the time the event loop is up and running + // needed to have the QThread internals of the main thread properly initialized + QMetaObject::invokeMethod(m_virtualKeyboard, "start", Qt::QueuedConnection); + + // TODO check if we need to do this for all screens or only the primary one + QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)), + QQnxScreen::primaryDisplay(), SLOT(keyboardHeightChanged(int))); // Set up the input context - m_inputContext = new QQnxInputContext; + m_inputContext = new QQnxInputContext(*m_virtualKeyboard); // Create services handling class #ifdef Q_OS_BLACKBERRY @@ -138,8 +147,12 @@ QQnxIntegration::~QQnxIntegration() #if defined(QQNXINTEGRATION_DEBUG) qDebug() << "QQnx: platform plugin shutdown begin"; #endif + + // Destroy input context + delete m_inputContext; + // Destroy the keyboard class. - QQnxVirtualKeyboard::destroy(); + delete m_virtualKeyboard; #ifndef QT_NO_CLIPBOARD // Delete the clipboard diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index 6aa16100ad..6b4a4a1651 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE class QQnxEventThread; class QQnxInputContext; class QQnxNavigatorEventHandler; +class QQnxVirtualKeyboard; class QQnxWindow; class QQnxServices; @@ -103,6 +104,7 @@ private: screen_context_t m_screenContext; QQnxEventThread *m_eventThread; QQnxNavigatorEventHandler *m_navigatorEventHandler; + QQnxVirtualKeyboard *m_virtualKeyboard; QQnxInputContext *m_inputContext; QPlatformFontDatabase *m_fontDatabase; bool m_paintUsingOpenGL; diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index cd77c3088a..1fef0bc0a7 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -40,11 +40,11 @@ ****************************************************************************/ #include "qqnxscreen.h" -#include "qqnxvirtualkeyboard.h" #include "qqnxwindow.h" #include #include +#include #include @@ -59,6 +59,7 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_rootWindow(), m_primaryScreen(primaryScreen), m_posted(false), + m_keyboardHeight(0), m_platformContext(0) { #if defined(QQNXSCREEN_DEBUG) @@ -182,9 +183,8 @@ QRect QQnxScreen::availableGeometry() const qDebug() << Q_FUNC_INFO; #endif // available geometry = total geometry - keyboard - int keyboardHeight = QQnxVirtualKeyboard::instance().height(); return QRect(m_currentGeometry.x(), m_currentGeometry.y(), - m_currentGeometry.width(), m_currentGeometry.height() - keyboardHeight); + m_currentGeometry.width(), m_currentGeometry.height() - m_keyboardHeight); } /*! @@ -312,4 +312,15 @@ void QQnxScreen::onWindowPost(QQnxWindow *window) } } +void QQnxScreen::keyboardHeightChanged(int height) +{ + if (height == m_keyboardHeight) + return; + + m_keyboardHeight = height; + + QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), availableGeometry()); +} + + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 5749a66f5d..4d1590349b 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -47,6 +47,7 @@ #include "qqnxrootwindow.h" #include +#include #include #include @@ -55,8 +56,9 @@ QT_BEGIN_NAMESPACE class QQnxWindow; -class QQnxScreen : public QPlatformScreen +class QQnxScreen : public QObject, public QPlatformScreen { + Q_OBJECT public: static QList screens() { return ms_screens; } static void createDisplays(screen_context_t context); @@ -91,6 +93,9 @@ public: QSharedPointer rootWindow() const { return m_rootWindow; } +private Q_SLOTS: + void keyboardHeightChanged(int height); + private: QQnxScreen(screen_context_t context, screen_display_t display, bool primaryScreen); virtual ~QQnxScreen(); @@ -102,10 +107,10 @@ private: QSharedPointer m_rootWindow; bool m_primaryScreen; bool m_posted; - bool m_usingOpenGL; int m_initialRotation; int m_currentRotation; + int m_keyboardHeight; QSize m_initialPhysicalSize; QSize m_currentPhysicalSize; QRect m_initialGeometry; diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp index 20c89d3e32..afdd7715db 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp @@ -42,9 +42,6 @@ #include "qqnxvirtualkeyboard.h" #include "qqnxscreen.h" -#include -#include - #include #include #include @@ -59,11 +56,11 @@ #include #include +QT_BEGIN_NAMESPACE + const char *QQnxVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait"; const size_t QQnxVirtualKeyboard::ms_bufferSize = 2048; -static QQnxVirtualKeyboard *s_instance = 0; - // Huge hack for keyboard shadow (see QNX PR 88400). Should be removed ASAP. #define KEYBOARD_SHADOW_HEIGHT 8 @@ -85,20 +82,6 @@ QQnxVirtualKeyboard::~QQnxVirtualKeyboard() close(); } -/* static */ -QQnxVirtualKeyboard& QQnxVirtualKeyboard::instance() -{ - if (!s_instance) { - s_instance = new QQnxVirtualKeyboard(); - - // delay invocation of start() to the time the event loop is up and running - // needed to have the QThread internals of the main thread properly initialized - QMetaObject::invokeMethod(s_instance, "start", Qt::QueuedConnection); - } - - return *s_instance; -} - void QQnxVirtualKeyboard::start() { #ifdef QQNXVIRTUALKEYBOARD_DEBUG @@ -108,15 +91,6 @@ void QQnxVirtualKeyboard::start() return; } -/* static */ -void QQnxVirtualKeyboard::destroy() -{ - if (s_instance) { - delete s_instance; - s_instance = 0; - } -} - void QQnxVirtualKeyboard::close() { delete m_readNotifier; @@ -292,7 +266,8 @@ void QQnxVirtualKeyboard::handleKeyboardInfoMessage() if (newHeight != m_height) { m_height = newHeight; - updateAvailableScreenGeometry(); + if (m_visible) + emit heightChanged(m_height); } const QLocale locale = QLocale(languageId + QLatin1Char('_') + countryId); @@ -312,7 +287,8 @@ void QQnxVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible) #ifdef QQNXVIRTUALKEYBOARD_DEBUG qDebug() << "QQNX: handleKeyboardStateChangeMessage " << visible; #endif - updateAvailableScreenGeometry(); + if (visible != m_visible) + emit heightChanged(height()); if (visible) showKeyboard(); @@ -320,19 +296,6 @@ void QQnxVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible) hideKeyboard(); } -void QQnxVirtualKeyboard::updateAvailableScreenGeometry() -{ -#ifdef QQNXVIRTUALKEYBOARD_DEBUG - qDebug() << "QQNX: updateAvailableScreenGeometry: keyboard visible=" << m_visible << ", keyboard height=" << m_height; -#endif - - // TODO: What screen index should be used? I assume primaryScreen here because it works, and - // we do it for handleScreenGeometryChange elsewhere but since we have support - // for more than one screen, that's not going to always work. - QQnxScreen *platformScreen = QQnxScreen::primaryDisplay(); - QWindowSystemInterface::handleScreenAvailableGeometryChange(platformScreen->screen(), platformScreen->availableGeometry()); -} - bool QQnxVirtualKeyboard::showKeyboard() { #ifdef QQNXVIRTUALKEYBOARD_DEBUG @@ -347,6 +310,9 @@ bool QQnxVirtualKeyboard::showKeyboard() // hiding the keyboard wipes the setting. applyKeyboardModeOptions(); + if (m_visible) + return true; + pps_encoder_reset(m_encoder); // Send the show message. @@ -398,7 +364,12 @@ bool QQnxVirtualKeyboard::hideKeyboard() void QQnxVirtualKeyboard::setKeyboardMode(KeyboardMode mode) { + if (m_keyboardMode == mode) + return; + m_keyboardMode = mode; + if (m_visible) + applyKeyboardModeOptions(); } void QQnxVirtualKeyboard::applyKeyboardModeOptions() @@ -495,3 +466,5 @@ void QQnxVirtualKeyboard::addSymbolModeOptions() pps_encoder_add_string(m_encoder, "enter", "enter.default"); pps_encoder_add_string(m_encoder, "type", "symbol"); } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h index 73a296fb9f..9f29a077e6 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h @@ -45,17 +45,16 @@ #include #include #include -#include #include #include #include #include -class QSocketNotifier; - QT_BEGIN_NAMESPACE +class QSocketNotifier; + /* Shamelessly copied from the browser - this should be rewritten once we have a proper PPS wrapper class */ class QQnxVirtualKeyboard : public QObject { @@ -74,8 +73,8 @@ public: // enum KeyboardMode { Default, Url, Email, Web, NumPunc, Symbol, Phone, Pin }; - static QQnxVirtualKeyboard& instance(); - static void destroy(); + QQnxVirtualKeyboard(); + ~QQnxVirtualKeyboard(); bool showKeyboard(); bool hideKeyboard(); @@ -91,21 +90,18 @@ public Q_SLOTS: Q_SIGNALS: void localeChanged(const QLocale &locale); void visibilityChanged(bool visible); + void heightChanged(int height); private Q_SLOTS: void ppsDataReady(); private: - QQnxVirtualKeyboard(); - virtual ~QQnxVirtualKeyboard(); - // Will be called internally if needed. bool connect(); void close(); bool queryPPSInfo(); void handleKeyboardInfoMessage(); void handleKeyboardStateChangeMessage(bool visible); - void updateAvailableScreenGeometry(); void applyKeyboardModeOptions(); void addDefaultModeOptions(); From 68ecbffb303490beef2ebfa7d8cdb66a7ca73469 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Mon, 26 Mar 2012 15:26:24 +0200 Subject: [PATCH 05/15] Remove the virtual keyword from reimpl. methods Qt Coding Standards state that "when reimplementing a virtual method, do not put the virtual keyword in the header file'". Change-Id: I89ae34eee78ad5b58a3e41845384a656225ed658 Reviewed-by: Kevin Krammer Reviewed-by: Robin Burchell Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxclipboard.h | 6 ++--- src/plugins/platforms/qnx/qqnxeventthread.h | 2 +- .../platforms/qnx/qqnxglbackingstore.h | 20 +++++++------- src/plugins/platforms/qnx/qqnxglcontext.h | 8 +++--- .../platforms/qnx/qqnxinputcontext_imf.h | 16 ++++++------ .../platforms/qnx/qqnxinputcontext_noimf.h | 12 ++++----- src/plugins/platforms/qnx/qqnxintegration.h | 26 +++++++++---------- .../platforms/qnx/qqnxrasterbackingstore.h | 14 +++++----- src/plugins/platforms/qnx/qqnxscreen.h | 12 ++++----- src/plugins/platforms/qnx/qqnxwindow.h | 16 ++++++------ 10 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxclipboard.h b/src/plugins/platforms/qnx/qqnxclipboard.h index 1104885d8c..c9ceff41f6 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.h +++ b/src/plugins/platforms/qnx/qqnxclipboard.h @@ -51,9 +51,9 @@ class QQnxClipboard : public QPlatformClipboard { public: QQnxClipboard(); - virtual ~QQnxClipboard(); - virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); - virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); + ~QQnxClipboard(); + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); private: class MimeData; diff --git a/src/plugins/platforms/qnx/qqnxeventthread.h b/src/plugins/platforms/qnx/qqnxeventthread.h index 9724587c37..0bb26c3c06 100644 --- a/src/plugins/platforms/qnx/qqnxeventthread.h +++ b/src/plugins/platforms/qnx/qqnxeventthread.h @@ -57,7 +57,7 @@ public: static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap); protected: - virtual void run(); + void run(); private: void shutdown(); diff --git a/src/plugins/platforms/qnx/qqnxglbackingstore.h b/src/plugins/platforms/qnx/qqnxglbackingstore.h index d04fe22f5d..b694079f37 100644 --- a/src/plugins/platforms/qnx/qqnxglbackingstore.h +++ b/src/plugins/platforms/qnx/qqnxglbackingstore.h @@ -58,11 +58,11 @@ class QQnxGLPaintDevice : public QGLPaintDevice { public: QQnxGLPaintDevice(QWindow *window); - virtual ~QQnxGLPaintDevice(); + ~QQnxGLPaintDevice(); - virtual QPaintEngine *paintEngine() const; - virtual QSize size() const; - virtual QGLContext *context() const { return m_glContext; } + QPaintEngine *paintEngine() const; + QSize size() const; + QGLContext *context() const { return m_glContext; } private: QQnxWindow *m_window; @@ -73,13 +73,13 @@ class QQnxGLBackingStore : public QPlatformBackingStore { public: QQnxGLBackingStore(QWindow *window); - virtual ~QQnxGLBackingStore(); + ~QQnxGLBackingStore(); - virtual QPaintDevice *paintDevice() { return m_paintDevice; } - virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - virtual void resize(const QSize &size, const QRegion &staticContents); - virtual void beginPaint(const QRegion ®ion); - virtual void endPaint(const QRegion ®ion); + QPaintDevice *paintDevice() { return m_paintDevice; } + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); void resizeSurface(const QSize &size); diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index 36c439802a..ee8d61ce00 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -61,10 +61,10 @@ public: static void initialize(); static void shutdown(); - virtual bool makeCurrent(QPlatformSurface *surface); - virtual void doneCurrent(); - virtual void swapBuffers(QPlatformSurface *surface); - virtual QFunctionPointer getProcAddress(const QByteArray &procName); + bool makeCurrent(QPlatformSurface *surface); + void doneCurrent(); + void swapBuffers(QPlatformSurface *surface); + QFunctionPointer getProcAddress(const QByteArray &procName); virtual QSurfaceFormat format() const { return m_windowFormat; } diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h index 2574e19527..16972fbf00 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h @@ -62,18 +62,18 @@ public: QQnxInputContext(QQnxVirtualKeyboard &keyboard); ~QQnxInputContext(); - virtual bool isValid() const; + bool isValid() const; - virtual bool filterEvent(const QEvent *event); - virtual void reset(); - virtual void update(Qt::InputMethodQueries); + bool filterEvent(const QEvent *event); + void reset(); + void update(Qt::InputMethodQueries); bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); - virtual void showInputPanel(); - virtual void hideInputPanel(); - virtual bool isInputPanelVisible() const; + void showInputPanel(); + void hideInputPanel(); + bool isInputPanelVisible() const; - virtual QLocale locale() const; + QLocale locale() const; protected: // Filters only for IMF events. diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h index efc501b65f..50927d244b 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h @@ -57,17 +57,17 @@ public: explicit QQnxInputContext(QQnxVirtualKeyboard &keyboard); ~QQnxInputContext(); - virtual bool isValid() const; + bool isValid() const; void reset(); - virtual bool filterEvent( const QEvent *event ); + bool filterEvent( const QEvent *event ); bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); - virtual void showInputPanel(); - virtual void hideInputPanel(); - virtual bool isInputPanelVisible() const; + void showInputPanel(); + void hideInputPanel(); + bool isInputPanelVisible() const; - virtual QLocale locale() const; + QLocale locale() const; private Q_SLOTS: void keyboardVisibilityChanged(bool visible); diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index 6b4a4a1651..3c291c3f49 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -68,32 +68,32 @@ class QQnxIntegration : public QPlatformIntegration { public: QQnxIntegration(); - virtual ~QQnxIntegration(); + ~QQnxIntegration(); - virtual bool hasCapability(QPlatformIntegration::Capability cap) const; + bool hasCapability(QPlatformIntegration::Capability cap) const; - virtual QPlatformWindow *createPlatformWindow(QWindow *window) const; - virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; - virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; - virtual QPlatformInputContext *inputContext() const; + QPlatformInputContext *inputContext() const; - virtual QList screens() const; - virtual void moveToScreen(QWindow *window, int screen); + QList screens() const; + void moveToScreen(QWindow *window, int screen); - virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; - virtual QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; } + QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; } #ifndef QT_NO_CLIPBOARD - virtual QPlatformClipboard *clipboard() const; + QPlatformClipboard *clipboard() const; #endif - virtual QVariant styleHint(StyleHint hint) const; + QVariant styleHint(StyleHint hint) const; bool paintUsingOpenGL() const { return m_paintUsingOpenGL; } - virtual QPlatformServices *services() const; + QPlatformServices *services() const; static QWindow *window(screen_window_t qnxWindow); diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h index fec51a19b9..7a7f211e9a 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h @@ -54,14 +54,14 @@ class QQnxRasterBackingStore : public QPlatformBackingStore { public: QQnxRasterBackingStore(QWindow *window); - virtual ~QQnxRasterBackingStore(); + ~QQnxRasterBackingStore(); - virtual QPaintDevice *paintDevice(); - virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - virtual void resize(const QSize &size, const QRegion &staticContents); - virtual bool scroll(const QRegion &area, int dx, int dy); - virtual void beginPaint(const QRegion ®ion); - virtual void endPaint(const QRegion ®ion); + QPaintDevice *paintDevice(); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); + bool scroll(const QRegion &area, int dx, int dy); + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); private: class ScrollOp { diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 4d1590349b..081114a4fb 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -66,11 +66,11 @@ public: static QQnxScreen *primaryDisplay() { return static_cast(ms_screens.at(0)); } static int defaultDepth(); - virtual QRect geometry() const { return m_currentGeometry; } - virtual QRect availableGeometry() const; - virtual int depth() const { return defaultDepth(); } - virtual QImage::Format format() const { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; } - virtual QSizeF physicalSize() const { return m_currentPhysicalSize; } + QRect geometry() const { return m_currentGeometry; } + QRect availableGeometry() const; + int depth() const { return defaultDepth(); } + QImage::Format format() const { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; } + QSizeF physicalSize() const { return m_currentPhysicalSize; } bool isPrimaryScreen() const { return m_primaryScreen; } @@ -98,7 +98,7 @@ private Q_SLOTS: private: QQnxScreen(screen_context_t context, screen_display_t display, bool primaryScreen); - virtual ~QQnxScreen(); + ~QQnxScreen(); static bool orthogonal(int rotation1, int rotation2); diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 9c03af7594..cbe4eba7a4 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -69,11 +69,11 @@ public: QQnxWindow(QWindow *window, screen_context_t context); virtual ~QQnxWindow(); - virtual void setGeometry(const QRect &rect); - virtual void setVisible(bool visible); - virtual void setOpacity(qreal level); + void setGeometry(const QRect &rect); + void setVisible(bool visible); + void setOpacity(qreal level); - virtual WId winId() const { return (WId)m_window; } + WId winId() const { return (WId)m_window; } screen_window_t nativeHandle() const { return m_window; } void setBufferSize(const QSize &size); @@ -86,10 +86,10 @@ public: void setScreen(QQnxScreen *platformScreen); - virtual void setParent(const QPlatformWindow *window); - virtual void raise(); - virtual void lower(); - virtual void requestActivateWindow(); + void setParent(const QPlatformWindow *window); + void raise(); + void lower(); + void requestActivateWindow(); void gainedFocus(); From d29b56f6042ab10fd85a9891d89900f7f209f1e5 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 27 Mar 2012 20:38:00 -0700 Subject: [PATCH 06/15] Document configure's -sysroot option -sysroot has been undocumented so far. Change-Id: I552f9233778de9490a3479292f0cda9c8c439282 Reviewed-by: Oswald Buddenhagen --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index d1040ba510..649ca5ba7b 100755 --- a/configure +++ b/configure @@ -3185,6 +3185,8 @@ Additional options: -xplatform target ... The target platform when cross-compiling. + -sysroot ...... Sets as the target compiler's and qmake's sysroot. + -no-feature- Do not compile in . -feature- .. Compile in . The available features are described in src/corelib/global/qfeatures.txt From 4ba9cecec201f5ff0263cac891225e22d2443b5c Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 27 Mar 2012 18:59:30 -0700 Subject: [PATCH 07/15] Remove sysroot detection configure parses the compiler from the mkspecs using an awk script. The detected compiler is then used to determine sysroot support. The awk script is currently unable to handle loading of qmake features and thus configure will not detect the compiler correctly. This is the case when using device profiles. The qdevice.pri is loaded through the qmake feature file device_config.prf. One possible way to fix this is to move this detection after qmake is built and make this a .pro based config.test. However, this cannot be done because the sysroot is actually baked into the qmake binary as the QT_SYSROOT variable. The solution is to remove this check completely and let the build fail when Qt starts compiling with --sysroot. Change-Id: I6c3b7ec2c8e5e390d6f5b1e602d656682d610b98 Reviewed-by: Oswald Buddenhagen --- configure | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 649ca5ba7b..99a5173b87 100755 --- a/configure +++ b/configure @@ -2538,15 +2538,10 @@ if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then fi fi -SYSROOT_FLAG= if [ -n "$CFG_SYSROOT" ]; then - if compilerSupportsFlag --sysroot="$CFG_SYSROOT"; then - [ "$OPT_VERBOSE" = "yes" ] && echo "Setting sysroot to: $CFG_SYSROOT" - SYSROOT_FLAG="--sysroot=$CFG_SYSROOT" - else - echo >&2 "The compiler doesn't support the --sysroot flag, I can't set the sysroot" - exit 1 - fi + SYSROOT_FLAG="--sysroot=$CFG_SYSROOT" +else + SYSROOT_FLAG= fi export SYSROOT_FLAG # used by config.tests/unix/compile.test From af3c7d35b6937d6b5ba94243f76b540e18a04567 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 27 Mar 2012 14:42:43 -0300 Subject: [PATCH 08/15] Fix qmake's use of Q_ASSERT with side-effects. The nice side-effect of having Q_ASSERT use the condition twice is that we break code that has side-effects. Change-Id: Ia0b7ed2a8030c8e222612af95eb2d58671433110 Reviewed-by: Oswald Buddenhagen --- qmake/project.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index b82b793319..8e4b1744b9 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1721,7 +1721,8 @@ QMakeProject::doProjectExpand(QString func, QList args_list, function_blocks.push(defined); QStringList ret; defined->exec(args_list, this, place, ret); - Q_ASSERT(function_blocks.pop() == defined); + bool correct = function_blocks.pop() == defined; + Q_ASSERT(correct); Q_UNUSED(correct); return ret; } @@ -2206,7 +2207,8 @@ QMakeProject::doProjectTest(QString func, QList args_list, QHashexec(args_list, this, place, ret); - Q_ASSERT(function_blocks.pop() == defined); + bool correct = function_blocks.pop() == defined; + Q_ASSERT(correct); Q_UNUSED(correct); if(ret.isEmpty()) { return true; From d6d997a36fc76132021ea45646a0069a756a62ac Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Dec 2011 19:28:23 -0200 Subject: [PATCH 09/15] Ensure that qdrawhelper.cpp is compiled with vectorisation active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GCC option -ftree-vectorize is enabled only at level -O3, so force -O3 if this is an optimised build. Also, ensure that we're using SSE for floating point math if we're in x86 (32-bit) builds. No change is necessary for the Intel compiler, since it enables vectorisation by default at any non-zero -O level. These options are not possible with MSVC. Change-Id: If1169a73cd8a3e8b34d9e21f281b78897b9aec3e Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 774678c67f..43c4781197 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -39,6 +39,15 @@ ** ****************************************************************************/ +#if defined(__OPTIMIZE__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) \ + && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404) +// GCC 4.4 supports #pragma GCC optimize and #pragma GCC target +# pragma GCC optimize "O3" +# if defined(__i386__) && defined(__SSE2__) && !defined(__SSE2_MATH__) +# pragma GCC target "fpmath=sse" +# endif +#endif + #include #include #include From 2ad8b637628335926d002a2409600d884858d225 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 31 Oct 2011 15:49:24 +0100 Subject: [PATCH 10/15] Fix warning introduced in Intel CC 12.1 Change-Id: Ie50b0bf0741637a3acfc39360804590f3c133332 Reviewed-by: Stephen Kelly Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobjectdefs.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 4b3829b53e..5588724d4c 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -140,6 +140,13 @@ template inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} #endif // QT_NO_QOBJECT_CHECK +#if defined(Q_CC_INTEL) +// Cannot redefine the visibility of a method in an exported class +# define Q_DECL_HIDDEN_STATIC_METACALL +#else +# define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN +#endif + /* tmake ignore Q_OBJECT */ #define Q_OBJECT \ public: \ @@ -151,7 +158,7 @@ public: \ virtual int qt_metacall(QMetaObject::Call, int, void **); \ private: \ Q_DECL_HIDDEN static const QMetaObjectExtraData staticMetaObjectExtraData; \ - Q_DECL_HIDDEN static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); + Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); /* tmake ignore Q_OBJECT */ #define Q_OBJECT_FAKE Q_OBJECT From 3df8a12f053b84a6112c30e336d51e662181e28e Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 28 Mar 2012 09:50:52 +0200 Subject: [PATCH 11/15] Compile fix for Linux Standard Base Change-Id: I1a6dba065c45bf732c0174ed0a6492cc80478985 Reviewed-by: Thiago Macieira --- src/corelib/thread/qthread_unix.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index a0913e5dbc..21ed8131df 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -90,7 +90,7 @@ # endif #endif -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) #include #endif @@ -110,7 +110,8 @@ QT_BEGIN_NAMESPACE enum { ThreadPriorityResetFlag = 0x80000000 }; -#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) +#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_LINUXBASE) +/* LSB doesn't have __thread, https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=993 */ #define HAVE_TLS #endif #if defined(Q_CC_XLC) || defined (Q_CC_SUN) @@ -294,7 +295,7 @@ void *QThreadPrivate::start(void *arg) if (objectName.isEmpty()) objectName = thr->metaObject()->className(); -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) prctl(PR_SET_NAME, (unsigned long)objectName.constData(), 0, 0, 0); #elif defined(Q_OS_MAC) pthread_setname_np(objectName.constData()); From 05d19296854fce08a1900a6b5865515f1fcb41aa Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Wed, 28 Mar 2012 13:59:52 +0200 Subject: [PATCH 12/15] qdoc: Use otherprops attribute for DITA signals/slots. Change-Id: Id85860abfb8abdf0b7bd95a65384576d8970096b Reviewed-by: Martin Smith --- src/tools/qdoc/ditaxmlgenerator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index a32b1c9633..47db5c89fb 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -4818,13 +4818,13 @@ void DitaXmlGenerator::writeFunctions(const Section& s, FunctionNode* fn = const_cast(static_cast(*m)); writeStartTag(DT_cxxFunction); xmlWriter().writeAttribute("id",fn->guid()); + if (fn->metaness() == FunctionNode::Signal) + xmlWriter().writeAttribute("otherprops","signal"); + else if (fn->metaness() == FunctionNode::Slot) + xmlWriter().writeAttribute("otherprops","slot"); if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); writeStartTag(DT_apiName); - if (fn->metaness() == FunctionNode::Signal) - xmlWriter().writeAttribute("outputclass","signal"); - else if (fn->metaness() == FunctionNode::Slot) - xmlWriter().writeAttribute("outputclass","slot"); writeCharacters(fn->name()); writeEndTag(); // generateBrief(fn,marker); From c1e05824adc1a894c4753ab2ab5fa6386e9a1314 Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Wed, 28 Mar 2012 14:29:09 +0200 Subject: [PATCH 13/15] qdoc: Add simple return types such as void to output. Change-Id: I2c9b2bc982f9fa3390a7b5bd322df9e015e53824 Reviewed-by: Martin Smith --- src/tools/qdoc/ditaxmlgenerator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 47db5c89fb..74dfe14201 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -4976,6 +4976,11 @@ void DitaXmlGenerator::replaceTypesWithLinks(const Node* n, else addLink(linkForNode(tn,parent),arg,DT_apiRelation); } + else { + // Write simple arguments, like void and bool, + // which do not have a Qt defined target. + writeCharacters(arg.toString()); + } } } else { From 6eae3cec5a34fbed28e519ffd8a8f3f1cd7b5c5b Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 28 Mar 2012 09:56:55 +0200 Subject: [PATCH 14/15] The scaling should not effect the width of a cosmetic pen When the scaling effects the pen width so that it is less than 1 pixel in width then it would use the QCosmeticStroker to draw, however this should not be the case for cosmetic pens that are not less than 1 pixel in width as the scaling does not change their width. Task-number: QTBUG-25006 Change-Id: I142db0f3a7ee02aa87171495d5a7a7011100814e Reviewed-by: Lars Knoll --- src/gui/painting/qpaintengine_raster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index b5e8bca7e0..15f344bf81 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -737,7 +737,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) s->flags.fast_pen = pen_style > Qt::NoPen && s->penData.blend && ((pen.isCosmetic() && penWidth <= 1) - || (s->flags.tx_noshear && penWidth * s->txscale <= 1)); + || (!pen.isCosmetic() && s->flags.tx_noshear && penWidth * s->txscale <= 1)); s->flags.non_complex_pen = qpen_capStyle(s->lastPen) <= Qt::SquareCap && s->flags.tx_noshear; From 4451010026aa559ec0f88e096f7f6afe28c34b6f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Mar 2012 12:04:08 +0200 Subject: [PATCH 15/15] Determine font smoothing gamma in initialization. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid calls to QStyleHint and QPlatformIntegration from threads. Change-Id: I851ef029ea348f182e0b42536d0a994960aa9187 Reviewed-by: Samuel Rødal --- src/gui/kernel/qguiapplication.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 54cb5fdbeb..f5856918af 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -52,6 +52,7 @@ #include "qplatformintegration_qpa.h" #include +#include #include #include #include @@ -143,6 +144,8 @@ static QBasicMutex applicationFontMutex; QFont *QGuiApplicationPrivate::app_font = 0; bool QGuiApplicationPrivate::obey_desktop_settings = true; +static qreal fontSmoothingGamma = 1.7; + extern void qRegisterGuiVariant(); extern void qUnregisterGuiVariant(); extern void qInitDrawhelperAsm(); @@ -579,6 +582,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform nativeInterface->setProperty(name.constData(), value); } } + fontSmoothingGamma = QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal(); } static void init_plugins(const QList &pluginList) @@ -2174,8 +2178,7 @@ const QDrawHelperGammaTables *QGuiApplicationPrivate::gammaTables() { QDrawHelperGammaTables *result = m_gammaTables.load(); if (!result){ - const qreal smoothing = qApp->styleHints()->fontSmoothingGamma(); - QDrawHelperGammaTables *tables = new QDrawHelperGammaTables(smoothing); + QDrawHelperGammaTables *tables = new QDrawHelperGammaTables(fontSmoothingGamma); if (!m_gammaTables.testAndSetRelease(0, tables)) delete tables; result = m_gammaTables.load();