diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 6cbc6c1f40..f9af954755 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -19,10 +19,9 @@ CONFIG(blackberry) { } # Uncomment these to enable debugging output for various aspects of the plugin -#DEFINES += QQNXBUFFER_DEBUG #DEFINES += QQNXBPSEVENTFILTER_DEBUG +#DEFINES += QQNXBUFFER_DEBUG #DEFINES += QQNXCLIPBOARD_DEBUG -#DEFINES += QQNXSCREENEVENTTHREAD_DEBUG #DEFINES += QQNXGLBACKINGSTORE_DEBUG #DEFINES += QQNXGLCONTEXT_DEBUG #DEFINES += QQNXINPUTCONTEXT_DEBUG @@ -30,13 +29,15 @@ CONFIG(blackberry) { #DEFINES += QQNXINTEGRATION_DEBUG #DEFINES += QQNXNAVIGATOREVENTHANDLER_DEBUG #DEFINES += QQNXNAVIGATOREVENTNOTIFIER_DEBUG +#DEFINES += QQNXNAVIGATOR_DEBUG #DEFINES += QQNXRASTERBACKINGSTORE_DEBUG #DEFINES += QQNXROOTWINDOW_DEBUG -#DEFINES += QQNXSCREEN_DEBUG +#DEFINES += QQNXSCREENEVENTTHREAD_DEBUG #DEFINES += QQNXSCREENEVENT_DEBUG +#DEFINES += QQNXSCREEN_DEBUG #DEFINES += QQNXVIRTUALKEYBOARD_DEBUG #DEFINES += QQNXWINDOW_DEBUG -#DEFINES += QQNXNAVIGATOR_DEBUG + SOURCES = main.cpp \ qqnxbuffer.cpp \ diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp index f57f49df9c..93d6e34c71 100644 --- a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp +++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp @@ -44,6 +44,12 @@ #include #include +#ifdef QQNXNAVIGATOR_DEBUG +#define qNavigatorDebug qDebug +#else +#define qNavigatorDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxAbstractNavigator::QQnxAbstractNavigator(QObject *parent) @@ -64,9 +70,7 @@ bool QQnxAbstractNavigator::invokeUrl(const QUrl &url) // which is not recognized by the navigator anymore const bool result = requestInvokeUrl(url.toString().toUtf8()); -#if defined(QQNXNAVIGATOR_DEBUG) - qDebug() << Q_FUNC_INFO << "url=" << url << "result=" << result; -#endif + qNavigatorDebug() << Q_FUNC_INFO << "url=" << url << "result=" << result; return result; } diff --git a/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp index 089d5681d6..f5185e3eb7 100644 --- a/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp +++ b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp @@ -52,6 +52,12 @@ #include #include +#ifdef QQNXBPSEVENTFILTER_DEBUG +#define qBpsEventFilterDebug qDebug +#else +#define qBpsEventFilterDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE static QQnxBpsEventFilter *s_instance = 0; @@ -78,9 +84,7 @@ QQnxBpsEventFilter::~QQnxBpsEventFilter() void QQnxBpsEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *dispatcher) { -#if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << Q_FUNC_INFO << "dispatcher=" << dispatcher; -#endif + qBpsEventFilterDebug() << Q_FUNC_INFO << "dispatcher=" << dispatcher; if (navigator_request_events(0) != BPS_SUCCESS) qWarning("QQNX: failed to register for navigator events"); @@ -108,9 +112,7 @@ void QQnxBpsEventFilter::unregisterForScreenEvents(QQnxScreen *screen) bool QQnxBpsEventFilter::dispatcherEventFilter(void *message) { -#if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qBpsEventFilterDebug() << Q_FUNC_INFO; if (s_instance == 0) return false; @@ -122,10 +124,7 @@ bool QQnxBpsEventFilter::dispatcherEventFilter(void *message) bool QQnxBpsEventFilter::bpsEventFilter(bps_event_t *event) { const int eventDomain = bps_event_get_domain(event); - -#if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << Q_FUNC_INFO << "event=" << event << "domain=" << eventDomain; -#endif + qBpsEventFilterDebug() << Q_FUNC_INFO << "event=" << event << "domain=" << eventDomain; if (eventDomain == screen_get_domain()) { screen_event_t screenEvent = screen_event_get_event(event); @@ -146,16 +145,10 @@ bool QQnxBpsEventFilter::handleNavigatorEvent(bps_event_t *event) switch (bps_event_get_code(event)) { case NAVIGATOR_ORIENTATION_CHECK: { const int angle = navigator_event_get_orientation_angle(event); - - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Navigator ORIENTATION CHECK event. angle=" << angle; - #endif + qBpsEventFilterDebug() << Q_FUNC_INFO << "ORIENTATION CHECK event. angle=" << angle; const bool result = m_navigatorEventHandler->handleOrientationCheck(angle); - - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Navigator ORIENTATION CHECK event. result=" << result; - #endif + qBpsEventFilterDebug() << Q_FUNC_INFO << "ORIENTATION CHECK event. result=" << result; // reply to navigator whether orientation is acceptable navigator_orientation_check_response(event, result); @@ -164,11 +157,7 @@ bool QQnxBpsEventFilter::handleNavigatorEvent(bps_event_t *event) case NAVIGATOR_ORIENTATION: { const int angle = navigator_event_get_orientation_angle(event); - - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Navigator ORIENTATION event. angle=" << angle; - #endif - + qBpsEventFilterDebug() << Q_FUNC_INFO << "ORIENTATION event. angle=" << angle; m_navigatorEventHandler->handleOrientationChange(angle); navigator_done_orientation(event); @@ -176,45 +165,31 @@ bool QQnxBpsEventFilter::handleNavigatorEvent(bps_event_t *event) } case NAVIGATOR_SWIPE_DOWN: - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Navigator SWIPE DOWN event"; - #endif - + qBpsEventFilterDebug() << Q_FUNC_INFO << "SWIPE DOWN event"; m_navigatorEventHandler->handleSwipeDown(); break; case NAVIGATOR_EXIT: - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Navigator EXIT event"; - #endif - + qBpsEventFilterDebug() << Q_FUNC_INFO << "EXIT event"; m_navigatorEventHandler->handleExit(); break; case NAVIGATOR_WINDOW_ACTIVE: { - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Navigator WINDOW ACTIVE event"; - #endif - + qBpsEventFilterDebug() << Q_FUNC_INFO << "WINDOW ACTIVE event"; const QByteArray id(navigator_event_get_groupid(event)); m_navigatorEventHandler->handleWindowGroupActivated(id); break; } case NAVIGATOR_WINDOW_INACTIVE: { - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Navigator WINDOW INACTIVE event"; - #endif - + qBpsEventFilterDebug() << Q_FUNC_INFO << "WINDOW INACTIVE event"; const QByteArray id(navigator_event_get_groupid(event)); m_navigatorEventHandler->handleWindowGroupDeactivated(id); break; } default: - #if defined(QQNXBPSEVENTFILTER_DEBUG) - qDebug() << "QQNX: Unhandled navigator event. code=" << bps_event_get_code(event); - #endif + qBpsEventFilterDebug() << Q_FUNC_INFO << "Unhandled navigator event. code=" << bps_event_get_code(event); return false; } diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp index 048aec8ff6..9c951e39d6 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.cpp +++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp @@ -46,22 +46,24 @@ #include #include +#ifdef QQNXBUFFER_DEBUG +#define qBufferDebug qDebug +#else +#define qBufferDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxBuffer::QQnxBuffer() : m_buffer(0) { -#if defined(QQNXBUFFER_DEBUG) - qDebug() << "QQnxBuffer::QQnxBuffer - empty"; -#endif + qBufferDebug() << Q_FUNC_INFO << "empty"; } QQnxBuffer::QQnxBuffer(screen_buffer_t buffer) : m_buffer(buffer) { -#if defined(QQNXBUFFER_DEBUG) - qDebug() << "QQnxBuffer::QQnxBuffer - normal"; -#endif + qBufferDebug() << Q_FUNC_INFO << "normal"; // Get size of buffer errno = 0; @@ -131,23 +133,17 @@ QQnxBuffer::QQnxBuffer(const QQnxBuffer &other) : m_buffer(other.m_buffer), m_image(other.m_image) { -#if defined(QQNXBUFFER_DEBUG) - qDebug() << "QQnxBuffer::QQnxBuffer - copy"; -#endif + qBufferDebug() << Q_FUNC_INFO << "copy"; } QQnxBuffer::~QQnxBuffer() { -#if defined(QQNXBUFFER_DEBUG) - qDebug() << "QQnxBuffer::~QQnxBuffer"; -#endif + qBufferDebug() << Q_FUNC_INFO; } void QQnxBuffer::invalidateInCache() { -#if defined(QQNXBUFFER_DEBUG) - qDebug() << "QQnxBuffer::invalidateInCache"; -#endif + qBufferDebug() << Q_FUNC_INFO; // Verify native buffer exists if (m_buffer == 0) { diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp index 38dac0c5ab..6f1d38b7da 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.cpp +++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp @@ -53,6 +53,12 @@ #include #include +#ifdef QQNXCLIPBOARD_DEBUG +#define qClipboardDebug qDebug +#else +#define qClipboardDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE // null terminated array @@ -96,18 +102,13 @@ public: void addFormatToCheck(const QString &format) { m_formatsToCheck << format; - -#if defined(QQNXCLIPBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "formats=" << m_formatsToCheck; -#endif + qClipboardDebug() << Q_FUNC_INFO << "formats=" << m_formatsToCheck; } bool hasFormat(const QString &mimetype) const { const bool result = is_clipboard_format_present(mimetype.toUtf8().constData()) == 0; -#if defined(QQNXCLIPBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "result=" << result; -#endif + qClipboardDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "result=" << result; return result; } @@ -120,9 +121,7 @@ public: result << format; } -#if defined(QQNXCLIPBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "result=" << result; -#endif + qClipboardDebug() << Q_FUNC_INFO << "result=" << result; return result; } @@ -146,9 +145,7 @@ public: protected: QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const { -#if defined(QQNXCLIPBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "preferredType=" << preferredType; -#endif + qClipboardDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "preferredType=" << preferredType; if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0) return QMimeData::retrieveData(mimetype, preferredType); @@ -160,9 +157,7 @@ private Q_SLOTS: void releaseOwnership() { if (m_userMimeData) { -#if defined(QQNXCLIPBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "user data formats=" << m_userMimeData->formats() << "system formats=" << formats(); -#endif + qClipboardDebug() << Q_FUNC_INFO << "user data formats=" << m_userMimeData->formats() << "system formats=" << formats(); delete m_userMimeData; m_userMimeData = 0; m_clipboard->emitChanged(QClipboard::Clipboard); @@ -203,9 +198,7 @@ void QQnxClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) return; const QStringList formats = data->formats(); -#if defined(QQNXCLIPBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "formats=" << formats; -#endif + qClipboardDebug() << Q_FUNC_INFO << "formats=" << formats; Q_FOREACH (const QString &format, formats) { const QByteArray buf = data->data(format); @@ -214,9 +207,7 @@ void QQnxClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) continue; int ret = set_clipboard_data(format.toUtf8().data(), buf.size(), buf.data()); -#if defined(QQNXCLIPBOARD_DEBUG) - qDebug() << "QQNX: set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret; -#endif + qClipboardDebug() << Q_FUNC_INFO << "set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret; if (ret) m_mimeData->addFormatToCheck(format); } diff --git a/src/plugins/platforms/qnx/qqnxglbackingstore.cpp b/src/plugins/platforms/qnx/qqnxglbackingstore.cpp index 97a03e0042..285142c616 100644 --- a/src/plugins/platforms/qnx/qqnxglbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxglbackingstore.cpp @@ -53,6 +53,12 @@ #include +#ifdef QQNXGLBACKINGSTORE_DEBUG +#define qGLBackingStoreDebug qDebug +#else +#define qGLBackingStoreDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxGLPaintDevice::QQnxGLPaintDevice(QWindow *window) @@ -95,9 +101,7 @@ QQnxGLBackingStore::QQnxGLBackingStore(QWindow *window) m_requestedSize(), m_size() { -#if defined(QQNXGLBACKINGSTORE_DEBUG) - qDebug() << "QQnxGLBackingStore::QQnxGLBackingStore - w=" << window; -#endif + qGLBackingStoreDebug() << Q_FUNC_INFO << "w =" << window; // Create an OpenGL paint device which in turn creates a QGLContext for us m_paintDevice = new QQnxGLPaintDevice(window); @@ -106,9 +110,7 @@ QQnxGLBackingStore::QQnxGLBackingStore(QWindow *window) QQnxGLBackingStore::~QQnxGLBackingStore() { -#if defined(QQNXGLBACKINGSTORE_DEBUG) - qDebug() << "QQnxGLBackingStore::~QQnxGLBackingStore - w=" << window(); -#endif + qGLBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); // cleanup OpenGL paint device delete m_paintDevice; @@ -118,10 +120,7 @@ void QQnxGLBackingStore::flush(QWindow *window, const QRegion ®ion, const QPo { Q_UNUSED(region); Q_UNUSED(offset); - -#if defined(QQNXGLBACKINGSTORE_DEBUG) - qDebug() << "QQnxGLBackingStore::flush - w=" << window; -#endif + qGLBackingStoreDebug() << Q_FUNC_INFO << "w =" << window; // update the display with newly rendered content m_openGLContext->swapBuffers(window); @@ -130,9 +129,8 @@ void QQnxGLBackingStore::flush(QWindow *window, const QRegion ®ion, const QPo void QQnxGLBackingStore::resize(const QSize &size, const QRegion &staticContents) { Q_UNUSED(staticContents); -#if defined(QQNXGLBACKINGSTORE_DEBUG) - qDebug() << "QQnxGLBackingStore::resize - w=" << window() << ", s=" << size; -#endif + qGLBackingStoreDebug() << Q_FUNC_INFO << "w =" << window() << ", s =" << size; + // NOTE: defer resizing window buffers until next paint as // resize() can be called multiple times before a paint occurs m_requestedSize = size; @@ -141,10 +139,7 @@ void QQnxGLBackingStore::resize(const QSize &size, const QRegion &staticContents void QQnxGLBackingStore::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - -#if defined(QQNXGLBACKINGSTORE_DEBUG) - qDebug() << "QQnxGLBackingStore::beginPaint - w=" << window(); -#endif + qGLBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); // resize EGL surface if window surface resized if (m_size != m_requestedSize) { @@ -155,9 +150,7 @@ void QQnxGLBackingStore::beginPaint(const QRegion ®ion) void QQnxGLBackingStore::endPaint(const QRegion ®ion) { Q_UNUSED(region); -#if defined(QQNXGLBACKINGSTORE_DEBUG) - qDebug() << "QQnxGLBackingStore::endPaint - w=" << window(); -#endif + qGLBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); } void QQnxGLBackingStore::resizeSurface(const QSize &size) diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index 0b333ea728..593180019d 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -50,6 +50,12 @@ #include #include +#ifdef QQNXGLCONTEXT_DEBUG +#define qGLContextDebug qDebug +#else +#define qGLContextDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE EGLDisplay QQnxGLContext::ms_eglDisplay = EGL_NO_DISPLAY; @@ -84,9 +90,7 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) m_glContext(glContext), m_eglSurface(EGL_NO_SURFACE) { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; QSurfaceFormat format = m_glContext->format(); // Set current rendering API @@ -160,9 +164,7 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) QQnxGLContext::~QQnxGLContext() { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; // Cleanup EGL context if it exists if (m_eglContext != EGL_NO_CONTEXT) { @@ -175,9 +177,8 @@ QQnxGLContext::~QQnxGLContext() void QQnxGLContext::initialize() { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; + // Initialize connection to EGL ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (ms_eglDisplay == EGL_NO_DISPLAY) { @@ -194,18 +195,16 @@ void QQnxGLContext::initialize() void QQnxGLContext::shutdown() { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; + // Close connection to EGL eglTerminate(ms_eglDisplay); } bool QQnxGLContext::makeCurrent(QPlatformSurface *surface) { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; + // Set current rendering API EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); if (eglResult != EGL_TRUE) { @@ -225,9 +224,8 @@ bool QQnxGLContext::makeCurrent(QPlatformSurface *surface) void QQnxGLContext::doneCurrent() { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; + // set current rendering API EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); if (eglResult != EGL_TRUE) { @@ -244,9 +242,7 @@ void QQnxGLContext::doneCurrent() void QQnxGLContext::swapBuffers(QPlatformSurface *surface) { Q_UNUSED(surface); -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; // Set current rendering API EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); @@ -263,9 +259,7 @@ void QQnxGLContext::swapBuffers(QPlatformSurface *surface) QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName) { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; // Set current rendering API EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); @@ -279,9 +273,7 @@ QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName) EGLint *QQnxGLContext::contextAttrs() { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; // Choose EGL settings based on OpenGL version #if defined(QT_OPENGL_ES_2) @@ -294,17 +286,14 @@ EGLint *QQnxGLContext::contextAttrs() bool QQnxGLContext::isCurrent() const { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; return (eglGetCurrentContext() == m_eglContext); } void QQnxGLContext::createSurface(QPlatformSurface *surface) { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; + // Get a pointer to the corresponding platform window QQnxWindow *platformWindow = dynamic_cast(surface); if (!platformWindow) { @@ -339,9 +328,7 @@ void QQnxGLContext::createSurface(QPlatformSurface *surface) void QQnxGLContext::destroySurface() { -#if defined(QQNXGLCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qGLContextDebug() << Q_FUNC_INFO; // Destroy EGL surface if it exists if (m_eglSurface != EGL_NO_SURFACE) { diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 976249f229..34bf401274 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -62,6 +62,18 @@ #include #include +#ifdef QQNXINPUTCONTEXT_IMF_EVENT_DEBUG +#define qInputContextIMFEventDebug qDebug +#else +#define qInputContextIMFEventDebug QT_NO_QDEBUG_MACRO +#endif + +#ifdef QQNXINPUTCONTEXT_DEBUG +#define qInputContextDebug qDebug +#else +#define qInputContextDebug QT_NO_QDEBUG_MACRO +#endif + /** TODO: Support inputMethodHints to restrict input (needs additional features in IMF). */ @@ -175,9 +187,7 @@ int ImfEvent::sUserEventType = QEvent::registerEventType(); static int32_t imfBeginBatchEdit(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -194,9 +204,7 @@ static int32_t imfBeginBatchEdit(input_session_t *ic) static int32_t imfClearMetaKeyStates(input_session_t *ic, int32_t states) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -215,9 +223,7 @@ static int32_t imfClearMetaKeyStates(input_session_t *ic, int32_t states) static int32_t imfCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -237,9 +243,7 @@ static int32_t imfCommitText(input_session_t *ic, spannable_string_t *text, int3 static int32_t imfDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -259,9 +263,7 @@ static int32_t imfDeleteSurroundingText(input_session_t *ic, int32_t left_length static int32_t imfEndBatchEdit(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -279,9 +281,7 @@ static int32_t imfEndBatchEdit(input_session_t *ic) static int32_t imfFinishComposingText(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -299,9 +299,7 @@ static int32_t imfFinishComposingText(input_session_t *ic) static int32_t imfGetCursorCapsMode(input_session_t *ic, int32_t req_modes) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -318,9 +316,7 @@ static int32_t imfGetCursorCapsMode(input_session_t *ic, int32_t req_modes) static int32_t imfGetCursorPosition(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -338,9 +334,7 @@ static int32_t imfGetCursorPosition(input_session_t *ic) static extracted_text_t *imfGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) { extracted_text_t *et = (extracted_text_t *)calloc(sizeof(extracted_text_t),1); @@ -361,9 +355,7 @@ static extracted_text_t *imfGetExtractedText(input_session_t *ic, extracted_text static spannable_string_t *imfGetSelectedText(input_session_t *ic, int32_t flags) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return toSpannableString(""); @@ -380,9 +372,7 @@ static spannable_string_t *imfGetSelectedText(input_session_t *ic, int32_t flags static spannable_string_t *imfGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return toSpannableString(""); @@ -400,9 +390,7 @@ static spannable_string_t *imfGetTextAfterCursor(input_session_t *ic, int32_t n, static spannable_string_t *imfGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return toSpannableString(""); @@ -420,9 +408,7 @@ static spannable_string_t *imfGetTextBeforeCursor(input_session_t *ic, int32_t n static int32_t imfPerformEditorAction(input_session_t *ic, int32_t editor_action) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -440,9 +426,7 @@ static int32_t imfPerformEditorAction(input_session_t *ic, int32_t editor_action static int32_t imfReportFullscreenMode(input_session_t *ic, int32_t enabled) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -460,9 +444,7 @@ static int32_t imfReportFullscreenMode(input_session_t *ic, int32_t enabled) static int32_t imfSendEvent(input_session_t *ic, event_t *event) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -477,9 +459,7 @@ static int32_t imfSendEvent(input_session_t *ic, event_t *event) static int32_t imfSendAsyncEvent(input_session_t *ic, event_t *event) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -494,9 +474,7 @@ static int32_t imfSendAsyncEvent(input_session_t *ic, event_t *event) static int32_t imfSetComposingRegion(input_session_t *ic, int32_t start, int32_t end) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -515,9 +493,7 @@ static int32_t imfSetComposingRegion(input_session_t *ic, int32_t start, int32_t static int32_t imfSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -536,9 +512,7 @@ static int32_t imfSetComposingText(input_session_t *ic, spannable_string_t *text static int32_t imfSetSelection(input_session_t *ic, int32_t start, int32_t end) { -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextIMFEventDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -595,9 +569,7 @@ initEvent(event_t *pEvent, const input_session_t *pSession, EventType eventType, spannable_string_t *toSpannableString(const QString &text) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << text; -#endif + qInputContextDebug() << Q_FUNC_INFO << text; spannable_string_t *pString = reinterpret_cast(malloc(sizeof(spannable_string_t))); pString->str = (wchar_t *)malloc(sizeof(wchar_t) * text.length() + 1); @@ -684,9 +656,7 @@ QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard): m_inputPanelLocale(QLocale::c()), m_virtualKeyboad(keyboard) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!imfAvailable()) return; @@ -708,9 +678,7 @@ QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard): QQnxInputContext::~QQnxInputContext() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!imfAvailable()) return; @@ -878,9 +846,8 @@ bool QQnxInputContext::eventFilter(QObject *obj, QEvent *event) bool QQnxInputContext::filterEvent( const QEvent *event ) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << event; -#endif + qInputContextDebug() << Q_FUNC_INFO << event; + switch (event->type()) { case QEvent::CloseSoftwareInputPanel: { return dispatchCloseSoftwareInputPanel(); @@ -895,17 +862,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) void QQnxInputContext::reset() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; endComposition(); } void QQnxInputContext::update(Qt::InputMethodQueries queries) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; reset(); QPlatformInputContext::update(queries); @@ -913,9 +876,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) void QQnxInputContext::closeSession() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!imfAvailable()) return; @@ -927,9 +888,7 @@ void QQnxInputContext::closeSession() void QQnxInputContext::openSession() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!imfAvailable()) return; @@ -957,9 +916,7 @@ bool QQnxInputContext::hasSelectedText() bool QQnxInputContext::dispatchRequestSoftwareInputPanel() { m_virtualKeyboard.showKeyboard(); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << "QQNX: requesting virtual keyboard"; -#endif + qInputContextDebug() << Q_FUNC_INFO << "requesting virtual keyboard"; QObject *input = qGuiApp->focusObject(); if (!imfAvailable() || !input || !inputMethodAccepted()) return true; @@ -983,9 +940,7 @@ bool QQnxInputContext::dispatchRequestSoftwareInputPanel() bool QQnxInputContext::dispatchCloseSoftwareInputPanel() { m_virtualKeyboard.hideKeyboard(); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << "QQNX: hiding virtual keyboard"; -#endif + qInputContextDebug() << Q_FUNC_INFO << "hiding virtual keyboard"; // This also means we are stopping composition, but we should already have done that. return true; @@ -996,9 +951,7 @@ bool QQnxInputContext::dispatchCloseSoftwareInputPanel() */ bool QQnxInputContext::dispatchFocusEvent(FocusEventId id, int hints) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!sInputSession) { qWarning() << Q_FUNC_INFO << "Attempt to dispatch a focus event with no input session."; @@ -1106,9 +1059,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan navigation_event_t navEvent; initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key); navEvent.magnitude = 1; -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "dispatch navigation event " << key; -#endif + qInputContextDebug() << Q_FUNC_INFO << "dispatch navigation event " << key; p_ictrl_dispatch_event(&navEvent.event); } } @@ -1120,9 +1071,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan keyEvent.meta_key_state = 0; p_ictrl_dispatch_event(&keyEvent.event); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "dispatch key event " << key; -#endif + qInputContextDebug() << Q_FUNC_INFO << "dispatch key event " << key; } scan = 0; @@ -1175,17 +1124,13 @@ int32_t QQnxInputContext::processEvent(event_t *event) int32_t result = -1; switch (event->event_type) { case EVENT_SPELL_CHECK: { - #if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "EVENT_SPELL_CHECK"; - #endif + qInputContextDebug() << Q_FUNC_INFO << "EVENT_SPELL_CHECK"; result = 0; break; } case EVENT_NAVIGATION: { - #if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "EVENT_NAVIGATION"; - #endif + qInputContextDebug() << Q_FUNC_INFO << "EVENT_NAVIGATION"; int key = event->event_id == NAVIGATE_UP ? KEYCODE_UP : event->event_id == NAVIGATE_DOWN ? KEYCODE_DOWN : @@ -1199,9 +1144,7 @@ int32_t QQnxInputContext::processEvent(event_t *event) } case EVENT_KEY: { - #if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "EVENT_KEY"; - #endif + qInputContextDebug() << Q_FUNC_INFO << "EVENT_KEY"; key_event_t *kevent = static_cast(event); QQnxEventThread::injectKeyboardEvent(KEY_DOWN | KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code); @@ -1235,9 +1178,7 @@ int32_t QQnxInputContext::processEvent(event_t *event) int32_t QQnxInputContext::onBeginBatchEdit(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1249,9 +1190,7 @@ int32_t QQnxInputContext::onBeginBatchEdit(input_session_t *ic) int32_t QQnxInputContext::onClearMetaKeyStates(input_session_t *ic, int32_t states) { Q_UNUSED(states); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1273,9 +1212,7 @@ int32_t QQnxInputContext::onCommitText(input_session_t *ic, spannable_string_t * QString commitString = QString::fromWCharArray(text->str, text->length); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "Committing [" << commitString << "]"; -#endif + qInputContextDebug() << Q_FUNC_INFO << "Committing [" << commitString << "]"; QList attributes; QInputMethodEvent event(QLatin1String(""), attributes); @@ -1289,9 +1226,7 @@ int32_t QQnxInputContext::onCommitText(input_session_t *ic, spannable_string_t * int32_t QQnxInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "L:" << left_length << " R:" << right_length; -#endif + qInputContextDebug() << Q_FUNC_INFO << "L:" << left_length << " R:" << right_length; if (!isSessionOkay(ic)) return 0; @@ -1320,9 +1255,7 @@ int32_t QQnxInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t l int32_t QQnxInputContext::onEndBatchEdit(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1332,9 +1265,7 @@ int32_t QQnxInputContext::onEndBatchEdit(input_session_t *ic) int32_t QQnxInputContext::onFinishComposingText(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1358,9 +1289,7 @@ int32_t QQnxInputContext::onFinishComposingText(input_session_t *ic) int32_t QQnxInputContext::onGetCursorCapsMode(input_session_t *ic, int32_t req_modes) { Q_UNUSED(req_modes); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1373,9 +1302,7 @@ int32_t QQnxInputContext::onGetCursorCapsMode(input_session_t *ic, int32_t req_m int32_t QQnxInputContext::onGetCursorPosition(input_session_t *ic) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1395,9 +1322,7 @@ extracted_text_t *QQnxInputContext::onGetExtractedText(input_session_t *ic, extr { Q_UNUSED(flags); Q_UNUSED(request); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) { extracted_text_t *et = (extracted_text_t *)calloc(sizeof(extracted_text_t),1); @@ -1415,9 +1340,7 @@ extracted_text_t *QQnxInputContext::onGetExtractedText(input_session_t *ic, extr spannable_string_t *QQnxInputContext::onGetSelectedText(input_session_t *ic, int32_t flags) { Q_UNUSED(flags); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return toSpannableString(""); @@ -1436,9 +1359,7 @@ spannable_string_t *QQnxInputContext::onGetSelectedText(input_session_t *ic, int spannable_string_t *QQnxInputContext::onGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags) { Q_UNUSED(flags); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return toSpannableString(""); @@ -1458,9 +1379,7 @@ spannable_string_t *QQnxInputContext::onGetTextAfterCursor(input_session_t *ic, spannable_string_t *QQnxInputContext::onGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags) { Q_UNUSED(flags); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return toSpannableString(""); @@ -1484,9 +1403,7 @@ spannable_string_t *QQnxInputContext::onGetTextBeforeCursor(input_session_t *ic, int32_t QQnxInputContext::onPerformEditorAction(input_session_t *ic, int32_t editor_action) { Q_UNUSED(editor_action); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1500,9 +1417,7 @@ int32_t QQnxInputContext::onPerformEditorAction(input_session_t *ic, int32_t edi int32_t QQnxInputContext::onReportFullscreenMode(input_session_t *ic, int32_t enabled) { Q_UNUSED(enabled); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1515,9 +1430,7 @@ int32_t QQnxInputContext::onReportFullscreenMode(input_session_t *ic, int32_t en int32_t QQnxInputContext::onSendEvent(input_session_t *ic, event_t *event) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1527,9 +1440,7 @@ int32_t QQnxInputContext::onSendEvent(input_session_t *ic, event_t *event) int32_t QQnxInputContext::onSendAsyncEvent(input_session_t *ic, event_t *event) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1539,9 +1450,7 @@ int32_t QQnxInputContext::onSendAsyncEvent(input_session_t *ic, event_t *event) int32_t QQnxInputContext::onSetComposingRegion(input_session_t *ic, int32_t start, int32_t end) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1573,9 +1482,7 @@ int32_t QQnxInputContext::onSetComposingRegion(input_session_t *ic, int32_t star int32_t QQnxInputContext::onSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position) { Q_UNUSED(new_cursor_position); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1596,9 +1503,7 @@ int32_t QQnxInputContext::onSetSelection(input_session_t *ic, int32_t start, int { Q_UNUSED(start); Q_UNUSED(end); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; if (!isSessionOkay(ic)) return 0; @@ -1611,17 +1516,13 @@ int32_t QQnxInputContext::onSetSelection(input_session_t *ic, int32_t start, int void QQnxInputContext::showInputPanel() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; dispatchRequestSoftwareInputPanel(); } void QQnxInputContext::hideInputPanel() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; dispatchCloseSoftwareInputPanel(); } @@ -1637,9 +1538,7 @@ QLocale QQnxInputContext::locale() const void QQnxInputContext::keyboardVisibilityChanged(bool visible) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "visible=" << visible; -#endif + qInputContextDebug() << Q_FUNC_INFO << "visible=" << visible; if (m_inputPanelVisible != visible) { m_inputPanelVisible = visible; emitInputPanelVisibleChanged(); @@ -1648,9 +1547,7 @@ void QQnxInputContext::keyboardVisibilityChanged(bool visible) void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "locale=" << locale; -#endif + qInputContextDebug() << Q_FUNC_INFO << "locale=" << locale; if (m_inputPanelLocale != locale) { m_inputPanelLocale = locale; emitLocaleChanged(); @@ -1659,9 +1556,7 @@ void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) void QQnxInputContext::setFocusObject(QObject *object) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "input item=" << object; -#endif + qInputContextDebug() << Q_FUNC_INFO << "input item=" << object; if (!inputMethodAccepted()) { if (m_inputPanelVisible) diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 4d229fd872..28a727d7b6 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -46,6 +46,12 @@ #include #include +#ifdef QQNXINPUTCONTEXT_DEBUG +#define qInputContextDebug qDebug +#else +#define qInputContextDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard) : @@ -86,17 +92,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) if (event->type() == QEvent::CloseSoftwareInputPanel) { m_virtualKeyboard.hideKeyboard(); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << "QQNX: hiding virtual keyboard"; -#endif + qInputContextDebug() << Q_FUNC_INFO << "hiding virtual keyboard"; return false; } if (event->type() == QEvent::RequestSoftwareInputPanel) { m_virtualKeyboard.showKeyboard(); -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << "QQNX: requesting virtual keyboard"; -#endif + qInputContextDebug() << Q_FUNC_INFO << "requesting virtual keyboard"; return false; } @@ -116,17 +118,13 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan void QQnxInputContext::showInputPanel() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; m_virtualKeyboard.showKeyboard(); } void QQnxInputContext::hideInputPanel() { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qInputContextDebug() << Q_FUNC_INFO; m_virtualKeyboard.hideKeyboard(); } @@ -142,9 +140,7 @@ QLocale QQnxInputContext::locale() const void QQnxInputContext::keyboardVisibilityChanged(bool visible) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "visible=" << visible; -#endif + qInputContextDebug() << Q_FUNC_INFO << "visible=" << visible; if (m_inputPanelVisible != visible) { m_inputPanelVisible = visible; emitInputPanelVisibleChanged(); @@ -153,9 +149,7 @@ void QQnxInputContext::keyboardVisibilityChanged(bool visible) void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "locale=" << locale; -#endif + qInputContextDebug() << Q_FUNC_INFO << "locale=" << locale; if (m_inputPanelLocale != locale) { m_inputPanelLocale = locale; emitLocaleChanged(); @@ -164,9 +158,7 @@ void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) void QQnxInputContext::setFocusObject(QObject *object) { -#if defined(QQNXINPUTCONTEXT_DEBUG) - qDebug() << Q_FUNC_INFO << "input item=" << object; -#endif + qInputContextDebug() << Q_FUNC_INFO << "input item=" << object; if (!inputMethodAccepted()) { if (m_inputPanelVisible) diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 59d7f13f8a..e6e99d2243 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -95,6 +95,12 @@ #include +#ifdef QQNXINTEGRATION_DEBUG +#define qIntegrationDebug qDebug +#else +#define qIntegrationDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxWindowMapper QQnxIntegration::ms_windowMapper; @@ -126,9 +132,7 @@ QQnxIntegration::QQnxIntegration() , m_clipboard(0) #endif { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; // Open connection to QNX composition manager errno = 0; int result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT); @@ -215,11 +219,7 @@ QQnxIntegration::QQnxIntegration() QQnxIntegration::~QQnxIntegration() { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << "QQnx: platform plugin shutdown begin"; -#endif - - + qIntegrationDebug() << Q_FUNC_INFO << "platform plugin shutdown begin"; delete m_nativeInterface; #if defined(QQNX_PPS) @@ -270,16 +270,12 @@ QQnxIntegration::~QQnxIntegration() // Destroy navigator interface delete m_navigator; -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << "QQnx: platform plugin shutdown end"; -#endif + qIntegrationDebug() << Q_FUNC_INFO << "platform plugin shutdown end"; } bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; switch (cap) { case ThreadedPixmaps: return true; #if defined(QT_OPENGL_ES) @@ -292,17 +288,13 @@ bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; return new QQnxWindow(window, m_screenContext); } QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *window) const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; #if !defined(QT_NO_OPENGL) if (paintUsingOpenGL()) return new QQnxGLBackingStore(window); @@ -314,9 +306,7 @@ QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *wind #if !defined(QT_NO_OPENGL) QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; return new QQnxGLContext(context); } #endif @@ -324,18 +314,14 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont #if defined(QQNX_PPS) QPlatformInputContext *QQnxIntegration::inputContext() const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; return m_inputContext; } #endif void QQnxIntegration::moveToScreen(QWindow *window, int screen) { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << "QQnxIntegration::moveToScreen - w=" << window << ", s=" << screen; -#endif + qIntegrationDebug() << Q_FUNC_INFO << "w =" << window << ", s =" << screen; // get platform window used by widget QQnxWindow *platformWindow = static_cast(window->handle()); @@ -349,9 +335,7 @@ void QQnxIntegration::moveToScreen(QWindow *window, int screen) QAbstractEventDispatcher *QQnxIntegration::guiThreadEventDispatcher() const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; return m_eventDispatcher; } @@ -363,9 +347,7 @@ QPlatformNativeInterface *QQnxIntegration::nativeInterface() const #if !defined(QT_NO_CLIPBOARD) QPlatformClipboard *QQnxIntegration::clipboard() const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; #if defined(QQNX_PPS) if (!m_clipboard) { @@ -378,9 +360,7 @@ QPlatformClipboard *QQnxIntegration::clipboard() const QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; if (hint == ShowIsFullScreen) return true; @@ -400,9 +380,7 @@ QStringList QQnxIntegration::themeNames() const QPlatformTheme *QQnxIntegration::createPlatformTheme(const QString &name) const { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO << "name =" << name; -#endif + qIntegrationDebug() << Q_FUNC_INFO << "name =" << name; if (name == QQnxTheme::name()) return new QQnxTheme(m_fontDatabase); return QPlatformIntegration::createPlatformTheme(name); @@ -411,9 +389,7 @@ QPlatformTheme *QQnxIntegration::createPlatformTheme(const QString &name) const QWindow *QQnxIntegration::window(screen_window_t qnxWindow) { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; QMutexLocker locker(&ms_windowMapperMutex); Q_UNUSED(locker); return ms_windowMapper.value(qnxWindow, 0); @@ -421,9 +397,7 @@ QWindow *QQnxIntegration::window(screen_window_t qnxWindow) void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window) { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; QMutexLocker locker(&ms_windowMapperMutex); Q_UNUSED(locker); ms_windowMapper.insert(qnxWindow, window); @@ -431,9 +405,7 @@ void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window) void QQnxIntegration::removeWindow(screen_window_t qnxWindow) { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; QMutexLocker locker(&ms_windowMapperMutex); Q_UNUSED(locker); ms_windowMapper.remove(qnxWindow); @@ -441,9 +413,7 @@ void QQnxIntegration::removeWindow(screen_window_t qnxWindow) void QQnxIntegration::createDisplays() { -#if defined(QQNXINTEGRATION_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qIntegrationDebug() << Q_FUNC_INFO; // Query number of displays errno = 0; int displayCount; @@ -461,9 +431,7 @@ void QQnxIntegration::createDisplays() } for (int i=0; i #include +#ifdef QQNXNAVIGATOREVENTHANDLER_DEBUG +#define qNavigatorEventHandlerDebug qDebug +#else +#define qNavigatorEventHandlerDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxNavigatorEventHandler::QQnxNavigatorEventHandler(QObject *parent) @@ -55,31 +61,22 @@ QQnxNavigatorEventHandler::QQnxNavigatorEventHandler(QObject *parent) bool QQnxNavigatorEventHandler::handleOrientationCheck(int angle) { // reply to navigator that (any) orientation is acceptable -#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) - qDebug() << Q_FUNC_INFO << "angle=" << angle; -#endif - // TODO: check if top window flags prohibit orientation change + qNavigatorEventHandlerDebug() << Q_FUNC_INFO << "angle=" << angle; return true; } void QQnxNavigatorEventHandler::handleOrientationChange(int angle) { // update screen geometry and reply to navigator that we're ready -#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) - qDebug() << Q_FUNC_INFO << "angle=" << angle; -#endif - + qNavigatorEventHandlerDebug() << Q_FUNC_INFO << "angle=" << angle; emit rotationChanged(angle); } void QQnxNavigatorEventHandler::handleSwipeDown() { // simulate menu key press -#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif - + qNavigatorEventHandlerDebug() << Q_FUNC_INFO; QWindow *w = QGuiApplication::focusWindow(); QWindowSystemInterface::handleKeyEvent(w, QEvent::KeyPress, Qt::Key_Menu, Qt::NoModifier); QWindowSystemInterface::handleKeyEvent(w, QEvent::KeyRelease, Qt::Key_Menu, Qt::NoModifier); @@ -88,28 +85,19 @@ void QQnxNavigatorEventHandler::handleSwipeDown() void QQnxNavigatorEventHandler::handleExit() { // shutdown everything -#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif - + qNavigatorEventHandlerDebug() << Q_FUNC_INFO; QCoreApplication::quit(); } void QQnxNavigatorEventHandler::handleWindowGroupActivated(const QByteArray &id) { -#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) - qDebug() << Q_FUNC_INFO << id; -#endif - + qNavigatorEventHandlerDebug() << Q_FUNC_INFO << id; Q_EMIT windowGroupActivated(id); } void QQnxNavigatorEventHandler::handleWindowGroupDeactivated(const QByteArray &id) { -#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) - qDebug() << Q_FUNC_INFO << id; -#endif - + qNavigatorEventHandlerDebug() << Q_FUNC_INFO << id; Q_EMIT windowGroupDeactivated(id); } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp index 23e2167a25..d738c45222 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp @@ -55,6 +55,12 @@ #include #include +#ifdef QQNXNAVIGATOREVENTNOTIFIER_DEBUG +#define qNavigatorEventNotifierDebug qDebug +#else +#define qNavigatorEventNotifierDebug QT_NO_QDEBUG_MACRO +#endif + static const char *navigatorControlPath = "/pps/services/navigator/control"; static const int ppsBufferSize = 4096; @@ -76,16 +82,12 @@ QQnxNavigatorEventNotifier::~QQnxNavigatorEventNotifier() if (m_fd != -1) close(m_fd); -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "QQNX: navigator event notifier stopped"; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "navigator event notifier stopped"; } void QQnxNavigatorEventNotifier::start() { -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "QQNX: navigator event notifier started"; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "navigator event notifier started"; // open connection to navigator errno = 0; @@ -101,9 +103,7 @@ void QQnxNavigatorEventNotifier::start() void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray &msg, QByteArray &dat, QByteArray &id) { -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "PPS: data=" << ppsData; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "data=" << ppsData; // tokenize pps data into lines QList lines = ppsData.split('\n'); @@ -117,10 +117,7 @@ void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray // tokenize current attribute const QByteArray &attr = lines.at(i); - -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "PPS: attr=" << attr; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "attr=" << attr; int firstColon = attr.indexOf(':'); if (firstColon == -1) { @@ -137,10 +134,8 @@ void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray QByteArray key = attr.left(firstColon); QByteArray value = attr.mid(secondColon + 1); -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "PPS: key=" << key; - qDebug() << "PPS: val=" << value; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "key=" << key; + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "val=" << value; // save attribute value if (key == "msg") @@ -167,9 +162,7 @@ void QQnxNavigatorEventNotifier::replyPPS(const QByteArray &res, const QByteArra } ppsData += "\n"; -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "PPS reply=" << ppsData; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "reply=" << ppsData; // send pps message to navigator errno = 0; @@ -180,9 +173,7 @@ void QQnxNavigatorEventNotifier::replyPPS(const QByteArray &res, const QByteArra void QQnxNavigatorEventNotifier::handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id) { -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "PPS: msg=" << msg << ", dat=" << dat << ", id=" << id; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "msg=" << msg << ", dat=" << dat << ", id=" << id; // check message type if (msg == "orientationCheck") { @@ -206,9 +197,8 @@ void QQnxNavigatorEventNotifier::handleMessage(const QByteArray &msg, const QByt void QQnxNavigatorEventNotifier::readData() { -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) - qDebug() << "QQNX: reading navigator data"; -#endif + qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "reading navigator data"; + // allocate buffer for pps data char buffer[ppsBufferSize]; diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp index cce817d1ed..4d97db413b 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp @@ -44,6 +44,12 @@ #include #include +#ifdef QQNXNAVIGATOR_DEBUG +#define qNavigatorDebug qDebug +#else +#define qNavigatorDebug QT_NO_QDEBUG_MACRO +#endif + static const char *navigatorControlPath = "/pps/services/navigator/control"; static const int ppsBufferSize = 4096; @@ -75,9 +81,7 @@ bool QQnxNavigatorPps::openPpsConnection() return false; } -#if defined(QQNXNAVIGATOR_DEBUG) - qDebug() << Q_FUNC_INFO << "successfully connected to Navigator. fd=" << m_fd; -#endif + qNavigatorDebug() << Q_FUNC_INFO << "successfully connected to Navigator. fd=" << m_fd; return true; } @@ -99,9 +103,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra ppsMessage += "\n"; -#if defined(QQNXNAVIGATOR_DEBUG) - qDebug() << Q_FUNC_INFO << "sending PPS message:\n" << ppsMessage; -#endif + qNavigatorDebug() << Q_FUNC_INFO << "sending PPS message:\n" << ppsMessage; // send pps message to navigator errno = 0; @@ -123,9 +125,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra // ensure data is null terminated buffer[bytes] = '\0'; -#if defined(QQNXNAVIGATOR_DEBUG) - qDebug() << Q_FUNC_INFO << "received PPS message:\n" << buffer; -#endif + qNavigatorDebug() << Q_FUNC_INFO << "received PPS message:\n" << buffer; // process received message QByteArray ppsData(buffer); @@ -144,9 +144,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash &messageFields) { -#if defined(QQNXNAVIGATOR_DEBUG) - qDebug() << "PPS: data=" << ppsData; -#endif + qNavigatorDebug() << Q_FUNC_INFO << "data=" << ppsData; // tokenize pps data into lines QList lines = ppsData.split('\n'); @@ -162,9 +160,7 @@ void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash - -#if defined(QQNXROOTWINDOW_DEBUG) #include + +#ifdef QQNXROOTWINDOW_DEBUG +#define qRootWindowDebug qDebug +#else +#define qRootWindowDebug QT_NO_QDEBUG_MACRO #endif #include @@ -59,9 +62,7 @@ QQnxRootWindow::QQnxRootWindow(QQnxScreen *screen) m_window(0), m_windowGroupName() { -#if defined(QQNXROOTWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qRootWindowDebug() << Q_FUNC_INFO; // Create one top-level QNX window to act as a container for child windows // since navigator only supports one application window errno = 0; @@ -182,9 +183,7 @@ QQnxRootWindow::~QQnxRootWindow() void QQnxRootWindow::post() const { -#if defined(QQNXROOTWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qRootWindowDebug() << Q_FUNC_INFO; errno = 0; screen_buffer_t buffer; int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&buffer); @@ -202,9 +201,7 @@ void QQnxRootWindow::post() const void QQnxRootWindow::flush() const { -#if defined(QQNXROOTWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qRootWindowDebug() << Q_FUNC_INFO; // Force immediate display update errno = 0; int result = screen_flush_context(m_screen->nativeContext(), 0); @@ -215,9 +212,7 @@ void QQnxRootWindow::flush() const void QQnxRootWindow::setRotation(int rotation) { -#if defined(QQNXROOTWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "angle =" << rotation; -#endif + qRootWindowDebug() << Q_FUNC_INFO << "angle =" << rotation; errno = 0; int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation); if (result != 0) { diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index dcfa027aca..4a9c49593b 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -43,13 +43,17 @@ #include "qqnxwindow.h" #include -#ifdef QQNXSCREEN_DEBUG -# include -#endif +#include #include #include +#ifdef QQNXSCREEN_DEBUG +#define qScreenDebug qDebug +#else +#define qScreenDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen) @@ -61,9 +65,7 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_keyboardHeight(0), m_platformContext(0) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; // Cache initial orientation of this display errno = 0; int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation); @@ -103,16 +105,12 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, QQnxScreen::~QQnxScreen() { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; } static int defaultDepth() { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; static int defaultDepth = 0; if (defaultDepth == 0) { // check if display depth was specified in environment variable; @@ -127,9 +125,7 @@ static int defaultDepth() QRect QQnxScreen::availableGeometry() const { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; // available geometry = total geometry - keyboard return QRect(m_currentGeometry.x(), m_currentGeometry.y(), m_currentGeometry.width(), m_currentGeometry.height() - m_keyboardHeight); @@ -148,13 +144,11 @@ qreal QQnxScreen::refreshRate() const qWarning("QQnxScreen: Failed to query screen mode. Using default value of 60Hz"); return 60.0; } -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "screen mode:" << endl - << " width =" << displayMode.width << endl - << " height =" << displayMode.height << endl - << " refresh =" << displayMode.refresh << endl - << " interlaced =" << displayMode.interlaced; -#endif + qScreenDebug() << Q_FUNC_INFO << "screen mode:" << endl + << " width =" << displayMode.width << endl + << " height =" << displayMode.height << endl + << " refresh =" << displayMode.refresh << endl + << " interlaced =" << displayMode.interlaced; return static_cast(displayMode.refresh); } @@ -169,9 +163,7 @@ Qt::ScreenOrientation QQnxScreen::orientation() const orient = Qt::InvertedLandscapeOrientation; else orient = Qt::InvertedPortraitOrientation; -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "orientation =" << orient; -#endif + qScreenDebug() << Q_FUNC_INFO << "orientation =" << orient; return orient; } @@ -185,9 +177,7 @@ static bool isOrthogonal(int angle1, int angle2) void QQnxScreen::setRotation(int rotation) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "orientation =" << rotation; -#endif + qScreenDebug() << Q_FUNC_INFO << "orientation =" << rotation; // Check if rotation changed if (m_currentRotation != rotation) { // Update rotation of root window @@ -205,9 +195,7 @@ void QQnxScreen::setRotation(int rotation) // Resize root window if we've rotated 90 or 270 from previous orientation if (isOrthogonal(m_currentRotation, rotation)) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); -#endif + qScreenDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); if (m_rootWindow) m_rootWindow->resize(m_currentGeometry.size()); } else { @@ -244,9 +232,7 @@ QQnxWindow *QQnxScreen::findWindow(screen_window_t windowHandle) void QQnxScreen::addWindow(QQnxWindow *window) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window; -#endif + qScreenDebug() << Q_FUNC_INFO << "window =" << window; if (m_childWindows.contains(window)) return; @@ -267,9 +253,7 @@ void QQnxScreen::addWindow(QQnxWindow *window) void QQnxScreen::removeWindow(QQnxWindow *window) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window; -#endif + qScreenDebug() << Q_FUNC_INFO << "window =" << window; const int numWindowsRemoved = m_childWindows.removeAll(window); if (numWindowsRemoved > 0) @@ -278,9 +262,7 @@ void QQnxScreen::removeWindow(QQnxWindow *window) void QQnxScreen::raiseWindow(QQnxWindow *window) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window; -#endif + qScreenDebug() << Q_FUNC_INFO << "window =" << window; removeWindow(window); m_childWindows.push_back(window); @@ -289,9 +271,7 @@ void QQnxScreen::raiseWindow(QQnxWindow *window) void QQnxScreen::lowerWindow(QQnxWindow *window) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window; -#endif + qScreenDebug() << Q_FUNC_INFO << "window =" << window; removeWindow(window); m_childWindows.push_front(window); @@ -300,9 +280,7 @@ void QQnxScreen::lowerWindow(QQnxWindow *window) void QQnxScreen::updateHierarchy() { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; QList::const_iterator it; int topZorder = 1; // root window is z-order 0, all "top" level windows are "above" it @@ -326,9 +304,7 @@ void QQnxScreen::updateHierarchy() void QQnxScreen::onWindowPost(QQnxWindow *window) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; Q_UNUSED(window) // post app window (so navigator will show it) after first child window @@ -392,9 +368,7 @@ void QQnxScreen::windowClosed(void *window) void QQnxScreen::activateWindowGroup(const QByteArray &id) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; if (!rootWindow() || id != rootWindow()->groupName()) return; @@ -410,9 +384,7 @@ void QQnxScreen::activateWindowGroup(const QByteArray &id) void QQnxScreen::deactivateWindowGroup(const QByteArray &id) { -#if defined(QQNXSCREEN_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qScreenDebug() << Q_FUNC_INFO; if (!rootWindow() || id != rootWindow()->groupName()) return; diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 9640c65bcb..4a1e904838 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -49,6 +49,12 @@ #include #include +#ifdef QQNXSCREENEVENT_DEBUG +#define qScreenEventDebug qDebug +#else +#define qScreenEventDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxScreenEventHandler::QQnxScreenEventHandler() @@ -116,9 +122,7 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType) default: // event ignored -#if defined(QQNXSCREENEVENT_DEBUG) - qDebug() << "QQNX: QNX unknown event"; -#endif + qScreenEventDebug() << Q_FUNC_INFO << "unknown event"; return false; } @@ -166,9 +170,7 @@ void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifie QWindowSystemInterface::handleExtendedKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, scan, sym, modifiers, keyStr); -#if defined(QQNXSCREENEVENT_DEBUG) - qDebug() << "QQNX: Qt key t=" << type << ", k=" << key << ", s=" << keyStr; -#endif + qScreenEventDebug() << Q_FUNC_INFO << "Qt key t=" << type << ", k=" << key << ", s=" << keyStr; } } @@ -261,16 +263,12 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) if (wOld) { QWindowSystemInterface::handleLeaveEvent(wOld); -#if defined(QQNXSCREENEVENT_DEBUG) - qDebug() << "QQNX: Qt leave, w=" << wOld; -#endif + qScreenEventDebug() << Q_FUNC_INFO << "Qt leave, w=" << wOld; } if (w) { QWindowSystemInterface::handleEnterEvent(w); -#if defined(QQNXSCREENEVENT_DEBUG) - qDebug() << "QQNX: Qt enter, w=" << w; -#endif + qScreenEventDebug() << Q_FUNC_INFO << "Qt enter, w=" << w; } } m_lastMouseWindow = qnxWindow; @@ -312,18 +310,14 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) 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 + qScreenEventDebug() << Q_FUNC_INFO << "Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast(buttons); } 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 + qScreenEventDebug() << Q_FUNC_INFO << "Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast(wheelDelta); } } @@ -379,16 +373,12 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) if (wOld) { QWindowSystemInterface::handleLeaveEvent(wOld); - #if defined(QQNXSCREENEVENT_DEBUG) - qDebug() << "QQNX: Qt leave, w=" << wOld; - #endif + qScreenEventDebug() << Q_FUNC_INFO << "Qt leave, w=" << wOld; } if (w) { QWindowSystemInterface::handleEnterEvent(w); - #if defined(QQNXSCREENEVENT_DEBUG) - qDebug() << "QQNX: Qt enter, w=" << w; - #endif + qScreenEventDebug() << Q_FUNC_INFO << "Qt enter, w=" << w; } } m_lastMouseWindow = qnxWindow; @@ -406,9 +396,9 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) // 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 + qScreenEventDebug() << Q_FUNC_INFO << "Qt mouse, w =" << w + << ", (" << localPoint.x() << "," << localPoint.y() + << "), b =" << buttons; } // get size of screen which contains window @@ -451,9 +441,9 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) // 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 + qScreenEventDebug() << Q_FUNC_INFO << "Qt touch, w =" << w + << ", p=(" << pos[0] << "," << pos[1] + << "), t=" << type; } } } diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp index a3e50dc8da..4d1f00893d 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp @@ -49,6 +49,12 @@ #include +#ifdef QQNXSCREENEVENTTHREAD_DEBUG +#define qScreenEventThreadDebug qDebug +#else +#define qScreenEventThreadDebug QT_NO_QDEBUG_MACRO +#endif + QQnxScreenEventThread::QQnxScreenEventThread(screen_context_t context, QQnxScreenEventHandler *screenEventHandler) : QThread(), m_screenContext(context), @@ -78,9 +84,7 @@ void QQnxScreenEventThread::run() if (result) qFatal("QQNX: failed to create screen event, errno=%d", errno); -#if defined(QQNXSCREENEVENTTHREAD_DEBUG) - qDebug() << "QQNX: screen event thread started"; -#endif + qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread started"; // loop indefinitely while (!m_quit) { @@ -101,18 +105,14 @@ void QQnxScreenEventThread::run() if (qnxType == SCREEN_EVENT_USER) { // treat all user events as shutdown requests - #if defined(QQNXSCREENEVENTTHREAD_DEBUG) - qDebug() << "QQNX: QNX user screen event"; - #endif + qScreenEventThreadDebug() << Q_FUNC_INFO << "QNX user screen event"; m_quit = true; } else { m_screenEventHandler->handleEvent(event, qnxType); } } -#if defined(QQNXSCREENEVENTTHREAD_DEBUG) - qDebug() << "QQNX: screen event thread stopped"; -#endif + qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread stopped"; // cleanup screen_destroy_event(event); @@ -146,14 +146,10 @@ void QQnxScreenEventThread::shutdown() // cleanup screen_destroy_event(event); -#if defined(QQNXSCREENEVENTTHREAD_DEBUG) - qDebug() << "QQNX: screen event thread shutdown begin"; -#endif + qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread shutdown begin"; // block until thread terminates wait(); -#if defined(QQNXSCREENEVENTTHREAD_DEBUG) - qDebug() << "QQNX: screen event thread shutdown end"; -#endif + qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread shutdown end"; } diff --git a/src/plugins/platforms/qnx/qqnxsystemsettings.cpp b/src/plugins/platforms/qnx/qqnxsystemsettings.cpp index ca09aa067f..624896f203 100644 --- a/src/plugins/platforms/qnx/qqnxsystemsettings.cpp +++ b/src/plugins/platforms/qnx/qqnxsystemsettings.cpp @@ -44,13 +44,10 @@ #include #include -#include - QT_BEGIN_NAMESPACE QHash qt_qnx_createRoleFonts(QPlatformFontDatabase *fontDatabase) { - qDebug() << Q_FUNC_INFO; // See http://docs.blackberry.com/en/developers/deliverables/27299/Text_tablet_1526156_11.jsp // which recommends using normal font size of 21 pixels and 36 pixels for titles (not covered // by the theme system). diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp index 3f0e5b2713..64ce4b029f 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp @@ -47,6 +47,12 @@ #include #include +#ifdef QQNXVIRTUALKEYBOARD_DEBUG +#define qVirtualKeyboardDebug qDebug +#else +#define qVirtualKeyboardDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxVirtualKeyboardBps::QQnxVirtualKeyboardBps(QObject *parent) @@ -79,20 +85,14 @@ bool QQnxVirtualKeyboardBps::handleEvent(bps_event_t *event) bool QQnxVirtualKeyboardBps::showKeyboard() { -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "current visibility=" << isVisible(); -#endif - + qVirtualKeyboardDebug() << Q_FUNC_INFO << "current visibility=" << isVisible(); virtualkeyboard_show(); return true; } bool QQnxVirtualKeyboardBps::hideKeyboard() { -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "current visibility=" << isVisible(); -#endif - + qVirtualKeyboardDebug() << Q_FUNC_INFO << "current visibility=" << isVisible(); virtualkeyboard_hide(); return true; } @@ -136,9 +136,7 @@ void QQnxVirtualKeyboardBps::applyKeyboardMode(KeyboardMode mode) break; } -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "mode=" << mode; -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO << "mode=" << mode; virtualkeyboard_change_options(layout, VIRTUALKEYBOARD_ENTER_DEFAULT); } @@ -148,19 +146,14 @@ bool QQnxVirtualKeyboardBps::handleLocaleEvent(bps_event_t *event) if (bps_event_get_code(event) == LOCALE_INFO) { const QString language = QString::fromAscii(locale_event_get_language(event)); const QString country = QString::fromAscii(locale_event_get_country(event)); - const QLocale newLocale(language + QLatin1Char('_') + country); -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "current locale" << locale() << "new locale=" << newLocale; -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO << "current locale" << locale() << "new locale=" << newLocale; setLocale(newLocale); return true; } -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << "QQNX: Unhandled locale event. code=" << bps_event_get_code(event); -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO << "Unhandled locale event. code=" << bps_event_get_code(event); return false; } @@ -169,37 +162,24 @@ bool QQnxVirtualKeyboardBps::handleVirtualKeyboardEvent(bps_event_t *event) { switch (bps_event_get_code(event)) { case VIRTUALKEYBOARD_EVENT_VISIBLE: - #if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "EVENT VISIBLE: current visibility=" << isVisible(); - #endif - + qVirtualKeyboardDebug() << Q_FUNC_INFO << "EVENT VISIBLE: current visibility=" << isVisible(); setVisible(true); break; case VIRTUALKEYBOARD_EVENT_HIDDEN: - #if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "EVENT HIDDEN: current visibility=" << isVisible(); - #endif - + qVirtualKeyboardDebug() << Q_FUNC_INFO << "EVENT HIDDEN: current visibility=" << isVisible(); setVisible(false); break; case VIRTUALKEYBOARD_EVENT_INFO: { const int newHeight = virtualkeyboard_event_get_height(event); - - #if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << Q_FUNC_INFO << "EVENT INFO: current height=" << height() << "new height=" << newHeight; - #endif - + qVirtualKeyboardDebug() << Q_FUNC_INFO << "EVENT INFO: current height=" << height() << "new height=" << newHeight; setHeight(newHeight); break; } default: - #if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << "QQNX: Unhandled virtual keyboard event. code=" << bps_event_get_code(event); - #endif - + qVirtualKeyboardDebug() << Q_FUNC_INFO << "Unhandled virtual keyboard event. code=" << bps_event_get_code(event); return false; } diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp index d139e7f66b..45bb1b615a 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp @@ -56,6 +56,12 @@ #include #include +#ifdef QQNXVIRTUALKEYBOARD_DEBUG +#define qVirtualKeyboardDebug qDebug +#else +#define qVirtualKeyboardDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE const char *QQnxVirtualKeyboardPps::ms_PPSPath = "/pps/services/input/control"; @@ -80,9 +86,7 @@ QQnxVirtualKeyboardPps::~QQnxVirtualKeyboardPps() void QQnxVirtualKeyboardPps::start() { -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << "QQNX: starting keyboard event processing"; -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO << "starting keyboard event processing"; if (!connect()) return; } @@ -173,9 +177,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() { ssize_t nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1); -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << "QQNX: keyboardMessage size: " << nread; -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO << "keyboardMessage size: " << nread; if (nread < 0){ connect(); // reconnect return; @@ -261,16 +263,12 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage() const QLocale locale = QLocale(languageId + QLatin1Char('_') + countryId); setLocale(locale); -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << "QQNX: handleKeyboardInfoMessage size=" << newHeight << "locale=" << locale; -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO << "size=" << newHeight << "locale=" << locale; } bool QQnxVirtualKeyboardPps::showKeyboard() { -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << "QQNX: showKeyboard()"; -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO; // Try to connect. if (m_fd == -1 && !connect()) @@ -302,9 +300,7 @@ bool QQnxVirtualKeyboardPps::showKeyboard() bool QQnxVirtualKeyboardPps::hideKeyboard() { -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) - qDebug() << "QQNX: hideKeyboard()"; -#endif + qVirtualKeyboardDebug() << Q_FUNC_INFO; if (m_fd == -1 && !connect()) return false; diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 6387193aba..72187f8238 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -53,6 +53,12 @@ #include +#ifdef QQNXWINDOW_DEBUG +#define qWindowDebug qDebug +#else +#define qWindowDebug QT_NO_QDEBUG_MACRO +#endif + QT_BEGIN_NAMESPACE QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) @@ -68,9 +74,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) m_parentWindow(0), m_visible(true) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size(); int result; // Create child QNX window @@ -133,9 +137,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) QQnxWindow::~QQnxWindow() { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); // Remove from plugin's window mapper QQnxIntegration::removeWindow(m_window); @@ -154,9 +156,9 @@ QQnxWindow::~QQnxWindow() void QQnxWindow::setGeometry(const QRect &rect) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window() << ", (" << rect.x() << "," << rect.y() << "," << rect.width() << "," << rect.height() << ")"; -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window() + << ", (" << rect.x() << "," << rect.y() + << "," << rect.width() << "," << rect.height() << ")"; QRect oldGeometry = geometry(); @@ -221,9 +223,7 @@ void QQnxWindow::setGeometry(const QRect &rect) void QQnxWindow::setOffset(const QPoint &offset) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); // Move self and then children. QRect newGeometry = geometry(); newGeometry.translate(offset); @@ -249,9 +249,7 @@ void QQnxWindow::setOffset(const QPoint &offset) void QQnxWindow::setVisible(bool visible) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; m_visible = visible; @@ -269,9 +267,7 @@ void QQnxWindow::setVisible(bool visible) void QQnxWindow::updateVisibility(bool parentVisible) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "parentVisible =" << parentVisible << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "parentVisible =" << parentVisible << "window =" << window(); // Set window visibility errno = 0; int val = (m_visible && parentVisible) ? 1 : 0; @@ -288,9 +284,7 @@ void QQnxWindow::updateVisibility(bool parentVisible) void QQnxWindow::setOpacity(qreal level) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window() << "opacity =" << level; -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "opacity =" << level; // Set window global alpha errno = 0; int val = (int)(level * 255); @@ -310,9 +304,7 @@ bool QQnxWindow::isExposed() const void QQnxWindow::setBufferSize(const QSize &size) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size; -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size; // Set window buffer size errno = 0; int val[2] = { size.width(), size.height() }; @@ -357,9 +349,7 @@ void QQnxWindow::setBufferSize(const QSize &size) QQnxBuffer &QQnxWindow::renderBuffer() { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); // Check if render buffer is invalid if (m_currentBufferIndex == -1) { // Get all buffers available for rendering @@ -385,9 +375,7 @@ QQnxBuffer &QQnxWindow::renderBuffer() void QQnxWindow::scroll(const QRegion ®ion, int dx, int dy, bool flush) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); copyBack(region, dx, dy, flush); m_scrolled += region; } @@ -396,9 +384,7 @@ void QQnxWindow::post(const QRegion &dirty) { // Check if render buffer exists and something was rendered if (m_currentBufferIndex != -1 && !dirty.isEmpty()) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << "QQnxWindow::post - window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); QQnxBuffer ¤tBuffer = m_buffers[m_currentBufferIndex]; // Copy unmodified region from old render buffer to new render buffer; @@ -437,9 +423,7 @@ void QQnxWindow::post(const QRegion &dirty) void QQnxWindow::setScreen(QQnxScreen *platformScreen) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen; -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen; if (m_screen == platformScreen) return; @@ -477,9 +461,7 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) void QQnxWindow::removeFromParent() { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); // Remove from old Hierarchy position if (m_parentWindow) { if (m_parentWindow->m_childWindows.removeAll(this)) @@ -493,9 +475,7 @@ void QQnxWindow::removeFromParent() void QQnxWindow::setParent(const QPlatformWindow *window) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << this->window() << "platformWindow =" << window; -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << this->window() << "platformWindow =" << window; // Cast away the const, we need to modify the hierarchy. QQnxWindow *newParent = 0; @@ -523,9 +503,7 @@ void QQnxWindow::setParent(const QPlatformWindow *window) void QQnxWindow::raise() { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); QQnxWindow *oldParent = m_parentWindow; if (oldParent) { @@ -540,9 +518,7 @@ void QQnxWindow::raise() void QQnxWindow::lower() { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); QQnxWindow *oldParent = m_parentWindow; if (oldParent) { @@ -557,9 +533,7 @@ void QQnxWindow::lower() void QQnxWindow::requestActivateWindow() { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); // TODO: Tell screen to set keyboard focus to this window. @@ -569,9 +543,7 @@ void QQnxWindow::requestActivateWindow() void QQnxWindow::gainedFocus() { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); // Got focus QWindowSystemInterface::handleWindowActivated(window()); @@ -617,9 +589,7 @@ void QQnxWindow::updateZorder(int &topZorder) void QQnxWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO << "window =" << window(); -#endif + qWindowDebug() << Q_FUNC_INFO << "window =" << window(); int result; // Abort if previous buffer is invalid @@ -679,9 +649,7 @@ void QQnxWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush) int QQnxWindow::platformWindowFormatToNativeFormat(const QSurfaceFormat &format) { -#if defined(QQNXWINDOW_DEBUG) - qDebug() << Q_FUNC_INFO; -#endif + qWindowDebug() << Q_FUNC_INFO; // Extract size of colour channels from window format int redSize = format.redBufferSize(); if (redSize == -1) {