diff options
author | Tuomas Vaarala <tuomas.vaarala@qt.io> | 2024-04-25 14:35:54 +0300 |
---|---|---|
committer | Tuomas Vaarala <tuomas.vaarala@qt.io> | 2024-04-29 06:39:18 +0300 |
commit | 4946982534d4d256590dffd44046fe642456703f (patch) | |
tree | c0b83cd331646664e9475359bf123eea00259d48 /src/plugins/platforms/qnx | |
parent | f0633e823796775d2c019363ca4f1cb008851402 (diff) |
[QNX] Add support for QLoggingCategory in QNX QPA debug log output
Makes it possible to enable debug log outputs via QLoggingCategory.
Earlier it was only possible via buid time flags.
Change-Id: Iaec732e7acdf44a74c9d7c806bf0e6f5a5f87b1c
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Diffstat (limited to 'src/plugins/platforms/qnx')
34 files changed, 299 insertions, 347 deletions
diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp index 05389d3ea6..9b1107b7ec 100644 --- a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp +++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp @@ -6,14 +6,10 @@ #include <QDebug> #include <QUrl> -#if defined(QQNXNAVIGATOR_DEBUG) -#define qNavigatorDebug qDebug -#else -#define qNavigatorDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaQnxNavigator, "qt.qpa.qnx.navigator"); + QQnxAbstractNavigator::QQnxAbstractNavigator(QObject *parent) : QObject(parent) { @@ -32,7 +28,7 @@ bool QQnxAbstractNavigator::invokeUrl(const QUrl &url) // which is not recognized by the navigator anymore const bool result = requestInvokeUrl(url.toString().toUtf8()); - qNavigatorDebug() << "url=" << url << "result=" << result; + qCDebug(lcQpaQnxNavigator) << Q_FUNC_INFO << "url =" << url << "result =" << result; return result; } diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.h b/src/plugins/platforms/qnx/qqnxabstractnavigator.h index b4e4dd9bf8..fc92592307 100644 --- a/src/plugins/platforms/qnx/qqnxabstractnavigator.h +++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.h @@ -5,9 +5,12 @@ #define QQNXABSTRACTNAVIGATOR_H #include <QObject> +#include <QtCore/QLoggingCategory> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaQnxNavigator); + class QUrl; class QQnxAbstractNavigator : public QObject diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp index 1ea9a8b0d3..4d3b5256b2 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.cpp +++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp @@ -10,24 +10,20 @@ #include <errno.h> #include <sys/mman.h> -#if defined(QQNXBUFFER_DEBUG) -#define qBufferDebug qDebug -#else -#define qBufferDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaScreenBuffer, "qt.qpa.screen.buffer"); + QQnxBuffer::QQnxBuffer() : m_buffer(0) { - qBufferDebug("empty"); + qCDebug(lcQpaScreenBuffer) << Q_FUNC_INFO << "Empty"; } QQnxBuffer::QQnxBuffer(screen_buffer_t buffer) : m_buffer(buffer) { - qBufferDebug("normal"); + qCDebug(lcQpaScreenBuffer) << Q_FUNC_INFO << "Normal"; // Get size of buffer int size[2]; @@ -77,7 +73,7 @@ QQnxBuffer::QQnxBuffer(screen_buffer_t buffer) imageFormat = QImage::Format_ARGB32_Premultiplied; break; default: - qFatal("QQNX: unsupported buffer format, format=%d", screenFormat); + qFatal(lcQpaScreenBuffer, "QQNX: unsupported buffer format, format=%d", screenFormat); } // wrap buffer in an image @@ -88,27 +84,27 @@ QQnxBuffer::QQnxBuffer(const QQnxBuffer &other) : m_buffer(other.m_buffer), m_image(other.m_image) { - qBufferDebug("copy"); + qCDebug(lcQpaScreenBuffer) << Q_FUNC_INFO << "Copy"; } QQnxBuffer::~QQnxBuffer() { - qBufferDebug(); + qCDebug(lcQpaScreenBuffer) << Q_FUNC_INFO; } void QQnxBuffer::invalidateInCache() { - qBufferDebug(); + qCDebug(lcQpaScreenBuffer) << Q_FUNC_INFO; // Verify native buffer exists if (Q_UNLIKELY(!m_buffer)) - qFatal("QQNX: can't invalidate cache for null buffer"); + qFatal(lcQpaScreenBuffer, "QQNX: can't invalidate cache for null buffer"); // Evict buffer's data from cache errno = 0; int result = msync(m_image.bits(), m_image.height() * m_image.bytesPerLine(), MS_INVALIDATE | MS_CACHE_ONLY); if (Q_UNLIKELY(result != 0)) - qFatal("QQNX: failed to invalidate cache, errno=%d", errno); + qFatal(lcQpaScreenBuffer, "QQNX: failed to invalidate cache, errno=%d", errno); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxbuffer.h b/src/plugins/platforms/qnx/qqnxbuffer.h index b8f1443ad1..b456eb2a62 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.h +++ b/src/plugins/platforms/qnx/qqnxbuffer.h @@ -5,11 +5,14 @@ #define QQNXBUFFER_H #include <QtGui/QImage> +#include <QtCore/QLoggingCategory> #include <screen/screen.h> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreenBuffer) + class QQnxBuffer { public: diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp index 6497367579..788cddea87 100644 --- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp @@ -13,14 +13,10 @@ #include <QtCore/QSocketNotifier> #include <QtCore/private/qcore_unix_p.h> -#if defined(QQNXBUTTON_DEBUG) -#define qButtonDebug qDebug -#else -#define qButtonDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaInputHwButton, "qt.qpa.input.hwbutton"); + const char *QQnxButtonEventNotifier::ppsPath = "/pps/system/buttons/status"; const size_t QQnxButtonEventNotifier::ppsBufferSize = 256; @@ -47,7 +43,7 @@ QQnxButtonEventNotifier::~QQnxButtonEventNotifier() void QQnxButtonEventNotifier::start() { - qButtonDebug("starting hardware button event processing"); + qCDebug(lcQpaInputHwButton) << "Starting hardware button event processing"; if (m_fd != -1) return; @@ -64,7 +60,7 @@ void QQnxButtonEventNotifier::start() m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read); QObject::connect(m_readNotifier, SIGNAL(activated(QSocketDescriptor)), this, SLOT(updateButtonStates())); - qButtonDebug("successfully connected to Navigator. fd = %d", m_fd); + qCDebug(lcQpaInputHwButton, "successfully connected to Navigator. fd = %d", m_fd); } void QQnxButtonEventNotifier::updateButtonStates() @@ -75,7 +71,8 @@ void QQnxButtonEventNotifier::updateButtonStates() // Attempt to read pps data errno = 0; int bytes = qt_safe_read(m_fd, buffer, ppsBufferSize - 1); - qButtonDebug() << "Read" << bytes << "bytes of data"; + qCDebug(lcQpaInputHwButton) << "Read" << bytes << "bytes of data"; + if (bytes == -1) { qWarning("QQNX: failed to read hardware buttons pps object, errno=%d", errno); return; @@ -88,7 +85,7 @@ void QQnxButtonEventNotifier::updateButtonStates() // Ensure data is null terminated buffer[bytes] = '\0'; - qButtonDebug("received PPS message:\n%s", buffer); + qCDebug(lcQpaInputHwButton, "Received PPS message:\n%s", buffer); // Process received message QByteArray ppsData = QByteArray::fromRawData(buffer, bytes); @@ -104,7 +101,8 @@ void QQnxButtonEventNotifier::updateButtonStates() // If state has changed, update our state and inject a keypress event if (m_state[buttonId] != newState) { - qButtonDebug() << "Hardware button event: button =" << key << "state =" << fields.value(key); + qCDebug(lcQpaInputHwButton) << "Hardware button event: button =" << key << "state =" << fields.value(key); + m_state[buttonId] = newState; // Is it a key press or key release event? @@ -129,7 +127,7 @@ void QQnxButtonEventNotifier::updateButtonStates() break; default: - qButtonDebug("Unknown hardware button"); + qCDebug(lcQpaInputHwButton) << "Unknown hardware button"; continue; } @@ -170,7 +168,7 @@ bool QQnxButtonEventNotifier::parsePPS(const QByteArray &ppsData, QHash<QByteArr // tokenize current attribute const QByteArray &attr = lines.at(i); - qButtonDebug() << "attr=" << attr; + qCDebug(lcQpaInputHwButton) << Q_FUNC_INFO << "attr =" << attr; int doubleColon = attr.indexOf(QByteArrayLiteral("::")); if (doubleColon == -1) { diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h index 81ccf64415..476119ae27 100644 --- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h +++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h @@ -5,9 +5,12 @@ #define QQNXBUTTONSEVENTNOTIFIER_H #include <QObject> +#include <QtCore/QLoggingCategory> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaInputHwButton); + class QSocketNotifier; class QQnxButtonEventNotifier : public QObject diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp index 8e42148c12..3f27ec8069 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.cpp +++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp @@ -17,14 +17,10 @@ #include <clipboard/clipboard.h> #include <errno.h> -#if defined(QQNXCLIPBOARD_DEBUG) -#define qClipboardDebug qDebug -#else -#define qClipboardDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaClipboard, "qt.qpa.clipboard"); + // null terminated array static const char *typeList[] = {"text/html", "text/plain", "image/png", "image/jpeg", "application/x-color", 0}; @@ -66,13 +62,13 @@ public: void addFormatToCheck(const QString &format) { m_formatsToCheck << format; - qClipboardDebug() << "formats=" << m_formatsToCheck; + qCDebug(lcQpaClipboard) << "formats=" << m_formatsToCheck; } bool hasFormat(const QString &mimetype) const override { const bool result = is_clipboard_format_present(mimetype.toUtf8().constData()) == 0; - qClipboardDebug() << "mimetype=" << mimetype << "result=" << result; + qCDebug(lcQpaClipboard) << "mimetype=" << mimetype << "result=" << result; return result; } @@ -85,7 +81,7 @@ public: result << format; } - qClipboardDebug() << "result=" << result; + qCDebug(lcQpaClipboard) << "result=" << result; return result; } @@ -109,7 +105,7 @@ public: protected: QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const override { - qClipboardDebug() << "mimetype=" << mimetype << "preferredType=" << preferredType.name(); + qCDebug(lcQpaClipboard) << "mimetype=" << mimetype << "preferredType=" << preferredType.name(); if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0) return QMimeData::retrieveData(mimetype, preferredType); @@ -121,7 +117,7 @@ private Q_SLOTS: void releaseOwnership() { if (m_userMimeData) { - qClipboardDebug() << "user data formats=" << m_userMimeData->formats() << "system formats=" << formats(); + qCDebug(lcQpaClipboard) << "user data formats=" << m_userMimeData->formats() << "system formats=" << formats(); delete m_userMimeData; m_userMimeData = 0; m_clipboard->emitChanged(QClipboard::Clipboard); @@ -167,7 +163,7 @@ void QQnxClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) } const QStringList formats = data->formats(); - qClipboardDebug() << "formats=" << formats; + qCDebug(lcQpaClipboard) << "formats=" << formats; Q_FOREACH (const QString &format, formats) { const QByteArray buf = data->data(format); @@ -176,7 +172,7 @@ void QQnxClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) continue; int ret = set_clipboard_data(format.toUtf8().data(), buf.size(), buf.data()); - qClipboardDebug() << "set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret; + qCDebug(lcQpaClipboard) << "set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret; if (ret) m_mimeData->addFormatToCheck(format); } diff --git a/src/plugins/platforms/qnx/qqnxclipboard.h b/src/plugins/platforms/qnx/qqnxclipboard.h index adc70b158a..66f862f0dc 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.h +++ b/src/plugins/platforms/qnx/qqnxclipboard.h @@ -11,6 +11,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaClipboard); + class QQnxClipboard : public QPlatformClipboard { public: diff --git a/src/plugins/platforms/qnx/qqnxcursor.cpp b/src/plugins/platforms/qnx/qqnxcursor.cpp index 03c4e16401..7c55dd79b3 100644 --- a/src/plugins/platforms/qnx/qqnxcursor.cpp +++ b/src/plugins/platforms/qnx/qqnxcursor.cpp @@ -5,14 +5,10 @@ #include <QtCore/QDebug> -#if defined(QQNXCURSOR_DEBUG) -#define qCursorDebug qDebug -#else -#define qCursorDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaQnx, "qt.qpa.qnx"); + QQnxCursor::QQnxCursor() { } @@ -27,13 +23,13 @@ void QQnxCursor::changeCursor(QCursor *windowCursor, QWindow *window) void QQnxCursor::setPos(const QPoint &pos) { - qCursorDebug() << "QQnxCursor::setPos -" << pos; + qCDebug(lcQpaQnx) << "QQnxCursor::setPos -" << pos; m_pos = pos; } QPoint QQnxCursor::pos() const { - qCursorDebug() << "QQnxCursor::pos -" << m_pos; + qCDebug(lcQpaQnx) << "QQnxCursor::pos -" << m_pos; return m_pos; } diff --git a/src/plugins/platforms/qnx/qqnxcursor.h b/src/plugins/platforms/qnx/qqnxcursor.h index 6592e0a5ee..707bdbaaa2 100644 --- a/src/plugins/platforms/qnx/qqnxcursor.h +++ b/src/plugins/platforms/qnx/qqnxcursor.h @@ -5,9 +5,12 @@ #define QQNXCURSOR_H #include <qpa/qplatformcursor.h> +#include <QtCore/QLoggingCategory> QT_BEGIN_NAMESPACE +// Q_DECLARE_LOGGING_CATEGORY(lcQpaQnx); + class QQnxCursor : public QPlatformCursor { public: diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.cpp b/src/plugins/platforms/qnx/qqnxeglwindow.cpp index ed53308216..854ad46c3d 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxeglwindow.cpp @@ -10,14 +10,10 @@ #include <errno.h> -#if defined(QQNXEGLWINDOW_DEBUG) -#define qEglWindowDebug qDebug -#else -#define qEglWindowDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaWindowEgl, "qt.qpa.window.egl"); + QQnxEglWindow::QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow) : QQnxWindow(window, context, needRootWindow), m_newSurfaceRequested(true), @@ -96,8 +92,8 @@ void QQnxEglWindow::createEGLSurface(QQnxGLContext *context) EGL_NONE }; - qEglWindowDebug() << "Creating EGL surface from" << this << context - << window()->surfaceType() << window()->type(); + qCDebug(lcQpaWindowEgl) << "Creating EGL surface from" << this << context + << window()->surfaceType() << window()->type(); // Create EGL surface EGLSurface eglSurface = eglCreateWindowSurface( diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.h b/src/plugins/platforms/qnx/qqnxeglwindow.h index 909a901d3c..548d9be1ee 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.h +++ b/src/plugins/platforms/qnx/qqnxeglwindow.h @@ -6,9 +6,12 @@ #include "qqnxwindow.h" #include <QtCore/QMutex> +#include <QtCore/QLoggingCategory> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaWindowEgl); + class QQnxGLContext; class QQnxEglWindow : public QQnxWindow diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index 7b5b11b2e4..3d8fecf88b 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -14,14 +14,10 @@ #include <dlfcn.h> -#if defined(QQNXGLCONTEXT_DEBUG) -#define qGLContextDebug qDebug -#else -#define qGLContextDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaGLContext, "qt.qpa.glcontext"); + static QEGLPlatformContext::Flags makeFlags() { QEGLPlatformContext::Flags result = {}; @@ -51,13 +47,13 @@ EGLSurface QQnxGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface bool QQnxGLContext::makeCurrent(QPlatformSurface *surface) { - qGLContextDebug(); + qCDebug(lcQpaGLContext) << Q_FUNC_INFO; return QEGLPlatformContext::makeCurrent(surface); } void QQnxGLContext::swapBuffers(QPlatformSurface *surface) { - qGLContextDebug(); + qCDebug(lcQpaGLContext) << Q_FUNC_INFO; QEGLPlatformContext::swapBuffers(surface); diff --git a/src/plugins/platforms/qnx/qqnxglobal.cpp b/src/plugins/platforms/qnx/qqnxglobal.cpp index 85642b44b3..9cfc328e8f 100644 --- a/src/plugins/platforms/qnx/qqnxglobal.cpp +++ b/src/plugins/platforms/qnx/qqnxglobal.cpp @@ -15,6 +15,8 @@ void qScreenCheckError(int rc, const char *funcInfo, const char *message, bool c } if (Q_UNLIKELY(rc)) { + qCDebug(lcQpaQnx, "%s - Screen: %s - Error: %s (%i)", funcInfo, message, strerror(errno), errno); + if (Q_UNLIKELY(critical)) qCritical("%s - Screen: %s - Error: %s (%i)", funcInfo, message, strerror(errno), errno); else diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index a1063444d1..cd41ebb8c2 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -25,17 +25,7 @@ #include <process.h> #include <sys/keycodes.h> -#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) -#define qInputContextIMFRequestDebug qDebug -#else -#define qInputContextIMFRequestDebug QT_NO_QDEBUG_MACRO -#endif - -#if defined(QQNXINPUTCONTEXT_DEBUG) -#define qInputContextDebug qDebug -#else -#define qInputContextDebug QT_NO_QDEBUG_MACRO -#endif +Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods"); static QQnxInputContext *sInputContextInstance; static QColor sSelectedColor(0,0xb8,0,85); @@ -161,7 +151,7 @@ static int32_t ic_begin_batch_edit(input_session_t *ic) // See comment at beginning of namespace declaration for general information static int32_t ic_commit_text(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfCommitText); event.ct.text = text; @@ -176,7 +166,7 @@ static int32_t ic_commit_text(input_session_t *ic, spannable_string_t *text, int // See comment at beginning of namespace declaration for general information static int32_t ic_delete_surrounding_text(input_session_t *ic, int32_t left_length, int32_t right_length) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfDeleteSurroundingText); event.dst.left_length = left_length; @@ -200,7 +190,7 @@ static int32_t ic_end_batch_edit(input_session_t *ic) // See comment at beginning of namespace declaration for general information static int32_t ic_finish_composing_text(input_session_t *ic) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfFinishComposingText); event.fct.result = -1; @@ -213,7 +203,7 @@ static int32_t ic_finish_composing_text(input_session_t *ic) // See comment at beginning of namespace declaration for general information static int32_t ic_get_cursor_position(input_session_t *ic) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfGetCursorPosition); event.gcp.result = -1; @@ -226,7 +216,7 @@ static int32_t ic_get_cursor_position(input_session_t *ic) // See comment at beginning of namespace declaration for general information static spannable_string_t *ic_get_text_after_cursor(input_session_t *ic, int32_t n, int32_t flags) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfGetTextAfterCursor); event.gtac.n = n; @@ -241,7 +231,7 @@ static spannable_string_t *ic_get_text_after_cursor(input_session_t *ic, int32_t // See comment at beginning of namespace declaration for general information static spannable_string_t *ic_get_text_before_cursor(input_session_t *ic, int32_t n, int32_t flags) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfGetTextBeforeCursor); event.gtac.n = n; @@ -256,7 +246,7 @@ static spannable_string_t *ic_get_text_before_cursor(input_session_t *ic, int32_ // See comment at beginning of namespace declaration for general information static int32_t ic_send_event(input_session_t *ic, event_t *event) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest imfEvent(ic, ImfSendEvent); imfEvent.sae.event = event; @@ -270,7 +260,7 @@ static int32_t ic_send_event(input_session_t *ic, event_t *event) // See comment at beginning of namespace declaration for general information static int32_t ic_send_async_event(input_session_t *ic, event_t *event) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; // There's no difference from our point of view between ic_send_event & ic_send_async_event QQnxImfRequest imfEvent(ic, ImfSendEvent); @@ -285,7 +275,7 @@ static int32_t ic_send_async_event(input_session_t *ic, event_t *event) // See comment at beginning of namespace declaration for general information static int32_t ic_set_composing_region(input_session_t *ic, int32_t start, int32_t end) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfSetComposingRegion); event.scr.start = start; @@ -301,7 +291,7 @@ static int32_t ic_set_composing_region(input_session_t *ic, int32_t start, int32 // See comment at beginning of namespace declaration for general information static int32_t ic_set_composing_text(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfSetComposingText); event.sct.text = text; @@ -316,7 +306,7 @@ static int32_t ic_set_composing_text(input_session_t *ic, spannable_string_t *te // See comment at beginning of namespace declaration for general information static int32_t ic_is_text_selected(input_session_t* ic, int32_t* pIsSelected) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfIsTextSelected); event.its.pIsSelected = pIsSelected; @@ -330,7 +320,7 @@ static int32_t ic_is_text_selected(input_session_t* ic, int32_t* pIsSelected) // See comment at beginning of namespace declaration for general information static int32_t ic_is_all_text_selected(input_session_t* ic, int32_t* pIsSelected) { - qInputContextIMFRequestDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QQnxImfRequest event(ic, ImfIsAllTextSelected); event.its.pIsSelected = pIsSelected; @@ -466,7 +456,7 @@ initEvent(event_t *pEvent, const input_session_t *pSession, EventType eventType, static spannable_string_t *toSpannableString(const QString &text) { - qInputContextDebug() << text; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "Text:" << text; spannable_string_t *pString = static_cast<spannable_string_t *>(malloc(sizeof(spannable_string_t))); pString->str = static_cast<wchar_t *>(malloc(sizeof(wchar_t) * text.length() + 1)); @@ -540,7 +530,7 @@ QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVir m_integration(integration), m_virtualKeyboard(keyboard) { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; if (!imfAvailable()) return; @@ -563,7 +553,7 @@ QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVir QQnxInputContext::~QQnxInputContext() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; Q_ASSERT(sInputContextInstance == this); sInputContextInstance = nullptr; @@ -638,7 +628,7 @@ void QQnxInputContext::processImfEvent(QQnxImfRequest *imfEvent) bool QQnxInputContext::filterEvent( const QEvent *event ) { - qInputContextDebug() << event; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << event; switch (event->type()) { case QEvent::CloseSoftwareInputPanel: @@ -661,19 +651,19 @@ QRectF QQnxInputContext::keyboardRect() const void QQnxInputContext::reset() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; endComposition(); } void QQnxInputContext::commit() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; endComposition(); } void QQnxInputContext::update(Qt::InputMethodQueries queries) { - qInputContextDebug() << queries; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "Queries:" << queries; if (queries & Qt::ImCursorPosition) { int lastCaret = m_caretPosition; @@ -685,7 +675,8 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED, sizeof(caretEvent)); caretEvent.old_pos = lastCaret; caretEvent.new_pos = m_caretPosition; - qInputContextDebug("ictrl_dispatch_event caret changed %d %d", lastCaret, m_caretPosition); + qCDebug(lcQpaInputMethods, "ictrl_dispatch_event caret changed %d %d", lastCaret, m_caretPosition); + p_ictrl_dispatch_event(&caretEvent.event); } } @@ -693,7 +684,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) void QQnxInputContext::closeSession() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; if (!imfAvailable()) return; @@ -715,7 +706,7 @@ bool QQnxInputContext::openSession() closeSession(); sInputSession = p_ictrl_open_session(&ic_funcs); - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; return sInputSession != 0; } @@ -739,7 +730,7 @@ bool QQnxInputContext::hasSelectedText() bool QQnxInputContext::dispatchRequestSoftwareInputPanel() { - qInputContextDebug() << "requesting keyboard" << m_inputPanelVisible; + qCDebug(lcQpaInputMethods) << "Requesting keyboard" << m_inputPanelVisible; m_virtualKeyboard.showKeyboard(); return true; @@ -747,7 +738,7 @@ bool QQnxInputContext::dispatchRequestSoftwareInputPanel() bool QQnxInputContext::dispatchCloseSoftwareInputPanel() { - qInputContextDebug() << "hiding keyboard" << m_inputPanelVisible; + qCDebug(lcQpaInputMethods) << "Hiding keyboard" << m_inputPanelVisible; m_virtualKeyboard.hideKeyboard(); return true; @@ -793,7 +784,7 @@ bool QQnxInputContext::dispatchFocusGainEvent(int inputHints) focusEvent.style |= IMF_EMAIL_TYPE; } - qInputContextDebug() << "ictrl_dispatch_event focus gain style:" << focusEvent.style; + qCDebug(lcQpaInputMethods) << "ictrl_dispatch_event focus gain style:" << focusEvent.style; p_ictrl_dispatch_event((event_t *)&focusEvent); @@ -803,7 +794,7 @@ bool QQnxInputContext::dispatchFocusGainEvent(int inputHints) void QQnxInputContext::dispatchFocusLossEvent() { if (hasSession()) { - qInputContextDebug("ictrl_dispatch_event focus lost"); + qCDebug(lcQpaInputMethods) << "ictrl_dispatch_event focus lost"; focus_event_t focusEvent; initEvent(&focusEvent.event, sInputSession, EVENT_FOCUS, FOCUS_LOST, sizeof(focusEvent)); @@ -878,7 +869,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan navigation_event_t navEvent; initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key, sizeof(navEvent)); navEvent.magnitude = 1; - qInputContextDebug("ictrl_dispatch_even navigation %d", key); + qCDebug(lcQpaInputMethods, "ictrl_dispatch_even navigation %d", key); p_ictrl_dispatch_event(&navEvent.event); } } else { @@ -891,7 +882,8 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan keyEvent.sequence_id = sequenceId; p_ictrl_dispatch_event(&keyEvent.event); - qInputContextDebug("ictrl_dispatch_even key %d", key); + qCDebug(lcQpaInputMethods, "ictrl_dispatch_even key %d", key); + } return true; @@ -907,7 +899,7 @@ void QQnxInputContext::updateCursorPosition() QCoreApplication::sendEvent(input, &query); m_caretPosition = query.value(Qt::ImCursorPosition).toInt(); - qInputContextDebug("%d", m_caretPosition); + qCDebug(lcQpaInputMethods, "ictrl_dispatch_even key %d", key); } void QQnxInputContext::endComposition() @@ -920,7 +912,7 @@ void QQnxInputContext::endComposition() if (hasSession()) { action_event_t actionEvent; initEvent(&actionEvent.event, sInputSession, EVENT_ACTION, ACTION_END_COMPOSITION, sizeof(actionEvent)); - qInputContextDebug("ictrl_dispatch_even end composition"); + qCDebug(lcQpaInputMethods, "ictrl_dispatch_even end composition"); p_ictrl_dispatch_event(&actionEvent.event); } } @@ -937,7 +929,7 @@ void QQnxInputContext::updateComposition(spannable_string_t *text, int32_t new_c m_composingText = QString::fromWCharArray(text->str, text->length); m_isComposing = true; - qInputContextDebug() << m_composingText << new_cursor_position; + qCDebug(lcQpaInputMethods) << "Text =" << m_composingText << "Cursor position =" << new_cursor_position; QList<QInputMethodEvent::Attribute> attributes; attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, @@ -967,7 +959,7 @@ void QQnxInputContext::updateComposition(spannable_string_t *text, int32_t new_c format.setFontUnderline(true); if (highlightColor.isValid()) format.setBackground(QBrush(highlightColor)); - qInputContextDebug() << " attrib: " << underline << highlightColor << text->spans[i].start << text->spans[i].end; + qCDebug(lcQpaInputMethods) << "attrib: " << underline << highlightColor << text->spans[i].start << text->spans[i].end; attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, text->spans[i].start, text->spans[i].end - text->spans[i].start + 1, QVariant(format))); @@ -986,7 +978,7 @@ void QQnxInputContext::finishComposingText() QObject *input = qGuiApp->focusObject(); if (input) { - qInputContextDebug() << m_composingText; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "Text =" << m_composingText; QInputMethodEvent event; event.setCommitString(m_composingText); @@ -1051,13 +1043,13 @@ int32_t QQnxInputContext::processEvent(event_t *event) int32_t result = -1; switch (event->event_type) { case EVENT_SPELL_CHECK: { - qInputContextDebug("EVENT_SPELL_CHECK"); + qCDebug(lcQpaInputMethods) << "EVENT_SPELL_CHECK"; result = handleSpellCheck(reinterpret_cast<spell_check_event_t *>(event)); break; } case EVENT_NAVIGATION: { - qInputContextDebug("EVENT_NAVIGATION"); + qCDebug(lcQpaInputMethods) << "EVENT_NAVIGATION"; int key = event->event_id == NAVIGATE_UP ? KEYCODE_UP : event->event_id == NAVIGATE_DOWN ? KEYCODE_DOWN : @@ -1080,7 +1072,7 @@ int32_t QQnxInputContext::processEvent(event_t *event) int flags = KEY_SYM_VALID | KEY_CAP_VALID; if (event->event_id == IMF_KEY_DOWN) flags |= KEY_DOWN; - qInputContextDebug("EVENT_KEY %d %d", flags, keySym); + qCDebug(lcQpaInputMethods, "EVENT_KEY %d %d", flags, keySym); QQnxScreenEventHandler::injectKeyboardEvent(flags, keySym, modifiers, 0, keyCap); result = 0; break; @@ -1120,7 +1112,7 @@ int32_t QQnxInputContext::onCommitText(spannable_string_t *text, int32_t new_cur int32_t QQnxInputContext::onDeleteSurroundingText(int32_t left_length, int32_t right_length) { - qInputContextDebug("L: %d R: %d", int(left_length), int(right_length)); + qCDebug(lcQpaInputMethods, "L: %d R: %d", int(left_length), int(right_length)); QObject *input = qGuiApp->focusObject(); if (!input) @@ -1151,7 +1143,7 @@ int32_t QQnxInputContext::onFinishComposingText() int32_t QQnxInputContext::onGetCursorPosition() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QObject *input = qGuiApp->focusObject(); if (!input) @@ -1165,7 +1157,7 @@ int32_t QQnxInputContext::onGetCursorPosition() spannable_string_t *QQnxInputContext::onGetTextAfterCursor(int32_t n, int32_t flags) { Q_UNUSED(flags); - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QObject *input = qGuiApp->focusObject(); if (!input) @@ -1182,7 +1174,7 @@ spannable_string_t *QQnxInputContext::onGetTextAfterCursor(int32_t n, int32_t fl spannable_string_t *QQnxInputContext::onGetTextBeforeCursor(int32_t n, int32_t flags) { Q_UNUSED(flags); - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; QObject *input = qGuiApp->focusObject(); if (!input) @@ -1201,7 +1193,7 @@ spannable_string_t *QQnxInputContext::onGetTextBeforeCursor(int32_t n, int32_t f int32_t QQnxInputContext::onSendEvent(event_t *event) { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; return processEvent(event); } @@ -1217,7 +1209,7 @@ int32_t QQnxInputContext::onSetComposingRegion(int32_t start, int32_t end) QString text = query.value(Qt::ImSurroundingText).toString(); m_caretPosition = query.value(Qt::ImCursorPosition).toInt(); - qInputContextDebug() << text; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "Text =" << text; m_isUpdatingText = true; @@ -1260,7 +1252,7 @@ int32_t QQnxInputContext::onIsTextSelected(int32_t* pIsSelected) { *pIsSelected = hasSelectedText(); - qInputContextDebug() << *pIsSelected; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << *pIsSelected; return 0; } @@ -1276,20 +1268,20 @@ int32_t QQnxInputContext::onIsAllTextSelected(int32_t* pIsSelected) *pIsSelected = query.value(Qt::ImSurroundingText).toString().length() == query.value(Qt::ImCurrentSelection).toString().length(); - qInputContextDebug() << *pIsSelected; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << *pIsSelected; return 0; } void QQnxInputContext::showInputPanel() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; dispatchRequestSoftwareInputPanel(); } void QQnxInputContext::hideInputPanel() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; dispatchCloseSoftwareInputPanel(); } @@ -1305,7 +1297,7 @@ QLocale QQnxInputContext::locale() const void QQnxInputContext::keyboardVisibilityChanged(bool visible) { - qInputContextDebug() << "visible=" << visible; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "visible=" << visible; if (m_inputPanelVisible != visible) { m_inputPanelVisible = visible; emitInputPanelVisibleChanged(); @@ -1314,7 +1306,7 @@ void QQnxInputContext::keyboardVisibilityChanged(bool visible) void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) { - qInputContextDebug() << "locale=" << locale; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "locale=" << locale; if (m_inputPanelLocale != locale) { m_inputPanelLocale = locale; emitLocaleChanged(); @@ -1323,7 +1315,7 @@ void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) void QQnxInputContext::setHighlightColor(int index, const QColor &color) { - qInputContextDebug() << "setHighlightColor" << index << color << qGuiApp->focusObject(); + qCDebug(lcQpaInputMethods) << "setHighlightColor" << index << color << qGuiApp->focusObject(); if (!sInputContextInstance) return; @@ -1342,7 +1334,7 @@ void QQnxInputContext::setHighlightColor(int index, const QColor &color) void QQnxInputContext::setFocusObject(QObject *object) { - qInputContextDebug() << "input item=" << object; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "input item=" << object; // Ensure the colors are reset if we've a change in focus object setHighlightColor(-1, QColor()); @@ -1372,7 +1364,7 @@ void QQnxInputContext::setFocusObject(QObject *object) bool QQnxInputContext::checkSpelling(const QString &text, void *context, void (*spellCheckDone)(void *context, const QString &text, const QList<int> &indices)) { - qInputContextDebug() << "text" << text; + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO << "Text =" << text; if (!imfAvailable()) return false; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 2a4e5b509b..7789b2830a 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -10,14 +10,10 @@ #include <QtGui/QGuiApplication> #include <QtGui/QInputMethodEvent> -#if defined(QQNXINPUTCONTEXT_DEBUG) -#define qInputContextDebug qDebug -#else -#define qInputContextDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods"); + QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard) : QPlatformInputContext(), m_inputPanelVisible(false), @@ -58,13 +54,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) if (event->type() == QEvent::CloseSoftwareInputPanel) { m_virtualKeyboard.hideKeyboard(); - qInputContextDebug("hiding virtual keyboard"); + qCDebug(lcQpaInputMethods) << "hiding virtual keyboard"; return false; } if (event->type() == QEvent::RequestSoftwareInputPanel) { m_virtualKeyboard.showKeyboard(); - qInputContextDebug("requesting virtual keyboard"); + qCDebug(lcQpaInputMethods) << "requesting virtual keyboard"; return false; } @@ -91,13 +87,13 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan void QQnxInputContext::showInputPanel() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; m_virtualKeyboard.showKeyboard(); } void QQnxInputContext::hideInputPanel() { - qInputContextDebug(); + qCDebug(lcQpaInputMethods) << Q_FUNC_INFO; m_virtualKeyboard.hideKeyboard(); } @@ -118,7 +114,7 @@ void QQnxInputContext::keyboardHeightChanged() void QQnxInputContext::keyboardVisibilityChanged(bool visible) { - qInputContextDebug() << "visible=" << visible; + qCDebug(lcQpaInputMethods) << "visible=" << visible; if (m_inputPanelVisible != visible) { m_inputPanelVisible = visible; emitInputPanelVisibleChanged(); @@ -127,7 +123,7 @@ void QQnxInputContext::keyboardVisibilityChanged(bool visible) void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) { - qInputContextDebug() << "locale=" << locale; + qCDebug(lcQpaInputMethods) << "locale=" << locale; if (m_inputPanelLocale != locale) { m_inputPanelLocale = locale; emitLocaleChanged(); @@ -136,7 +132,7 @@ void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) void QQnxInputContext::setFocusObject(QObject *object) { - qInputContextDebug() << "input item=" << object; + qCDebug(lcQpaInputMethods) << "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 310d5d4c8a..cc10f6a00e 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -64,14 +64,10 @@ #include <QtCore/QFile> #include <errno.h> -#if defined(QQNXINTEGRATION_DEBUG) -#define qIntegrationDebug qDebug -#else -#define qIntegrationDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +// Q_LOGGING_CATEGORY(lcQpaQnx, "qt.qpa.qnx"); + using namespace Qt::StringLiterals; QQnxIntegration *QQnxIntegration::ms_instance; @@ -144,7 +140,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList) { ms_instance = this; m_options = parseOptions(paramList); - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; // Open connection to QNX composition manager if (screen_create_context(&m_screenContext, getContextCapabilities(paramList))) { @@ -221,7 +217,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList) QQnxIntegration::~QQnxIntegration() { - qIntegrationDebug("platform plugin shutdown begin"); + qCDebug(lcQpaQnx) << "Platform plugin shutdown begin"; delete m_nativeInterface; #if QT_CONFIG(draganddrop) @@ -278,12 +274,12 @@ QQnxIntegration::~QQnxIntegration() ms_instance = nullptr; - qIntegrationDebug("platform plugin shutdown end"); + qCDebug(lcQpaQnx) << "Platform plugin shutdown end"; } bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; switch (cap) { case MultipleWindows: case ForeignWindows: @@ -314,7 +310,7 @@ QPlatformWindow *QQnxIntegration::createForeignWindow(QWindow *window, WId nativ QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; QSurface::SurfaceType surfaceType = window->surfaceType(); const bool needRootWindow = options() & RootWindow; switch (surfaceType) { @@ -332,14 +328,14 @@ QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *window) const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; return new QQnxRasterBackingStore(window); } #if !defined(QT_NO_OPENGL) QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; // Get color channel sizes from window format QSurfaceFormat format = context->format(); @@ -398,7 +394,7 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont #if QT_CONFIG(qqnx_pps) QPlatformInputContext *QQnxIntegration::inputContext() const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; if (m_qpaInputContext) return m_qpaInputContext; return m_inputContext; @@ -407,7 +403,7 @@ QPlatformInputContext *QQnxIntegration::inputContext() const void QQnxIntegration::moveToScreen(QWindow *window, int screen) { - qIntegrationDebug() << "w =" << window << ", s =" << screen; + qCDebug(lcQpaQnx) << Q_FUNC_INFO << "w =" << window << ", s =" << screen; // get platform window used by widget QQnxWindow *platformWindow = static_cast<QQnxWindow *>(window->handle()); @@ -421,7 +417,7 @@ void QQnxIntegration::moveToScreen(QWindow *window, int screen) QAbstractEventDispatcher *QQnxIntegration::createEventDispatcher() const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; // We transfer ownersip of the event-dispatcher to QtCoreApplication QAbstractEventDispatcher *eventDispatcher = m_eventDispatcher; @@ -438,7 +434,7 @@ QPlatformNativeInterface *QQnxIntegration::nativeInterface() const #if !defined(QT_NO_CLIPBOARD) QPlatformClipboard *QQnxIntegration::clipboard() const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; #if QT_CONFIG(qqnx_pps) if (!m_clipboard) @@ -457,7 +453,7 @@ QPlatformDrag *QQnxIntegration::drag() const QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; if ((hint == ShowIsFullScreen) && (m_options & FullScreenApplication)) return true; @@ -471,7 +467,7 @@ QPlatformServices * QQnxIntegration::services() const QWindow *QQnxIntegration::window(screen_window_t qnxWindow) const { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; QMutexLocker locker(&m_windowMapperMutex); Q_UNUSED(locker); return m_windowMapper.value(qnxWindow, 0); @@ -479,7 +475,7 @@ QWindow *QQnxIntegration::window(screen_window_t qnxWindow) const void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window) { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; QMutexLocker locker(&m_windowMapperMutex); Q_UNUSED(locker); m_windowMapper.insert(qnxWindow, window); @@ -487,7 +483,7 @@ void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window) void QQnxIntegration::removeWindow(screen_window_t qnxWindow) { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; QMutexLocker locker(&m_windowMapperMutex); Q_UNUSED(locker); m_windowMapper.remove(qnxWindow); @@ -596,7 +592,7 @@ QList<screen_display_t *> QQnxIntegration::sortDisplays(screen_display_t *availa void QQnxIntegration::createDisplays() { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; // Query number of displays int displayCount = 0; int result = screen_get_context_property_iv(m_screenContext, SCREEN_PROPERTY_DISPLAY_COUNT, @@ -626,11 +622,12 @@ void QQnxIntegration::createDisplays() Q_SCREEN_CHECKERROR(result, "Failed to query display attachment"); if (!isAttached) { - qIntegrationDebug("Skipping non-attached display %d", i); + qCDebug(lcQpaQnx) << "Skipping non-attached display " << i; continue; } - qIntegrationDebug("Creating screen for display %d", i); + qCDebug(lcQpaQnx) << "Creating screen for display " << i; + createDisplay(*orderedDisplays[i], /*isPrimary=*/false); } // of displays iteration } @@ -664,7 +661,8 @@ void QQnxIntegration::removeDisplay(QQnxScreen *screen) void QQnxIntegration::destroyDisplays() { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; + Q_FOREACH (QQnxScreen *screen, m_screens) { QWindowSystemInterface::handleScreenRemoved(screen); } @@ -715,7 +713,7 @@ bool QQnxIntegration::supportsNavigatorEvents() const #if QT_CONFIG(opengl) void QQnxIntegration::createEglDisplay() { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; // Initialize connection to EGL m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); @@ -729,7 +727,7 @@ void QQnxIntegration::createEglDisplay() void QQnxIntegration::destroyEglDisplay() { - qIntegrationDebug(); + qCDebug(lcQpaQnx) << Q_FUNC_INFO; // Close connection to EGL eglTerminate(m_eglDisplay); diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index f126300aed..8a78d54ceb 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -10,6 +10,7 @@ #include <QtCore/qmutex.h> #include <screen/screen.h> +#include <QtCore/QLoggingCategory> #if QT_CONFIG(opengl) #include <EGL/egl.h> @@ -17,6 +18,9 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaQnx); +Q_DECLARE_LOGGING_CATEGORY(lcQpaGLContext); + class QQnxScreenEventThread; class QQnxFileDialogHelper; class QQnxNativeInterface; diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp index cee86a68a0..7580e560aa 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp @@ -10,11 +10,7 @@ #include <QGuiApplication> #include <qpa/qwindowsysteminterface.h> -#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) -#define qNavigatorEventHandlerDebug qDebug -#else -#define qNavigatorEventHandlerDebug QT_NO_QDEBUG_MACRO -#endif +Q_LOGGING_CATEGORY(lcQpaQnxNavigatorEvents, "qt.qpa.qnx.navigator.events"); QT_BEGIN_NAMESPACE @@ -27,20 +23,20 @@ bool QQnxNavigatorEventHandler::handleOrientationCheck(int angle) { // reply to navigator that (any) orientation is acceptable // TODO: check if top window flags prohibit orientation change - qNavigatorEventHandlerDebug("angle=%d", angle); + qCDebug(lcQpaQnxNavigatorEvents, "angle=%d", angle); return true; } void QQnxNavigatorEventHandler::handleOrientationChange(int angle) { // update screen geometry and reply to navigator that we're ready - qNavigatorEventHandlerDebug("angle=%d", angle); + qCDebug(lcQpaQnxNavigatorEvents, "angle=%d", angle); emit rotationChanged(angle); } void QQnxNavigatorEventHandler::handleSwipeDown() { - qNavigatorEventHandlerDebug(); + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO; Q_EMIT swipeDown(); } @@ -48,25 +44,25 @@ void QQnxNavigatorEventHandler::handleSwipeDown() void QQnxNavigatorEventHandler::handleExit() { // shutdown everything - qNavigatorEventHandlerDebug(); + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO; QCoreApplication::quit(); } void QQnxNavigatorEventHandler::handleWindowGroupActivated(const QByteArray &id) { - qNavigatorEventHandlerDebug() << id; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << id; Q_EMIT windowGroupActivated(id); } void QQnxNavigatorEventHandler::handleWindowGroupDeactivated(const QByteArray &id) { - qNavigatorEventHandlerDebug() << id; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << id; Q_EMIT windowGroupDeactivated(id); } void QQnxNavigatorEventHandler::handleWindowGroupStateChanged(const QByteArray &id, Qt::WindowState state) { - qNavigatorEventHandlerDebug() << id; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << id; Q_EMIT windowGroupStateChanged(id, state); } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h index 342b6c3ef6..826c9a0ff9 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h @@ -5,9 +5,12 @@ #define QQNXNAVIGATOREVENTHANDLER_H #include <QObject> +#include <QtCore/QLoggingCategory> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaQnxNavigatorEvents); + class QQnxNavigatorEventHandler : public QObject { Q_OBJECT diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp index 8024214e69..44c71dad52 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp @@ -17,14 +17,10 @@ #include <sys/types.h> #include <sys/stat.h> -#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) -#define qNavigatorEventNotifierDebug qDebug -#else -#define qNavigatorEventNotifierDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +// Q_LOGGING_CATEGORY(lcQpaQnxNavigatorEvents, "qt.qpa.qnx.navigator.events"); + const char *QQnxNavigatorEventNotifier::navigatorControlPath = "/pps/services/navigator/control"; const size_t QQnxNavigatorEventNotifier::ppsBufferSize = 4096; @@ -44,18 +40,18 @@ QQnxNavigatorEventNotifier::~QQnxNavigatorEventNotifier() if (m_fd != -1) close(m_fd); - qNavigatorEventNotifierDebug("navigator event notifier stopped"); + qCDebug(lcQpaQnxNavigatorEvents) << "Navigator event notifier stopped"; } void QQnxNavigatorEventNotifier::start() { - qNavigatorEventNotifierDebug("navigator event notifier started"); + qCDebug(lcQpaQnxNavigatorEvents) << "Navigator event notifier started"; // open connection to navigator errno = 0; m_fd = open(navigatorControlPath, O_RDWR); if (m_fd == -1) { - qNavigatorEventNotifierDebug("failed to open navigator pps: %s", strerror(errno)); + qCDebug(lcQpaQnxNavigatorEvents, "Failed to open navigator pps: %s", strerror(errno)); return; } @@ -65,7 +61,7 @@ void QQnxNavigatorEventNotifier::start() void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray &msg, QByteArray &dat, QByteArray &id) { - qNavigatorEventNotifierDebug() << "data=" << ppsData; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << "data=" << ppsData; // tokenize pps data into lines QList<QByteArray> lines = ppsData.split('\n'); @@ -79,7 +75,7 @@ void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray // tokenize current attribute const QByteArray &attr = lines.at(i); - qNavigatorEventNotifierDebug() << "attr=" << attr; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << "attr=" << attr; int firstColon = attr.indexOf(':'); if (firstColon == -1) { @@ -96,8 +92,7 @@ void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray QByteArray key = attr.left(firstColon); QByteArray value = attr.mid(secondColon + 1); - qNavigatorEventNotifierDebug() << "key=" << key; - qNavigatorEventNotifierDebug() << "val=" << value; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << "key =" << key << "value =" << value; // save attribute value if (key == "msg") @@ -124,7 +119,7 @@ void QQnxNavigatorEventNotifier::replyPPS(const QByteArray &res, const QByteArra } ppsData += "\n"; - qNavigatorEventNotifierDebug() << "reply=" << ppsData; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << "reply=" << ppsData; // send pps message to navigator errno = 0; @@ -135,7 +130,7 @@ void QQnxNavigatorEventNotifier::replyPPS(const QByteArray &res, const QByteArra void QQnxNavigatorEventNotifier::handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id) { - qNavigatorEventNotifierDebug() << "msg=" << msg << ", dat=" << dat << ", id=" << id; + qCDebug(lcQpaQnxNavigatorEvents) << Q_FUNC_INFO << "msg=" << msg << ", dat=" << dat << ", id=" << id; // check message type if (msg == "orientationCheck") { @@ -159,7 +154,7 @@ void QQnxNavigatorEventNotifier::handleMessage(const QByteArray &msg, const QByt void QQnxNavigatorEventNotifier::readData() { - qNavigatorEventNotifierDebug("reading navigator data"); + qCDebug(lcQpaQnxNavigatorEvents) << "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 c945f3e98a..3a2fee0afb 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp @@ -8,12 +8,6 @@ #include <QByteArray> #include <private/qcore_unix_p.h> -#if defined(QQNXNAVIGATOR_DEBUG) -#define qNavigatorDebug qDebug -#else -#define qNavigatorDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE const char *QQnxNavigatorPps::navigatorControlPath = "/pps/services/navigator/control"; @@ -45,7 +39,7 @@ bool QQnxNavigatorPps::openPpsConnection() return false; } - qNavigatorDebug("successfully connected to Navigator. fd=%d", m_fd); + qCDebug(lcQpaQnxNavigator) << "successfully connected to Navigator. fd=" << m_fd; return true; } @@ -67,7 +61,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra ppsMessage += "\n"; - qNavigatorDebug() << "sending PPS message:\n" << ppsMessage; + qCDebug(lcQpaQnxNavigator) << "sending PPS message:\n" << ppsMessage; // send pps message to navigator errno = 0; @@ -89,7 +83,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra // ensure data is null terminated buffer[bytes] = '\0'; - qNavigatorDebug() << "received PPS message:\n" << buffer; + qCDebug(lcQpaQnxNavigator) << "received PPS message:\n" << buffer; // process received message QByteArray ppsData(buffer); @@ -108,7 +102,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash<QByteArray, QByteArray> &messageFields) { - qNavigatorDebug() << "data=" << ppsData; + qCDebug(lcQpaQnxNavigator) << "data=" << ppsData; // tokenize pps data into lines QList<QByteArray> lines = ppsData.split('\n'); @@ -123,7 +117,7 @@ void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash<QByteArray, QBy // tokenize current attribute const QByteArray &attr = lines.at(i); - qNavigatorDebug() << "attr=" << attr; + qCDebug(lcQpaQnxNavigator) << "attr=" << attr; int firstColon = attr.indexOf(':'); if (firstColon == -1) { @@ -140,8 +134,7 @@ void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash<QByteArray, QBy QByteArray key = attr.left(firstColon); QByteArray value = attr.mid(secondColon + 1); - qNavigatorDebug() << "key=" << key; - qNavigatorDebug() << "val=" << value; + qCDebug(lcQpaQnxNavigator) << "key=" << key << "value=" << value; messageFields[key] = value; } } diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.h b/src/plugins/platforms/qnx/qqnxnavigatorpps.h index cbe0f99621..889b9f62eb 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.h +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.h @@ -5,9 +5,12 @@ #define QQNXNAVIGATORPPS_H #include "qqnxabstractnavigator.h" +#include <QtCore/QLoggingCategory> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaQnxNavigator); + template <typename K, typename V> class QHash; class QQnxNavigatorPps : public QQnxAbstractNavigator diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index cf80e44f84..b94c056a79 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -10,12 +10,6 @@ #include <errno.h> -#if defined(QQNXRASTERBACKINGSTORE_DEBUG) -#define qRasterBackingStoreDebug qDebug -#else -#define qRasterBackingStoreDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window) @@ -23,14 +17,14 @@ QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window) m_needsPosting(false), m_scrolled(false) { - qRasterBackingStoreDebug() << "w =" << window; + qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window; m_window = window; } QQnxRasterBackingStore::~QQnxRasterBackingStore() { - qRasterBackingStoreDebug() << "w =" << window(); + qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window(); } QPaintDevice *QQnxRasterBackingStore::paintDevice() @@ -45,7 +39,7 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const { Q_UNUSED(offset); - qRasterBackingStoreDebug() << "w =" << this->window(); + qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << this->window(); // Sometimes this method is called even though there is nothing to be // flushed (posted in "screen" parlance), for instance, after an expose @@ -67,7 +61,7 @@ void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticCont { Q_UNUSED(size); Q_UNUSED(staticContents); - qRasterBackingStoreDebug() << "w =" << window() << ", s =" << size; + qCDebug(lcQpaBackingStore) << 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 @@ -75,7 +69,7 @@ void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticCont bool QQnxRasterBackingStore::scroll(const QRegion &area, int dx, int dy) { - qRasterBackingStoreDebug() << "w =" << window(); + qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window(); m_needsPosting = true; @@ -91,7 +85,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - qRasterBackingStoreDebug() << "w =" << window(); + qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window(); m_needsPosting = true; platformWindow()->adjustBufferSize(); @@ -119,7 +113,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) void QQnxRasterBackingStore::endPaint() { - qRasterBackingStoreDebug() << "w =" << window(); + qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window(); } QQnxRasterWindow *QQnxRasterBackingStore::platformWindow() const diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index fb7a1d3fd3..303c9e7c06 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -10,12 +10,6 @@ #include <errno.h> -#if defined(QQNXRASTERWINDOW_DEBUG) -#define qRasterWindowDebug qDebug -#else -#define qRasterWindowDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE QQnxRasterWindow::QQnxRasterWindow(QWindow *window, screen_context_t context, bool needRootWindow) : @@ -61,7 +55,7 @@ void QQnxRasterWindow::post(const QRegion &dirty) // Check if render buffer exists and something was rendered if (m_currentBufferIndex != -1 && !dirty.isEmpty()) { - qRasterWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "window = " << window(); QQnxBuffer ¤tBuffer = m_buffers[m_currentBufferIndex]; // Copy unmodified region from old render buffer to new render buffer; @@ -94,14 +88,14 @@ void QQnxRasterWindow::post(const QRegion &dirty) void QQnxRasterWindow::scroll(const QRegion ®ion, int dx, int dy, bool flush) { - qRasterWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "window = " << window(); blitPreviousToCurrent(region, dx, dy, flush); m_scrolled += region; } QQnxBuffer &QQnxRasterWindow::renderBuffer() { - qRasterWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "window = " << window(); // Check if render buffer is invalid if (m_currentBufferIndex == -1) { @@ -162,7 +156,7 @@ void QQnxRasterWindow::resetBuffers() void QQnxRasterWindow::blitPreviousToCurrent(const QRegion ®ion, int dx, int dy, bool flush) { - qRasterWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "window = " << window(); // Abort if previous buffer is invalid or if nothing to copy if (m_previousBufferIndex == -1 || region.isEmpty()) diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 9d689da991..f2c3b3847d 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -15,12 +15,6 @@ #include <errno.h> -#if defined(QQNXSCREEN_DEBUG) -#define qScreenDebug qDebug -#else -#define qScreenDebug QT_NO_QDEBUG_MACRO -#endif - #if defined(QQNX_PHYSICAL_SCREEN_WIDTH) && QQNX_PHYSICAL_SCREEN_WIDTH > 0 \ && defined(QQNX_PHYSICAL_SCREEN_HEIGHT) && QQNX_PHYSICAL_SCREEN_HEIGHT > 0 #define QQNX_PHYSICAL_SCREEN_SIZE_DEFINED @@ -34,6 +28,8 @@ static const int MAX_UNDERLAY_ZORDER = -1; QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen"); + static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { int val[2]; @@ -46,9 +42,9 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { if (val[0] > 0 && val[1] > 0) return QSize(val[0], val[1]); - qScreenDebug("QQnxScreen: screen_get_display_property_iv() reported an invalid " - "physical screen size (%dx%d). Falling back to QQNX_PHYSICAL_SCREEN_SIZE " - "environment variable.", val[0], val[1]); + qCDebug(lcQpaScreen, "QQnxScreen: screen_get_display_property_iv() reported an invalid " + "physical screen size (%dx%d). Falling back to QQNX_PHYSICAL_SCREEN_SIZE " + "environment variable.", val[0], val[1]); const QString envPhySizeStr = qgetenv("QQNX_PHYSICAL_SCREEN_SIZE"); if (!envPhySizeStr.isEmpty()) { @@ -90,7 +86,7 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_coverWindow(0), m_cursor(new QQnxCursor()) { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; // Cache initial orientation of this display int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation); @@ -127,7 +123,7 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, QQnxScreen::~QQnxScreen() { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; Q_FOREACH (QQnxWindow *childWindow, m_childWindows) childWindow->setScreen(0); @@ -236,7 +232,7 @@ QPixmap QQnxScreen::grabWindow(WId window, int x, int y, int width, int height) static int defaultDepth() { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; static int defaultDepth = 0; if (defaultDepth == 0) { // check if display depth was specified in environment variable; @@ -250,7 +246,7 @@ static int defaultDepth() QRect QQnxScreen::availableGeometry() const { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; // available geometry = total geometry - keyboard return QRect(m_currentGeometry.x(), m_currentGeometry.y(), m_currentGeometry.width(), m_currentGeometry.height() - m_keyboardHeight); @@ -270,12 +266,12 @@ qreal QQnxScreen::refreshRate() const qWarning("QQnxScreen: Failed to query screen mode. Using default value of 60Hz"); return 60.0; } - qScreenDebug("screen mode:\n" - " width = %u\n" - " height = %u\n" - " refresh = %u\n" - " interlaced = %u", - uint(displayMode.width), uint(displayMode.height), uint(displayMode.refresh), uint(displayMode.interlaced)); + qCDebug(lcQpaScreen, "screen mode:\n" + " width = %u\n" + " height = %u\n" + " refresh = %u\n" + " interlaced = %u", + uint(displayMode.width), uint(displayMode.height), uint(displayMode.refresh), uint(displayMode.interlaced)); return static_cast<qreal>(displayMode.refresh); } @@ -309,7 +305,7 @@ Qt::ScreenOrientation QQnxScreen::orientation() const else orient = Qt::InvertedLandscapeOrientation; } - qScreenDebug() << "orientation =" << orient; + qCDebug(lcQpaScreen) << Q_FUNC_INFO << "Orientation =" << orient; return orient; } @@ -333,7 +329,7 @@ static bool isOrthogonal(int angle1, int angle2) void QQnxScreen::setRotation(int rotation) { - qScreenDebug("orientation = %d", rotation); + qCDebug(lcQpaScreen) << Q_FUNC_INFO << "orientation =" << rotation; // Check if rotation changed // We only want to rotate if we are the primary screen if (m_currentRotation != rotation && isPrimaryScreen()) { @@ -354,7 +350,7 @@ void QQnxScreen::setRotation(int rotation) // Resize root window if we've rotated 90 or 270 from previous orientation if (isOrthogonal(m_currentRotation, rotation)) { - qScreenDebug() << "resize, size =" << m_currentGeometry.size(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); if (rootWindow()) rootWindow()->setGeometry(QRect(QPoint(0,0), m_currentGeometry.size())); @@ -501,7 +497,7 @@ QQnxWindow *QQnxScreen::findWindow(screen_window_t windowHandle) const void QQnxScreen::addWindow(QQnxWindow *window) { - qScreenDebug() << "window =" << window; + qCDebug(lcQpaScreen) << Q_FUNC_INFO << "Window =" << window; if (m_childWindows.contains(window)) return; @@ -524,7 +520,7 @@ void QQnxScreen::addWindow(QQnxWindow *window) void QQnxScreen::removeWindow(QQnxWindow *window) { - qScreenDebug() << "window =" << window; + qCDebug(lcQpaScreen) << Q_FUNC_INFO << "Window =" << window; if (window != m_coverWindow) { const int numWindowsRemoved = m_childWindows.removeAll(window); @@ -539,7 +535,7 @@ void QQnxScreen::removeWindow(QQnxWindow *window) void QQnxScreen::raiseWindow(QQnxWindow *window) { - qScreenDebug() << "window =" << window; + qCDebug(lcQpaScreen) << Q_FUNC_INFO << "Window =" << window; if (window != m_coverWindow) { removeWindow(window); @@ -549,7 +545,7 @@ void QQnxScreen::raiseWindow(QQnxWindow *window) void QQnxScreen::lowerWindow(QQnxWindow *window) { - qScreenDebug() << "window =" << window; + qCDebug(lcQpaScreen) << Q_FUNC_INFO << "Window =" << window; if (window != m_coverWindow) { removeWindow(window); @@ -559,7 +555,7 @@ void QQnxScreen::lowerWindow(QQnxWindow *window) void QQnxScreen::updateHierarchy() { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; QList<QQnxWindow*>::const_iterator it; int result; @@ -709,7 +705,7 @@ void QQnxScreen::windowClosed(void *window) void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState state) { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; if (!rootWindow() || id != rootWindow()->groupName()) return; @@ -724,7 +720,7 @@ void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState s void QQnxScreen::activateWindowGroup(const QByteArray &id) { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; if (!rootWindow() || id != rootWindow()->groupName()) return; @@ -743,7 +739,7 @@ void QQnxScreen::activateWindowGroup(const QByteArray &id) void QQnxScreen::deactivateWindowGroup(const QByteArray &id) { - qScreenDebug(); + qCDebug(lcQpaScreen) << Q_FUNC_INFO; if (!rootWindow() || id != rootWindow()->groupName()) return; diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index f988b42ab4..17b282bdc1 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -30,6 +30,10 @@ const int SCREEN_PROPERTY_SYM = SCREEN_PROPERTY_KEY_SYM; QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen); +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreenEvents); +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreenBuffer); + class QQnxWindow; class QQnxScreen : public QObject, public QPlatformScreen diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index e93a38f62c..6d923bc3a8 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -19,11 +19,7 @@ #include <errno.h> #include <sys/keycodes.h> -#if defined(QQNXSCREENEVENT_DEBUG) -#define qScreenEventDebug qDebug -#else -#define qScreenEventDebug QT_NO_QDEBUG_MACRO -#endif +Q_LOGGING_CATEGORY(lcQpaScreenEvents, "qt.qpa.screen.events"); static int qtKey(int virtualKey, QChar::Category category) { @@ -197,7 +193,7 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType) default: // event ignored - qScreenEventDebug("unknown event %d", qnxType); + qCDebug(lcQpaScreenEvents) << Q_FUNC_INFO << "Unknown event" << qnxType; return false; } @@ -235,7 +231,7 @@ void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifie QWindowSystemInterface::handleExtendedKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, scan, virtualKey, modifiers, keyStr, flags & KEY_REPEAT); - qScreenEventDebug() << "Qt key t=" << type << ", k=" << key << ", s=" << keyStr; + qCDebug(lcQpaScreenEvents) << "Qt key t=" << type << ", k=" << key << ", s=" << keyStr; } void QQnxScreenEventHandler::setScreenEventThread(QQnxScreenEventThread *eventThread) @@ -364,12 +360,12 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) if (wOld) { QWindowSystemInterface::handleLeaveEvent(wOld); - qScreenEventDebug() << "Qt leave, w=" << wOld; + qCDebug(lcQpaScreenEvents) << "Qt leave, w=" << wOld; } if (w) { QWindowSystemInterface::handleEnterEvent(w); - qScreenEventDebug() << "Qt enter, w=" << w; + qCDebug(lcQpaScreenEvents) << "Qt enter, w=" << w; } } @@ -412,8 +408,8 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice, localPoint, globalPoint, buttons, Qt::NoButton, QEvent::MouseMove); - qScreenEventDebug() << "Qt mouse move, w=" << w << ", (" << localPoint.x() << "," - << localPoint.y() << "), b=" << static_cast<int>(buttons); + qCDebug(lcQpaScreenEvents) << "Qt mouse move, w=" << w << ", (" << localPoint.x() << "," + << localPoint.y() << "), b=" << static_cast<int>(buttons); } if (m_lastButtonState != buttons) { @@ -428,8 +424,8 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice, localPoint, globalPoint, buttons, button, QEvent::MouseButtonRelease); - qScreenEventDebug() << "Qt mouse release, w=" << w << ", (" << localPoint.x() - << "," << localPoint.y() << "), b=" << button; + qCDebug(lcQpaScreenEvents) << "Qt mouse release, w=" << w << ", (" << localPoint.x() + << "," << localPoint.y() << "), b=" << button; } } @@ -443,8 +439,8 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice, localPoint, globalPoint, buttons, button, QEvent::MouseButtonPress); - qScreenEventDebug() << "Qt mouse press, w=" << w << ", (" << localPoint.x() - << "," << localPoint.y() << "), b=" << button; + qCDebug(lcQpaScreenEvents) << "Qt mouse press, w=" << w << ", (" << localPoint.x() + << "," << localPoint.y() << "), b=" << button; } } } @@ -455,7 +451,7 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event) QPoint angleDelta(0, wheelDelta); QWindowSystemInterface::handleWheelEvent(w, timestamp, m_mouseDevice, localPoint, globalPoint, QPoint(), angleDelta); - qScreenEventDebug() << "Qt wheel, w=" << w << ", (" << localPoint.x() << "," + qCDebug(lcQpaScreenEvents) << "Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta); } } @@ -513,12 +509,12 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) if (wOld) { QWindowSystemInterface::handleLeaveEvent(wOld); - qScreenEventDebug() << "Qt leave, w=" << wOld; + qCDebug(lcQpaScreenEvents) << "Qt leave, w=" << wOld; } if (w) { QWindowSystemInterface::handleEnterEvent(w); - qScreenEventDebug() << "Qt enter, w=" << w; + qCDebug(lcQpaScreenEvents) << "Qt enter, w=" << w; } } m_lastMouseWindow = qnxWindow; @@ -585,9 +581,9 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) // inject event into Qt QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList); - qScreenEventDebug() << "Qt touch, w =" << w - << ", p=" << m_touchPoints[touchId].area.topLeft() - << ", t=" << type; + qCDebug(lcQpaScreenEvents) << "Qt touch, w =" << w + << ", p=" << m_touchPoints[touchId].area.topLeft() + << ", t=" << type; } } } @@ -631,7 +627,8 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) return; } - qScreenEventDebug() << "display attachment is now:" << isAttached; + qCDebug(lcQpaScreenEvents) << "display attachment is now:" << isAttached; + QQnxScreen *screen = m_qnxIntegration->screenForNative(nativeDisplay); if (!screen) { @@ -641,7 +638,7 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) if (val[0] == 0 && val[1] == 0) //If screen size is invalid, wait for the next event return; - qScreenEventDebug("creating new QQnxScreen for newly attached display"); + qCDebug(lcQpaScreenEvents) << "Creating new QQnxScreen for newly attached display"; m_qnxIntegration->createDisplay(nativeDisplay, false /* not primary, we assume */); } } else if (!isAttached) { @@ -654,7 +651,7 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) if (!screen->isPrimaryScreen()) { // libscreen display is deactivated, let's remove the QQnxScreen / QScreen - qScreenEventDebug("removing display"); + qCDebug(lcQpaScreenEvents) << "Removing display"; m_qnxIntegration->removeDisplay(screen); } } @@ -691,7 +688,7 @@ void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event) break; default: // event ignored - qScreenEventDebug() << "Ignore property event for property: " << property; + qCDebug(lcQpaScreenEvents) << "Ignore property event for property: " << property; } } @@ -734,7 +731,7 @@ void QQnxScreenEventHandler::handleGeometryPropertyEvent(screen_window_t window) QWindowSystemInterface::handleGeometryChange(qtWindow, rect); } - qScreenEventDebug() << qtWindow << "moved to" << rect; + qCDebug(lcQpaScreenEvents) << qtWindow << "moved to" << rect; } void QQnxScreenEventHandler::timerEvent(QTimerEvent *event) diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h index d27186af9e..ba3579aaf7 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h @@ -5,11 +5,14 @@ #define QQNXSCREENEVENTHANDLER_H #include <qpa/qwindowsysteminterface.h> +#include <QtCore/QLoggingCategory> #include <screen/screen.h> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreenEvents); + class QQnxIntegration; class QQnxScreenEventFilter; class QQnxScreenEventThread; diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp index 69997e4ba0..6b4ffc3962 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp @@ -14,12 +14,6 @@ #include <cctype> -#if defined(QQNXSCREENEVENTTHREAD_DEBUG) -#define qScreenEventThreadDebug qDebug -#else -#define qScreenEventThreadDebug QT_NO_QDEBUG_MACRO -#endif - static const int c_screenCode = _PULSE_CODE_MINAVAIL + 0; static const int c_armCode = _PULSE_CODE_MINAVAIL + 1; static const int c_quitCode = _PULSE_CODE_MINAVAIL + 2; @@ -74,7 +68,7 @@ QQnxScreenEventThread::~QQnxScreenEventThread() void QQnxScreenEventThread::run() { - qScreenEventThreadDebug("screen event thread started"); + qCDebug(lcQpaScreenEvents) << "Screen event thread started"; while (1) { struct _pulse msg; @@ -90,7 +84,7 @@ void QQnxScreenEventThread::run() qWarning() << "MsgReceive error" << strerror(errno); } - qScreenEventThreadDebug("screen event thread stopped"); + qCDebug(lcQpaScreenEvents) << "Screen event thread stopped"; } void QQnxScreenEventThread::armEventsPending(int count) @@ -134,10 +128,10 @@ void QQnxScreenEventThread::shutdown() { MsgSendPulse(m_connectionId, SIGEV_PULSE_PRIO_INHERIT, c_quitCode, 0); - qScreenEventThreadDebug("screen event thread shutdown begin"); + qCDebug(lcQpaScreenEvents) << "Screen event thread shutdown begin"; // block until thread terminates wait(); - qScreenEventThreadDebug("screen event thread shutdown end"); + qCDebug(lcQpaScreenEvents) << "Screen event thread shutdown end"; } diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp index b4650de315..5eceacef95 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp @@ -18,14 +18,10 @@ #include <sys/types.h> #include <unistd.h> -#if defined(QQNXVIRTUALKEYBOARD_DEBUG) -#define qVirtualKeyboardDebug qDebug -#else -#define qVirtualKeyboardDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaQnxVirtualKeyboard, "qt.qpa.qnx.virtualkeyboard"); + const char *QQnxVirtualKeyboardPps::ms_PPSPath = "/pps/services/input/control"; const size_t QQnxVirtualKeyboardPps::ms_bufferSize = 2048; @@ -45,7 +41,7 @@ QQnxVirtualKeyboardPps::~QQnxVirtualKeyboardPps() void QQnxVirtualKeyboardPps::start() { - qVirtualKeyboardDebug("starting keyboard event processing"); + qCDebug(lcQpaQnxVirtualKeyboard) << "Starting keyboard event processing"; if (!connect()) return; } @@ -90,8 +86,8 @@ bool QQnxVirtualKeyboardPps::connect() m_fd = ::open(ms_PPSPath, O_RDWR); if (m_fd == -1) { - qVirtualKeyboardDebug() << "Unable to open" << ms_PPSPath - << ':' << strerror(errno); + qCDebug(lcQpaQnxVirtualKeyboard) << "Unable to open" << ms_PPSPath + << ':' << strerror(errno); close(); return false; } @@ -128,7 +124,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() { qint64 nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1); - qVirtualKeyboardDebug("keyboardMessage size: %lld", nread); + qCDebug(lcQpaQnxVirtualKeyboard, "keyboardMessage size: %lld", nread); if (nread < 0){ connect(); // reconnect return; @@ -167,7 +163,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() else if (strcmp(value, "info") == 0) handleKeyboardInfoMessage(); else if (strcmp(value, "connect") == 0) - qVirtualKeyboardDebug("Unhandled command 'connect'"); + qCDebug(lcQpaQnxVirtualKeyboard, "Unhandled command 'connect'"); else qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS msg value: %s", value ? value : "[null]"); } else if (pps_decoder_get_string(m_decoder, "res", &value) == PPS_DECODER_OK) { @@ -194,12 +190,12 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage() } setHeight(newHeight); - qVirtualKeyboardDebug("size=%d", newHeight); + qCDebug(lcQpaQnxVirtualKeyboard, "size=%d", newHeight); } bool QQnxVirtualKeyboardPps::showKeyboard() { - qVirtualKeyboardDebug(); + qCDebug(lcQpaQnxVirtualKeyboard) << Q_FUNC_INFO; if (!prepareToSend()) return false; @@ -221,7 +217,7 @@ bool QQnxVirtualKeyboardPps::showKeyboard() bool QQnxVirtualKeyboardPps::hideKeyboard() { - qVirtualKeyboardDebug(); + qCDebug(lcQpaQnxVirtualKeyboard) << Q_FUNC_INFO; if (!prepareToSend()) return false; diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h index 88af284db3..8f1d390760 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h @@ -5,11 +5,13 @@ #define VIRTUALKEYBOARDPPS_H #include "qqnxabstractvirtualkeyboard.h" +#include <QtCore/QLoggingCategory> #include <sys/pps.h> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaQnxVirtualKeyboard); class QSocketNotifier; diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index eed45227f6..3384932a8b 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -21,14 +21,10 @@ #include <errno.h> -#if defined(QQNXWINDOW_DEBUG) -#define qWindowDebug qDebug -#else -#define qWindowDebug QT_NO_QDEBUG_MACRO -#endif - QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window"); + #define DECLARE_DEBUG_VAR(variable) \ static bool debug_ ## variable() \ { static bool value = qgetenv("QNX_SCREEN_DEBUG").contains(QT_STRINGIFY(variable)); return value; } @@ -125,7 +121,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW m_windowState(Qt::WindowNoState), m_firstActivateHandled(false) { - qWindowDebug() << "window =" << window << ", size =" << window->size(); + qCDebug(lcQpaWindow) << "window =" << window << ", size =" << window->size(); QQnxScreen *platformScreen = static_cast<QQnxScreen *>(window->screen()->handle()); @@ -195,13 +191,13 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW bool ok = false; int pipeline = pipelineValue.toInt(&ok); if (ok) { - qWindowDebug() << "Set pipeline value to" << pipeline; + qCDebug(lcQpaWindow) << "Set pipeline value to" << pipeline; Q_SCREEN_CHECKERROR( screen_set_window_property_iv(m_window, SCREEN_PROPERTY_PIPELINE, &pipeline), "Failed to set window pipeline"); } else { - qWindowDebug() << "Invalid pipeline value:" << pipelineValue; + qCDebug(lcQpaWindow) << "Invalid pipeline value:" << pipelineValue; } } @@ -231,7 +227,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW if (debug > 0) { Q_SCREEN_CHECKERROR(screen_set_window_property_iv(nativeHandle(), SCREEN_PROPERTY_DEBUG, &debug), "Could not set SCREEN_PROPERTY_DEBUG"); - qWindowDebug() << "window SCREEN_PROPERTY_DEBUG= " << debug; + qCDebug(lcQpaWindow) << "window SCREEN_PROPERTY_DEBUG= " << debug; } } @@ -248,7 +244,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, screen_window_ , m_parentGroupName(256, 0) , m_isTopLevel(false) { - qWindowDebug() << "window =" << window << ", size =" << window->size(); + qCDebug(lcQpaWindow) << "window =" << window << ", size =" << window->size(); collectWindowGroup(); @@ -269,7 +265,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, screen_window_ QQnxWindow::~QQnxWindow() { - qWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << "window =" << window(); // Qt should have already deleted the children before deleting the parent. Q_ASSERT(m_childWindows.size() == 0); @@ -305,9 +301,9 @@ void QQnxWindow::setGeometry(const QRect &rect) void QQnxWindow::setGeometryHelper(const QRect &rect) { - qWindowDebug() << "window =" << window() - << ", (" << rect.x() << "," << rect.y() - << "," << rect.width() << "," << rect.height() << ")"; + qCDebug(lcQpaWindow) << "window =" << window() + << ", (" << rect.x() << "," << rect.y() + << "," << rect.width() << "," << rect.height() << ")"; // Call base class method QPlatformWindow::setGeometry(rect); @@ -335,7 +331,7 @@ void QQnxWindow::setGeometryHelper(const QRect &rect) void QQnxWindow::setVisible(bool visible) { - qWindowDebug() << "window =" << window() << "visible =" << visible; + qCDebug(lcQpaWindow) << "window =" << window() << "visible =" << visible; if (m_visible == visible || window()->type() == Qt::Desktop) return; @@ -374,7 +370,7 @@ void QQnxWindow::setVisible(bool visible) void QQnxWindow::updateVisibility(bool parentVisible) { - qWindowDebug() << "parentVisible =" << parentVisible << "window =" << window(); + qCDebug(lcQpaWindow) << "parentVisible =" << parentVisible << "window =" << window(); // Set window visibility int val = (m_visible && parentVisible) ? 1 : 0; Q_SCREEN_CHECKERROR(screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &val), @@ -386,7 +382,7 @@ void QQnxWindow::updateVisibility(bool parentVisible) void QQnxWindow::setOpacity(qreal level) { - qWindowDebug() << "window =" << window() << "opacity =" << level; + qCDebug(lcQpaWindow) << "window =" << window() << "opacity =" << level; // Set window global alpha int val = (int)(level * 255); Q_SCREEN_CHECKERROR(screen_set_window_property_iv(m_window, SCREEN_PROPERTY_GLOBAL_ALPHA, &val), @@ -397,7 +393,7 @@ void QQnxWindow::setOpacity(qreal level) void QQnxWindow::setExposed(bool exposed) { - qWindowDebug() << "window =" << window() << "expose =" << exposed; + qCDebug(lcQpaWindow) << "window =" << window() << "expose =" << exposed; if (m_exposed != exposed) { m_exposed = exposed; @@ -412,7 +408,7 @@ bool QQnxWindow::isExposed() const void QQnxWindow::setBufferSize(const QSize &size) { - qWindowDebug() << "window =" << window() << "size =" << size; + qCDebug(lcQpaWindow) << "window =" << window() << "size =" << size; // libscreen fails when creating empty buffers const QSize nonEmptySize = size.isEmpty() ? QSize(1, 1) : size; @@ -479,7 +475,7 @@ void QQnxWindow::setBufferSize(const QSize &size) void QQnxWindow::setScreen(QQnxScreen *platformScreen) { - qWindowDebug() << "window =" << window() << "platformScreen =" << platformScreen; + qCDebug(lcQpaWindow) << "window =" << window() << "platformScreen =" << platformScreen; if (platformScreen == 0) { // The screen has been destroyed m_screen = 0; @@ -493,7 +489,7 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) return; if (m_screen) { - qWindowDebug("Moving window to different screen"); + qCDebug(lcQpaWindow) << "Moving window to different screen"; m_screen->removeWindow(this); if ((QQnxIntegration::instance()->options() & QQnxIntegration::RootWindow)) { @@ -524,7 +520,7 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) void QQnxWindow::removeFromParent() { - qWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "window =" << window(); // Remove from old Hierarchy position if (m_parentWindow) { if (Q_UNLIKELY(!m_parentWindow->m_childWindows.removeAll(this))) @@ -538,7 +534,7 @@ void QQnxWindow::removeFromParent() void QQnxWindow::setParent(const QPlatformWindow *window) { - qWindowDebug() << "window =" << this->window() << "platformWindow =" << window; + qCDebug(lcQpaWindow) << "window =" << this->window() << "platformWindow =" << window; // Cast away the const, we need to modify the hierarchy. QQnxWindow* const newParent = static_cast<QQnxWindow*>(const_cast<QPlatformWindow*>(window)); @@ -570,7 +566,7 @@ void QQnxWindow::setParent(const QPlatformWindow *window) void QQnxWindow::raise() { - qWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "window =" << window(); if (m_parentWindow) { m_parentWindow->m_childWindows.removeAll(this); @@ -584,7 +580,7 @@ void QQnxWindow::raise() void QQnxWindow::lower() { - qWindowDebug() << "window =" << window(); + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "window =" << window(); if (m_parentWindow) { m_parentWindow->m_childWindows.removeAll(this); @@ -698,7 +694,7 @@ void QQnxWindow::setFocus(screen_window_t newFocusWindow) void QQnxWindow::setWindowState(Qt::WindowStates state) { - qWindowDebug() << "state =" << state; + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "state =" << state; // Prevent two calls with Qt::WindowFullScreen from changing m_unmaximizedGeometry if (m_windowState == state) @@ -713,7 +709,7 @@ void QQnxWindow::setWindowState(Qt::WindowStates state) void QQnxWindow::propagateSizeHints() { // nothing to do; silence base class warning - qWindowDebug("ignored"); + // qWindowDebug("ignored"); } QPlatformScreen *QQnxWindow::screen() const @@ -742,7 +738,7 @@ void QQnxWindow::minimize() void QQnxWindow::setRotation(int rotation) { - qWindowDebug() << "angle =" << rotation; + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "angle =" << rotation; Q_SCREEN_CHECKERROR( screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation), "Failed to set window rotation"); @@ -818,7 +814,7 @@ void QQnxWindow::joinWindowGroup(const QByteArray &groupName) { bool changed = false; - qWindowDebug() << "group:" << groupName; + qCDebug(lcQpaWindow) << Q_FUNC_INFO << "group:" << groupName; // screen has this annoying habit of generating a CLOSE/CREATE when the owner context of // the parent group moves a foreign window to another group that it also owns. The diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index d302f22415..013ea342e4 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -8,6 +8,7 @@ #include "qqnxabstractcover.h" #include <QtCore/QScopedPointer> +#include <QtCore/QLoggingCategory> #if !defined(QT_NO_OPENGL) #include <EGL/egl.h> @@ -17,6 +18,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcQpaWindow); + // all surfaces double buffered #define MAX_BUFFER_COUNT 2 |